Genetic algorithm: child out of constraints

I have set the linear inequality constraints of the GA in a way that each gene is smaller than the next one, eg x1<x2<x3...<xn but in some cases i see that this rule is not followed. Although i have read the relative documentation i am not sure if the genetic algorithm allows chromosomes out of the constraints and if so, how can i eliminate these chromosomes.

9 Comments

Are you using GUI? If not, you can write the code of that, so i can help
It is not a question of code. I asked how the genetic algorithm handles chromosomes that are out of bounds. Does it eliminate them or not. If not how can i eliminate them myself.
Are the final results outside of the constraints?
No, the final results are fine, but i need every single chromosome to be inside of the constraints.
Here in my state, you'll end up in jail if you have a child in constraints, regardless of any chromosomal/relative/genetic connection you have to the child. ;-)
I am glad that matlab does not agree with the law of your state then ;-)
@Dimitris: What version of ML are you using, how are you calling GA, the more info you can give us the better we can help.
I am using Matlab R2011b and i am calling GA inside a function.
http://www.mathworks.com/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-answers-and-get-a-fast-answer

Sign in to comment.

 Accepted Answer

If your problem is that the inequalities are not being strictly satisfied, but are being satisfied within sqrt(TolCon), then I am afraid that you are asking too much. The genetic algorithm does not satisfy linear inequalities strictly, but only within a certain numeric tolerance.
You can set a smaller value of TolCon if you like, but do not set it smaller than eps, or, in my opinion, even 100*eps.
Alan Weiss
MATLAB mathematical toolbox documentation

More Answers (0)

Community Treasure Hunt

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

Start Hunting!