I'm running a genetic algorithm with linear constraints:
options=gaoptimset('PopulationSize',50,'Generations',10,'InitialPopulation',para0,'Display','iter','PlotFcns',@gaplotbestf,'UseParallel', 'always'); [x,fval,exitflag,output]=ga(@(para)foptim5(N,f,para),6,[0,-1,0,0,1,1;0,-1,0,1,0,0;-1,0,1,0,0,0;0,0,-1,0,0,0;0,0,0,-1,0,0],[-b;-2*b;-2*b;-b;-b],,,[W_l,H_l,w_l,h_l,P_l,L_l],[W_u,H_u,w_u,h_u,P_u,L_u],,options)
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.
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.
MATLAB mathematical toolbox documentation
Play games and win prizes!Learn more