How can I add multiple constraints to multiple variables for a GA optimization?
6 views (last 30 days)
Show older comments
Hi, I am having difficulty implementing constraints into my genetic algorithm optimization model. I am able to impose the necessary boundaries but am unable to determine how to impose multiple constraints on each variable. All documentation I have found has very simplified constraints and only have one constraint per variable. To give an idea of the problem at hand, it can be simplified by having a square divided into 9 'tiles'. The position of a single 'o' on each tile is optimized and can lie anywhere on each tile, however it must maintain a given distance 'd' from any other 'o' [d < tile dimensions]. Each 'o' has an x and y coordinate so that [sqrt((x(1)-x(2))^2 + (y(1)-y(2))^2) > d] for each 'o' in a neighboring tile. Therefor for the central tile there are 8 constraints (8 neighbors) like this that must be imposed. How can I implement these constraints into my GA so that I can meet these requirements?
Thanks in advance!
0 Comments
Accepted Answer
Alan Weiss
on 19 Jul 2018
Edited: Alan Weiss
on 19 Jul 2018
The documentation for writing nonlinear constraints shows an example with two nonlinear constraints. As does this example. You can, of course, have any number.
This example has ten nonlinear inequality constraints, but it might be hard to parse, as it is mainly showing how to include symbolic objective, constraints, and gradients and Hessians.
Alan Weiss
MATLAB mathematical toolbox documentation
More Answers (0)
See Also
Categories
Find more on Genetic Algorithm in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!