lingo求解约束条件连续变化情况下的规划问题模型如下min=0.0108*x1^2+0.0584*x2^2+0.0942*x3^2+0.0248*x1*x2+0.1108*x2*x3+0.0262*x3*x1;1.0891*x1+1.2137*x2+1.2346*x3>=1.1(从1.1变到2,步长0.01);x1+x2+x3=1;如何编程求解 要求输
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/15 12:44:19
lingo求解约束条件连续变化情况下的规划问题模型如下min=0.0108*x1^2+0.0584*x2^2+0.0942*x3^2+0.0248*x1*x2+0.1108*x2*x3+0.0262*x3*x1;1.0891*x1+1.2137*x2+1.2346*x3>=1.1(从1.1变到2,步长0.01);x1+x2+x3=1;如何编程求解 要求输
lingo求解约束条件连续变化情况下的规划问题
模型如下
min=0.0108*x1^2+0.0584*x2^2+0.0942*x3^2+0.0248*x1*x2+0.1108*x2*x3+0.0262*x3*x1;
1.0891*x1+1.2137*x2+1.2346*x3>=1.1(从1.1变到2,步长0.01);
x1+x2+x3=1;
如何编程求解 要求输出每一步的变量值x1 x2 x3
lingo求解约束条件连续变化情况下的规划问题模型如下min=0.0108*x1^2+0.0584*x2^2+0.0942*x3^2+0.0248*x1*x2+0.1108*x2*x3+0.0262*x3*x1;1.0891*x1+1.2137*x2+1.2346*x3>=1.1(从1.1变到2,步长0.01);x1+x2+x3=1;如何编程求解 要求输
运行前到lingo的options里面把output level设成nothing
submodel M:
min=0.0108*x1^2+0.0584*x2^2+0.0942*x3^2+0.0248*x1*x2+0.1108*x2*x3+0.0262*x3*x1;
1.0891*x1+1.2137*x2+1.2346*x3>=c;
x1+x2+x3=1;
endsubmodel
calc:
c=1;
@divert('D:\output.txt');
@while(c#lt#2.01:
\x05@release(x1);@release(x2);@release(x3);
\x05@write('c:',@format(c,'.2f'),@newline(1));
\x05@solve(M);
\x05@ifc(@status()#eq#0:
\x05\x05@write('x:',@format(x1,'.4f'),' ',@format(x2,'.4f'),' ',@format(x3,'.4f'),@newline(2));
\x05\x05@else
\x05\x05\x05@write('No optimal solution',@newline(2));
\x05);\x05
\x05c=c+0.01;
);
@divert();
endcalc