hi guys I have some problem
I coding some optimization one
4 variables f(x1,x2,x3,x4)
so...I was using 'fmincon'...but it doesn't work very well
here is the Question
how can I write a constraints(x) in 'fminsearch' like 'fmincon'
---------------constraints(x) form look like---------------------------
function [C, Ceq] = constraints(x)
B=1200;
N=1;
C(1)= 60-x(1) ;
C(2)= 50-x(4) ;
C(3)=-140+x(1)+x(2);
C(4)=-x(3)+x(4);
C(7)=x(3)-B*N;
C(5)=-x(2);
C(6)= x(1)*B + x(4)*x(2)*N + (x(3)-x(4))*x(2)/2*N -107000;
Ceq=[];
end
cruel life xoxo
You can't.
fminsearch
is for unconstrained problems.However, you can choose a different
fmincon
algorithm:See fmincon Algorithms. Use
optimoptions
to set the Algorithm option at the command line.