MATLAB: Genetic Algorithm Constraints – Nonstandard inequality constraints

genetic algorithmMATLAB

How can I pass the following constraints to the Matlab GA optimization toolbox?
Constraint 1
0.2 <= sum(x,2)/W*H <= 0.4
Constraint 2
x(1) >= x(2) >= ... x(size(x,2))
thanks in advance

Best Answer

n=length(x);
e=ones(1,n);
D=-diff(eye(n),1,1);
A=[e;-e]/W*H;
b=[0.4;-0.2];
A=[A;D];
b(size(A,1))=0;
ga(...,A,b,....,options)
Related Question