ga finds infeasible solutions for a nonlinear inequality constrained problem

2 views (last 30 days)
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
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.
Pedro
Pedro on 28 Aug 2013
There are definitely feasible solutions so that possibility is excluded.
For example c(1)=Ned-NplRd; % in a feasible zone NplRd will be bigger then Ned
if -1<Ned/NplRd<1;%in an infeasible zone Ned will be bigger,this fails
K=6
end
but I could correct these failing varaibles, it happens that they are many ! If I can get ga to start in the feasible zone, I would avoid this problem.
What I would like to know is:
ga is suposed to start in an infeasible zone? if so, for the final solution to be feasible I have to increase Population and Generations? -my computer can't stand it is there a way of making ga start in the feasible domain?
Thanks for your answer

Sign in to comment.

Answers (1)

Alan Weiss
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
Pedro
Pedro on 28 Aug 2013
First of all thanks for your answer,
I want the user input variables to be as few as possible, and even though I have a clue about the feasible zone, other users might not have. So I would like to know if there is a way of ga "obeying" the constraint from the start.
I have LB=[1 1 2 1 1 1 1] and UB=[2 2 6 45 11 11 11] from which intCon=[1 2 5 6 7];
I tried to set Creation Function as Feasible population, but ga went back to default. From what I read, because it is a mixed integer and nonlinear constraints problem. Because of this also I cannot use other Hybrid functions like pattern search, because ga automatically sets it to default.
What should I try? -If ga respects linear constraints should I try something related to this? -ga is suposed to start in an infeasible zone? -if so, for the final solution to be feasible I have to increase Population and Generations? my computer can't stand such big pop and gen -is there a way of making ga start in the feasible domain?
Thanks again
Alan Weiss
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

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!