Genetic Algorithm 'bitstring' not accepting constrains
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
i use the following code to generate binary values using genetic algorith:
options = optimoptions(@ga, 'PopulationType', 'bitstring', 'Generations', 100, 'Display', 'iter', 'StallGenLimit', 10);
[x, fval, exitflag, output] = ga(SAIDI, n1, [], [], [], [], lb, ub, @nonlcon, options);
but i get a waring that : 'bitstring' ignore all constrain,
i want only 20 values of x to be 1 and the rest is 0 , i tried this constrain but it failed
function [c, ceq] = nonlcon(x)
c = [];
ceq = sum(x) - 20;
end
is there is way to achive my constrain without changing my fitness function ?
0 comentarios
Respuestas (1)
Ver también
Categorías
Más información sobre Genetic Algorithm en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!