ga finds infeasible solutions for a nonlinear inequality constrained problem
2 views (last 30 days)
Show older comments
Hello, I'm doing my Master Thesis in Matlab using ga but I only started working on it this year. It consists of a program that optimizes Portal Frames (Metal Warehouses).
For some general understanding of the problem(simply put):
I have 7 variables.
The objective is to minimize the weight of the stucture, which is the weight of all the colummns +weight of all the beams+weight of the roofing and secondary elements.
My constraintfunction consists of the Eurocodes rules for Portal frames buildings, which are a bunch rules to make sure each part of the building can withstand the loads. The result of this are 21 nonlinear constraints that I put into vector c. According to ga documentation they all need to be negative to be satisfied.
The algorithm takes around 10min to run for a Population of 4 individuals and 4 Generations
My problem:
The initial Population created by ga is in the infeaseble zone. I know this because I set the constraintfunction c vector to output vector c every time it runs. After mutation and crossover many solutions are still in the infeasible zone and most times the final solution is infeasible.
This causes many problems since some constraints in the constraintf aren't ready to be calculated once the previous constraints fail, so sometimes there's errors.
What can be the cause of this? I was reading documentation already, my ceq vector is equal to [] as are my other vectors. I have lower and upper bounds on my variables and 5 of the 7 variables are integers ( which I know complicates the options, and I shouldn't touch some of them).
Is this the way ga is supposed to work, and if I raise the number of generations and population it will go to the feasible zone? If so I have a big problem because my laptop can't handle this optimization.
Thanks in advance!
Best regards,
Pedro
2 Comments
Matt J
on 28 Aug 2013
Edited: Matt J
on 28 Aug 2013
It's possible that your problem is simply infeasible either truly, or because you have a bug in your constraint computations. In addition to that...
This causes many problems since some constraints in the constraintf aren't ready to be calculated once the previous constraints fail, so sometimes there's errors.
... you need to elaborate on this. What does it mean for a constraint to be "ready" to be calculated? And why can't a value be assigned to c_i(x) just because c_j(x)>0, j<i ? The constraint component c_i(x) are supposed to be functions of x alone and should be computable once x is given.
Answers (1)
Alan Weiss
on 28 Aug 2013
You are free to pass ga any initial population that you like. ga cannot guarantee that an initial population is feasible with respect to nonlinear constraints, only with respect to bounds and linear constraints.
By the way, using only 4 individuals for a 7-parameter problem is unlikely to give you a reliable answer.
You might be happier using patternsearch. You can give initial points as random within your bounds:
x0 = lb + rand(size(lb)).*(ub-lb);
Quite often, patternsearch is better at solving nonlinearly constrained problems, simply because patternsearch is usually better at solving optimization problems, and the nonlinear constraint solver solves many optimization problems as subproblems.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
2 Comments
Alan Weiss
on 29 Aug 2013
Oh, I didn't realize that you had an integer problem. You are stuck with the limitations of integer ga if you just take the plain problem formulation and feed it to ga.
However, looking at your constraints, you have just two choices for x(1) and x(2), and just 11 choices for x(5), x(6), and x(7). This gives you 4*11^3 = 5324 continuous optimization problems to solve, if you just run through the integer possibilities one at a time. I suggest you ditch ga, set up your problem to have just two continuous dimensions, and use either fmincon or patternsearch on the resulting 5324 two-dimensional continuous minimizations. You might even use MultiStart if you want to take a number of different start points for the two-dimensional minimizations.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!