How to solve linear constraint in genetic algorithm with population type of Bit string .?
Afficher commentaires plus anciens
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
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Genetic Algorithm dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!