constraint violation in GA toolbox
Show older comments
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 Comments
Matt J
on 18 Jun 2019
Please demonstrate the problem.
alaa zarif
on 18 Jun 2019
alaa zarif
on 18 Jun 2019
Answers (0)
Categories
Find more on Genetic Algorithm in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!