constraint violation in GA toolbox
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Genetic Algorithm についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!