Genetic algorithm and linear constraints

5 views (last 30 days)
PJ on 18 Apr 2013
Commented: Akshay Jain on 31 Jan 2017
I'm running a genetic algorithm with linear constraints:
options=gaoptimset('PopulationSize',50,'Generations',10,'InitialPopulation',para0,'Display','iter','PlotFcns',@gaplotbestf,'UseParallel', 'always');
It turns out, however, that these constraints are ignored (at least for individuals), which leads to errors in my objective function.
I do not see why, as far as I know the linear constraints should be considered by the optimization for each individual.

Answers (1)

Alan Weiss
Alan Weiss on 18 Apr 2013
GA is a strictly feasible solver with respect to bounds and linear constraints. This means that, assuming the initial population is feasible with respect to these constraints, then all future individuals are feasible as well.
Therefore, I conclude that your initial population, para0, is not feasible with respect to bounds or linear constraints.
To test this conclusion, run your optimization again without giving an initial population. But I do suggest that you give an initial population range.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
Akshay Jain
Akshay Jain on 31 Jan 2017
I am using mutationadaptfeasible, but still some of the population individuals are not following the linear inequalities. My chromosome size is 4 and I want x1<=x2 and x3<=x4, so my A and b are [1 -1 0 0; 0 0 1 -1] and [0;0]
Currently I am using an if condition to reject such individuals, but it would be nice if I don't have to. Any ideas what might be wrong ?

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!