| 查看: 709 | 回复: 8 | |||
| 当前主题已经存档。 | |||
jlzeng木虫 (正式写手)
|
[交流]
请帮我看一段matlab程序
|
||
|
问题: Min 10X2+10X3+40 Sub. to 1≤X1≤4 1≤X2≤4 1≤X3≤4 1≤X4≤4 -(6.9402131+0.252469*x(1)-0.276517*x(2)+0.207394*x(3)+0.314560*x(4)+0.039335*x(1)*x(1)+0.039335*x(2)*x(2)-0.003563*x(3)*x(3)-0.006647*x(4)*x(4)-0.006296*x(1)*x(2)-0.034093*x(1)*x(3)-0.059668*x(1)*x(4)+0.010462*x(2)*x(3)+0.005134*x(2)*x(4)-0.008807*x(3)*x(4))+8.62≤0 6.9402131+0.252469*x(1)-0.276517*x(2)+0.207394*x(3)+0.314560*x(4)+0.039335*x(1)*x(1)+0.039335*x(2)*x(2)-0.003563*x(3)*x(3)-0.006647*x(4)*x(4)-0.006296*x(1)*x(2)-0.034093*x(1)*x(3)-0.059668*x(1)*x(4)+0.010462*x(2)*x(3)+0.005134*x(2)*x(4)-0.008807*x(3)*x(4)-9.17≤0 0.6730551+0.301146*x(1)-0.078675*x(2)+0.011658*x(3)+0.178452*x(4)+0.009664*x(1)*x(1)+0.009664*x(2)*x(2)+0.001284*x(3)*x(3)-0.002713*x(4)*x(4)-0.012422*x(1)*x(2)-0.023157*x(1)*x(3)-0.036011*x(1)*x(4)+0.024744*x(2)*x(3)-0.020623*x(2)*x(4)-0.002149*x(3)*x(4)-1.5≤0 -(0.6730551+0.301146*x(1)-0.078675*x(2)+0.011658*x(3)+0.178452*x(4)+0.009664*x(1)*x(1)+0.009664*x(2)*x(2)+0.001284*x(3)*x(3)-0.002713*x(4)*x(4)-0.012422*x(1)*x(2)-0.023157*x(1)*x(3)-0.036011*x(1)*x(4)+0.024744*x(2)*x(3)-0.020623*x(2)*x(4)-0.002149*x(3)*x(4)) ≤0 -(51.8277931+6.142814*x(1)+1.235285*x(2)-1.799889*x(3)+4.118358*x(4)-0.434893*x(1)*x(1)-0.434893*x(2)*x(2)+0.033447*x(3)*x(3)+0.076468*x(4)*x(4)-0.201259*x(1)*x(2)-0.652022*x(1)*x(3)+0.820377*x(1)*x(4)+1.839250*x(2)*x(3)-1.451273*x(2)*x(4)-0.023900*x(3)*x(4))+95≤0 51.8277931+6.142814*x(1)+1.235285*x(2)-1.799889*x(3)+4.118358*x(4)-0.434893*x(1)*x(1)-0.434893*x(2)*x(2)+0.033447*x(3)*x(3)+0.076468*x(4)*x(4)-0.201259*x(1)*x(2)-0.652022*x(1)*x(3)+0.820377*x(1)*x(4)+1.839250*x(2)*x(3)-1.451273*x(2)*x(4)-0.023900*x(3)*x(4)-100≤0 我的程序如下: m文件 function [c,ceq]=mycon(x) c=[-(6.9402131+0.252469*x(1)-0.276517*x(2)+0.207394*x(3)+0.314560*x(4)+0.039335*x(1)*x(1)+0.039335*x(2)*x(2)-0.003563*x(3)*x(3)-0.006647*x(4)*x(4)-0.006296*x(1)*x(2)-0.034093*x(1)*x(3)-0.059668*x(1)*x(4)+0.010462*x(2)*x(3)+0.005134*x(2)*x(4)-0.008807*x(3)*x(4))+8.62; 6.9402131+0.252469*x(1)-0.276517*x(2)+0.207394*x(3)+0.314560*x(4)+0.039335*x(1)*x(1)+0.039335*x(2)*x(2)-0.003563*x(3)*x(3)-0.006647*x(4)*x(4)-0.006296*x(1)*x(2)-0.034093*x(1)*x(3)-0.059668*x(1)*x(4)+0.010462*x(2)*x(3)+0.005134*x(2)*x(4)-0.008807*x(3)*x(4)-9.17; 0.6730551+0.301146*x(1)-0.078675*x(2)+0.011658*x(3)+0.178452*x(4)+0.009664*x(1)*x(1)+0.009664*x(2)*x(2)+0.001284*x(3)*x(3)-0.002713*x(4)*x(4)-0.012422*x(1)*x(2)-0.023157*x(1)*x(3)-0.036011*x(1)*x(4)+0.024744*x(2)*x(3)-0.020623*x(2)*x(4)-0.002149*x(3)*x(4)-1.5; -(0.6730551+0.301146*x(1)-0.078675*x(2)+0.011658*x(3)+0.178452*x(4)+0.009664*x(1)*x(1)+0.009664*x(2)*x(2)+0.001284*x(3)*x(3)-0.002713*x(4)*x(4)-0.012422*x(1)*x(2)-0.023157*x(1)*x(3)-0.036011*x(1)*x(4)+0.024744*x(2)*x(3)-0.020623*x(2)*x(4)-0.002149*x(3)*x(4)); -(51.8277931+6.142814*x(1)+1.235285*x(2)-1.799889*x(3)+4.118358*x(4)-0.434893*x(1)*x(1)-0.434893*x(2)*x(2)+0.033447*x(3)*x(3)+0.076468*x(4)*x(4)-0.201259*x(1)*x(2)-0.652022*x(1)*x(3)+0.820377*x(1)*x(4)+1.839250*x(2)*x(3)-1.451273*x(2)*x(4)-0.023900*x(3)*x(4))+95; 51.8277931+6.142814*x(1)+1.235285*x(2)-1.799889*x(3)+4.118358*x(4)-0.434893*x(1)*x(1)-0.434893*x(2)*x(2)+0.033447*x(3)*x(3)+0.076468*x(4)*x(4)-0.201259*x(1)*x(2)-0.652022*x(1)*x(3)+0.820377*x(1)*x(4)+1.839250*x(2)*x(3)-1.451273*x(2)*x(4)-0.023900*x(3)*x(4)-100]; ceq=[]; 主程序: >> fun='x(1)*0+x(2)*10+10+x(3)*10+30+x(4)*0'; >> x0=[1 1 1 1]; >> A=[]; >> b=[]; >> Aeq=[]; >> beq=[]; >> lb=[1 1 1 1]; >> ub=[4 4 4 4]; >> [x,fval,exitflag,output,lambda,grad,hessian]=fmincon(fun,x0,A,b,Aeq,beq,lb,ub,@mycon) 运行结果: Warning: Large-scale (trust region) method does not currently solve this type of problem, switching to medium-scale (line search). > In fmincon at 260 Maximum number of function evaluations exceeded; increase OPTIONS.MaxFunEvals. x = 4.2343 3.1404 4.3459 4.3459 fval = 114.8638 exitflag = 0 output = iterations: 66 funcCount: 401 stepsize: 1 algorithm: 'medium-scale: SQP, Quasi-Newton, line-search' firstorderopt: 10.0000 cgiterations: [] message: [1x79 char] lambda = lower: [4x1 double] upper: [4x1 double] eqlin: [0x1 double] eqnonlin: [0x1 double] ineqlin: [0x1 double] ineqnonlin: [6x1 double] grad = 0 10.0000 10.0000 0 hessian = 0.5552 0.1233 0.0784 -0.4841 0.1233 0.0670 0.0061 -0.1023 0.0784 0.0061 0.0198 -0.0586 -0.4841 -0.1023 -0.0586 0.4462 请问是什么原因出错了?谢谢 |
» 猜你喜欢
有没有人能给点建议
已经有5人回复
假如你的研究生提出不合理要求
已经有12人回复
实验室接单子
已经有7人回复
全日制(定向)博士
已经有5人回复
萌生出自己或许不适合搞科研的想法,现在跑or等等看?
已经有4人回复
Materials Today Chemistry审稿周期
已经有4人回复
参与限项
已经有3人回复
对氯苯硼酸纯化
已经有3人回复
所感
已经有4人回复
要不要辞职读博?
已经有7人回复

