MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   [MATLAB工具箱] 跪求各位大侠帮我看看这个优化问题! (https://www.labfans.com/bbs/showthread.php?t=13701)

fujinzhi 2011-07-18 11:36

跪求各位大侠帮我看看这个优化问题!
 
:confused:funf='f=exp(x(1)*(4*x(1)^2+2*x(2)^2+4*x(1)*x(2)+2*x(2)+1);';
fung='g=[1.5+x(1)*x(2)-x(1)-x(2);-x(1)*x(2)-10];';
fun=[funf fung];
x0=[-1 1];
options=[];
vlb=zeros(1,2);
vub=[];
[x,options]=fmincon(fun,x0,options,vlb,vub);
[COLOR="red"]??? Error using ==> fmincon at 215
FMINCON is for constrained problems. Use FMINUNC for unconstrained problems.[/COLOR]
这是我按照教材上照做的一个例子,但是出现了下面的错误提示。
我现在要做的一个问题跟这个很像,所以这个解决不好,后面就没法进行了。(例子如下)
>> funf='f=-1+(1/6*((0.8-exp(-(x(1)-26.8)/(x(4)+25.4))^2))^2+(0.6-exp(-((x(2)-26.8)/(x(5)+25.4))^2))^2+(0.1-exp(-((x(3)-26.8)/(x(6)+25.4))^2))^2+(0.8-exp(-((x(2)-x(1))/(x(4)+x(5)))^2))^2+(0.6-exp(-((x(3)-x(1))/(x(4)+x(6)))^2))^2+(0.8-exp(-((x(3)-x(2))/(x(5)+x(6)))^2))^2))^1/2;';
>> fung='g=[26.8-x(1);x(1)-x(2);x(2)-x(3);]';
>> fun=[funf fung];
>> x0=[-3 -2 -1 1 2 3];
>> options=[];
>> vlb=zeros(4,5,6);
>> vub=[];
>> x=fmincon(fun,x0,options,vlb,vub);
[COLOR="Red"]??? Error using ==> fmincon at 215
FMINCON is for constrained problems. Use FMINUNC for unconstrained problems.[/COLOR]感激各位高手的帮忙,感激涕零啊!
原本的题目如下:
求max =1-(1/6*((0.8-exp(-(x(1)-26.8)/(x(4)+25.4))^2))^2+(0.6-exp(-((x(2)-26.8)/(x(5)+25.4))^2))^2+(0.1-exp(-((x(3)-26.8)/(x(6)+25.4))^2))^2+(0.8-exp(-((x(2)-x(1))/(x(4)+x(5)))^2))^2+(0.6-exp(-((x(3)-x(1))/(x(4)+x(6)))^2))^2+(0.8-exp(-((x(3)-x(2))/(x(5)+x(6)))^2))^2))^1/2;
[COLOR="red"]s.t. 26.8≤x(1)≤x(2)≤x(3)
x(4),x(5),x(6)≥0[/COLOR]各位给指点下问题出在哪里了,就这个问题应该如何求解!

anbcjys 2011-07-19 07:34

回复: 跪求各位大侠帮我看看这个优化问题!
 
约束放到约束函数里面


所有时间均为北京时间。现在的时间是 12:50

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.