fmincon求解, 哪里有问题?
下列是我用fmincon求解一个最佳化问题, 可是我一直跑不出来正确的解, 能否请各位高手帮我看看是哪里出了问题吗???谢谢各位了!!function = LMalfa()
global rt;
rt = ;
T = 15;
y0=zeros(2*T+2);
options=optimset('LargeScale', 'off', 'Simplex', 'on','display','iter');
y = fmincon(@MADobj,y0,[],[],[],[],[],[],@MADconstr,options);
function f=MADobj(y)
f = (y(16)+y(17)+y(18)+y(19)+y(20)+y(21)+y(22)+y(23)+y(24)+y(25)+y(26)+y(27)+y(28)+y(29)+y(30))/15;
end
function =MADconstr(y)
c(1) = y(16)-abs(y(1)-rt(1));
c(2) = y(17)-abs(y(2)-rt(2));
c(3) = y(18)-abs(y(3)-rt(3));
c(4) = y(19)-abs(y(4)-rt(4));
c(5) = y(20)-abs(y(5)-rt(5));
c(6) = y(21)-abs(y(6)-rt(6));
c(7) = y(22)-abs(y(7)-rt(7));
c(8) = y(23)-abs(y(8)-rt(8));
c(9) = y(24)-abs(y(9)-rt(9));
c(10) = y(25)-abs(y(10)-rt(10));
c(11) = y(26)-abs(y(11)-rt(11));
c(12) = y(27)-abs(y(12)-rt(12));
c(13) = y(28)-abs(y(13)-rt(13));
c(14) = y(29)-abs(y(14)-rt(14));
c(15) = y(30)-abs(y(15)-rt(15));
i =1:15;
ceq(i) = y(i)-y(31)-y(32)*i;
end
alfa = y(31);
beta = y(32);
end
[ 本帖最后由 ChaChing 于 2010-5-26 21:15 编辑 ]
页:
[1]