I use fmincon and problems appeared when using nonlcon.
R_tek=@(dec,acc) ... S_tek= ... L_tek=@(dec,acc) ...first=@(acc) 15.2+numel(zero_slo)*acc;dec_rate=@(dec,acc) ... B _tek=@(dec,acc) (2000*1/(2*5)*dec_rate(dec,acc));B=@(dec,acc) sum(B _tek(dec,acc));L=@(dec,acc) sum(L_tek(dec,acc));S =sum(S_tek);R =@(dec,acc) sum(R_tek(dec,acc));T_tek=@(dec,acc) B_tek(dec,acc)+R_tek(dec,acc)+S_tek+L_tek(dec,acc)>=0; %T_tek must be greater than zero.
T=@(dec,acc) sum(T_tek(dec,acc));TT=@(YH) T_acc(YH(2))+T(YH(1),YH(2)); x0=[0,0]; A=[1 ,-1.066441]; b= 0.058766; Aeq=[]; beq=[]; lb=[0,0]; ub=[]; YH=fmincon(TT,x0,A,b,Aeq,beq,lb,ub)
TT should be minimized provided that T_tek>=0. When i run this code,
YH=[0.0043 0] and TT=2.7426e+03
But, for ex. for YH(1)= 0.05 and YH(2)=0
TT=2.7426e+03 (same results)
All of the TT values are same. I don't know what is origin of this problem. How can i achieve it?
And, When nonlcon is active, for YH=[0.0043 0] TT results as 2.7426e+03. If I remove nonlcon, for same YH value, TT results as. 1.5081e+04 Why are they different?
Thanks a lot.
Best Answer