constraint violation in GA toolbox
Mostrar comentarios más antiguos
my code is supposed to calculate the max fundmental with a mass constraint but also having a minimum fundumental freq of 15 hz.
my variables are 0s and 1s the code runs normally however its plotting penalty vs generations instead of best fitness , when i searched i found that this is due to constraint violation. I dont know how to fix this
please note that @Fund_freq is my objective fnc
my nonlinear constraint function:
function [C,C_eq] = myConstraints(q)
c=32
N=sum(q);
Initial_Data
F=Fund_freq(q,N,c,h);
C=[F-15];
C_eq=[];
end
my linear const fnc
function [A,b] = mass_const(c,nvars)
Initial_Data;
A(1,c)=2*LX*LY*rhom;%(Multiplied by 2 for double mass)
A(1,c+1:nvars)=2*LX*LY*rhoG;
b=1.941;
end
3 comentarios
Matt J
el 18 de Jun. de 2019
Please demonstrate the problem.
alaa zarif
el 18 de Jun. de 2019
alaa zarif
el 18 de Jun. de 2019
Respuestas (0)
Categorías
Más información sobre Genetic Algorithm en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!