Hello, Iman. If x(1)=1, the x(3), x(4), x(6), x(7) values do not affect the objective values. These design variables can be ignored when you process the optimzation results. The optimization progress is not affected except for the efficiency. You may need more optimzation generations to get a good result.
The original code could not get the correct Pareto-front because the crossover and mutation strategies I used do not fit for the ZDT problem. In original code, all variables of an individual would mutate if it was selected to be mutated. In the version 1.3 code, I change the strategies to mutate several variables instead, and the correct solution could be get now.
Great work, thanks a lot for sharing!
In the first few generations, some individuals of the population have violated constraints. I was expecting to find the actual contraints variables in results.pops.cons, but there were all zero. I only found the *number* of violations in results.pops.nViol.
I was able to improve this by adding one line in evaluate.m:
% Save the objective values and constraint violations
indi.obj = y; % <<<< ADDED LINE >>>
if( ~isempty(indi.cons) )
indi.cons = cons;
idx = find( cons );