lingo错误代码29怎么解决?
答案:1 悬赏:50 手机版
解决时间 2021-04-02 01:20
- 提问者网友:爱了却不能说
- 2021-04-01 01:06
lingo错误代码29怎么解决?
最佳答案
- 五星知识达人网友:执傲
- 2021-04-01 01:22
你在DATA中输入的X变量是不是写错了,应该写成A才对。
在你的第二段代码的基础上,把DATA中的X改成A后,可以运行:
sets:
nodes/1..3/:p;
roads(nodes,nodes):A;
endsets
data:
A= 1 0 1
0 1 1
1 1 0;
enddata
min=@sum(nodes:p);
@for(nodes(i):@bin(p));
@for(roads(i,j) | i#gt#j#and#A(i,j)#eq#1:p(i)+p(j)>=1);
end
end
结果是:
Global optimal solution found.
Objective value: 1.000000
Objective bound: 1.000000
Infeasibilities: 0.000000
Extended solver steps: 0
Total solver iterations: 0
Model Class: PILP
Total variables: 3
Nonlinear variables: 0
Integer variables: 3
Total constraints: 3
Nonlinear constraints: 0
Total nonzeros: 7
Nonlinear nonzeros: 0
Variable Value Reduced Cost
P( 1) 0.000000 1.000000
P( 2) 0.000000 1.000000
P( 3) 1.000000 1.000000
A( 1, 1) 1.000000 0.000000
A( 1, 2) 0.000000 0.000000
A( 1, 3) 1.000000 0.000000
A( 2, 1) 0.000000 0.000000
A( 2, 2) 1.000000 0.000000
A( 2, 3) 1.000000 0.000000
A( 3, 1) 1.000000 0.000000
A( 3, 2) 1.000000 0.000000
A( 3, 3) 0.000000 0.000000
Row Slack or Surplus Dual Price
1 1.000000 -1.000000
2 0.000000 0.000000
3 0.000000 0.000000
在你的第二段代码的基础上,把DATA中的X改成A后,可以运行:
sets:
nodes/1..3/:p;
roads(nodes,nodes):A;
endsets
data:
A= 1 0 1
0 1 1
1 1 0;
enddata
min=@sum(nodes:p);
@for(nodes(i):@bin(p));
@for(roads(i,j) | i#gt#j#and#A(i,j)#eq#1:p(i)+p(j)>=1);
end
end
结果是:
Global optimal solution found.
Objective value: 1.000000
Objective bound: 1.000000
Infeasibilities: 0.000000
Extended solver steps: 0
Total solver iterations: 0
Model Class: PILP
Total variables: 3
Nonlinear variables: 0
Integer variables: 3
Total constraints: 3
Nonlinear constraints: 0
Total nonzeros: 7
Nonlinear nonzeros: 0
Variable Value Reduced Cost
P( 1) 0.000000 1.000000
P( 2) 0.000000 1.000000
P( 3) 1.000000 1.000000
A( 1, 1) 1.000000 0.000000
A( 1, 2) 0.000000 0.000000
A( 1, 3) 1.000000 0.000000
A( 2, 1) 0.000000 0.000000
A( 2, 2) 1.000000 0.000000
A( 2, 3) 1.000000 0.000000
A( 3, 1) 1.000000 0.000000
A( 3, 2) 1.000000 0.000000
A( 3, 3) 0.000000 0.000000
Row Slack or Surplus Dual Price
1 1.000000 -1.000000
2 0.000000 0.000000
3 0.000000 0.000000
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