How to solve linear constraint in genetic algorithm with population type of Bit string .?
Ältere Kommentare anzeigen
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
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Genetic Algorithm finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!