heyuan112 发表于 2007-6-16 23:50

优化问题出错

我在做一个优化的问题,运行的时候显示
Warning: Large-scale (trust region) method does not currently solve this type of problem,
switching to medium-scale (line search).
> In C:\MATLAB6p5p1\toolbox\optim\fmincon.m at line 213
??? Error using ==> fmincon
FMINCON cannot continue because user supplied objective function
failed with the following error:

Error using ==> ^
Function '^' is not defined for values of class 'cell'.
请问这是什么意思,怎么解决,请给予指点!谢谢!


========================
请勿重复发贴。
By xjzuo
========================

[ 本帖最后由 eight 于 2007-6-17 10:05 编辑 ]

xjzuo 发表于 2007-6-17 08:53

问题最好贴一下.------前一个问题常见, 后一个很明显说'^'不适用于'cell'数组。

[ 本帖最后由 xjzuo 于 2007-6-17 08:55 编辑 ]

heyuan112 发表于 2007-6-17 09:09

function f=myfun(x)
f=*(*x(1)*1.3*1.142+1.142*x(2)*0.86*10^3)*0.10608+1.95*2600*3600*x(1)*{35169.12*}^(-1)+1.95*1050*0.11066*x(4)+1.95*900*0.0806*x(5)+*10^4+*2600+0.9226*x(3)*2600-0.258*2220*1050-0.256*2590*900-0.9226*x(1)*2600;

有点乱,我都写成一个式子了,您看看是什么问题,我也不大懂,急着用,谢谢了

xjzuo 发表于 2007-6-17 09:19

请将问题及你的处理完整贴一下,否则我怎么知道你的问题在哪里呢?

heyuan112 发表于 2007-6-17 09:24

在命令窗口中运行的是:
x0=;
Aeq=;
beq=;
lb=;
ub=;
=fmincon('myfun',x0,[],[],Aeq,beq,lb,ub)

运行后就显示前述的错误

xjzuo 发表于 2007-6-17 09:35

将[] , {}, 都改成()即可.
Warning: Large-scale...可以不必理会,是正常的转换.
结果基本合理,变个初值也稳定---但我没有用1stOpt检验.

heyuan112 发表于 2007-6-17 09:40

好了,谢谢指教,有什么问题再向您请教!
页: [1]
查看完整版本: 优化问题出错