cuihang
铁杆木虫 (正式写手)
VASPer
- 应助: 0 (幼儿园)
- 金币: 7507.1
- 散金: 17
- 红花: 2
- 帖子: 697
- 在线: 78.5小时
- 虫号: 447551
- 注册: 2007-11-01
- 性别: GG
- 专业: 凝聚态物性I:结构、力学和

2楼2008-03-31 10:04:31
jlzeng
木虫 (正式写手)
- 应助: 10 (幼儿园)
- 金币: 2413.7
- 散金: 5
- 红花: 4
- 帖子: 471
- 在线: 214小时
- 虫号: 427388
- 注册: 2007-07-29
- 性别: GG
- 专业: 能源化工

3楼2008-03-31 10:06:45
y1ding
铁杆木虫 (著名写手)
- 应助: 61 (初中生)
- 贵宾: 0.33
- 金币: 5959.3
- 散金: 1
- 红花: 21
- 帖子: 1884
- 在线: 491.1小时
- 虫号: 142265
- 注册: 2005-12-21
- 专业: 凝聚态物性 II :电子结构
★ ★ ★
spur(金币+3,VIP+0):感谢应助!欢迎常来!!
spur(金币+3,VIP+0):感谢应助!欢迎常来!!
|
Maximum number of function evaluations exceeded; increase OPTIONS.MaxFunEvals. ___________________________ 看英文,加大OPTIONS.MaxFunEvals Warning: Large-scale (trust region) method does not currently solve this type of problem, switching to medium-scale (line search). 提示说你选用的算法规模太大不适合这个问题,已经自动换成较小的线性搜索 exitflag = 0 这个是不成功的意思 |
4楼2008-03-31 11:04:06
y1ding
铁杆木虫 (著名写手)
- 应助: 61 (初中生)
- 贵宾: 0.33
- 金币: 5959.3
- 散金: 1
- 红花: 21
- 帖子: 1884
- 在线: 491.1小时
- 虫号: 142265
- 注册: 2005-12-21
- 专业: 凝聚态物性 II :电子结构
5楼2008-03-31 11:04:36
y1ding
铁杆木虫 (著名写手)
- 应助: 61 (初中生)
- 贵宾: 0.33
- 金币: 5959.3
- 散金: 1
- 红花: 21
- 帖子: 1884
- 在线: 491.1小时
- 虫号: 142265
- 注册: 2005-12-21
- 专业: 凝聚态物性 II :电子结构
6楼2008-03-31 11:05:22
jlzeng
木虫 (正式写手)
- 应助: 10 (幼儿园)
- 金币: 2413.7
- 散金: 5
- 红花: 4
- 帖子: 471
- 在线: 214小时
- 虫号: 427388
- 注册: 2007-07-29
- 性别: GG
- 专业: 能源化工

7楼2008-03-31 11:59:08
jlzeng
木虫 (正式写手)
- 应助: 10 (幼儿园)
- 金币: 2413.7
- 散金: 5
- 红花: 4
- 帖子: 471
- 在线: 214小时
- 虫号: 427388
- 注册: 2007-07-29
- 性别: GG
- 专业: 能源化工

8楼2008-03-31 12:26:28
jlzeng
木虫 (正式写手)
- 应助: 10 (幼儿园)
- 金币: 2413.7
- 散金: 5
- 红花: 4
- 帖子: 471
- 在线: 214小时
- 虫号: 427388
- 注册: 2007-07-29
- 性别: GG
- 专业: 能源化工

9楼2008-04-01 11:04:02












回复此楼