How to solve linear constraint in genetic algorithm with population type of Bit string .?
Show older comments
I am trying to solve binary optimisation problem in matlab R2016a , where i am giving popultion type as 'Bitstring' Problem is when i am giving linear constraint (sum(x)=20), it is ignoring it. How to fix this ?
}
if
{opts = gaoptimset('PopulationSize',300,'InitialPopulation',mypop,..
'PopulationType', 'bitstring','SelectionFcn',{@selectiontournament,tournamentSize},...
'MutationFcn',{@mutationuniform, 0.1},'CrossoverFcn', {@crossoverarithmetic,0.8},...
'EliteCount',2,'StallGenLimit',50,'PlotFcns',{@gaplotbestf},'Display', 'iter');
num=100;
Aeq=[ones(1,num);-ones(1,num)];Beq=[20;-20];
[X_opt,feval,exitflag,output]=ga(@(z)myfunc4_full_2(z,phi_100),num,Aineq,Bineq,[],[],[],[],[],[],opts);
end
Accepted Answer
More Answers (0)
Categories
Find more on Genetic Algorithm in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!