constraint violation in GA toolbox

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

Please demonstrate the problem.
the problem is i need a maximum fundumental freq of a plate
the variables are referriing to thickness of the plate
this plate mass shouldnt exceed 1.941 kg and the fund freq cant be lower than 15 hz
is it clearer now?
the plate is assumed to be made of several layers of equal thickness and the code assumes their absence or existence by 0s and 1s

Sign in to comment.

Answers (0)

Asked:

on 18 Jun 2019

Commented:

on 18 Jun 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!