求大神帮我运行一下 我的lingo老是出现err11
MIN=@EXP(-x1*pi/@SQRT(1-x1^2));x1-1<0;
x2-10<0;
x1*x2=2;
我帮你运行了一下,发现问题了
一,我直接复制的你的代码,发现第一行的括号是中文输入法下的括号,改为英文下的括号就好使了,我用的是lingo15
结果如下(solver状态见图):
Local optimal solution found.
Objective value: 0.000000
Infeasibilities: 0.000000
Extended solver steps: 5
Best multistart solution found at step: 5
Total solver iterations: 50
Elapsed runtime seconds: 0.24
Model Class: NLP
Total variables: 3
Nonlinear variables: 3
Integer variables: 0
Total constraints: 4
Nonlinear constraints: 2
Total nonzeros: 6
Nonlinear nonzeros: 4
Variable Value Reduced Cost
X1 0.3780952 0.000000
PI 0.2635862E+10 0.000000
X2 5.289673 0.000000
Row Slack or Surplus Dual Price
1 0.000000 -1.000000
2 0.6219048 0.000000
3 4.710327 0.000000
4 0.000000 0.000000
二,我不知道你的lingo是什么版本,lingo8.0不支持函数@SQRT,LINGO9.0及以上版本均支持
平凡如我 发表于 2015-1-21 09:40 static/image/common/back.gif
我帮你运行了一下,发现问题了
一,我直接复制的你的代码,发现第一行的括号是中文输入法下的括号,改为英 ...
错了,软件将pi 当成变量了,把pi改为3.14就OK了
本帖最后由 平凡如我 于 2015-1-21 10:05 编辑
lingo中不支持Pi的表示方式应用@PI(),改为如下代码:
MIN=@EXP(-x1*@PI()/@SQRT(1-x1^2));
x1-1<0;
x2-10<0;
x1*x2=2;
运行结果:
Local optimal solution found.
Objective value: 0.000000
Infeasibilities: 0.000000
Extended solver steps: 5
Best multistart solution found at step: 2
Total solver iterations: 45
Elapsed runtime seconds: 0.19
Model Class: NLP
Total variables: 2
Nonlinear variables: 2
Integer variables: 0
Total constraints: 4
Nonlinear constraints: 2
Total nonzeros: 5
Nonlinear nonzeros: 3
Variable Value Reduced Cost
X1 0.9912417 0.000000
X2 2.017671 0.000000
Row Slack or Surplus Dual Price
1 0.000000 -1.000000
2 0.8758251E-02 0.000000
3 7.982329 0.000000
4 0.000000 0.000000
页:
[1]