语法问题,略作修改即能运行:
sets:
var/1..10/:x;
endsets
min=14*x(1)+6*x(2)+3*x(3)+2*x(4)+10*x(5)+5*x(6)+7*x(7)+4*x(8)+3*x(9)+2*x(10);
50*x(1)+60*x(2)+20*x(3)+10*x(4)+200*x(5)+180*x(6)+240*x(7)+360*x(8)+150*x(9)+30*x(10)>=55;
1000*x(1)+800*x(2)+900*x(3)+200*x(4)+1600*x(5)+130*x(6)+320*x(7)+360*x(8)+200*x(9)+240*x(10)>=3000;
400*x(1)+200*x(2)+300*x(3)+500*x(4)+100*x(5)+700*x(6)+600*x(7)+1700*x(8)+500*x(9)+1020*x(10)>=800;
440*x(1)+500*x(2)+10*x(3)+100*x(4)+480*x(5)+300*x(6)+220*x(7)+370*x(8)+20*x(9)+4000*x(10)>=750;
4*x(1)+20*x(2)+5*x(3)+19*x(4)+7*x(5)+8*x(6)+110*x(7)+190*x(8)+6*x(9)+17*x(10)>=200;
14*x(1)+6*x(2)+10*x(5)+5*x(6)<5;
3*x(3)+2*x(4)+7*x(7)+4*x(8)+3*x(9)+2*x(10)>10;
x(3)<1;
x(4)<2;
x(10)<2;
x(1)>0;x(2)>0;x(3)>0;x(4)>0;x(5)>0;x(6)>0;x(7)>0;x(8)>0;x(9)>0;x(10)>0;
end
运行结果如下:
Global optimal solution found.
Objective value: 20.66667
Infeasibilities: 0.000000
Total solver iterations: 5
Elapsed runtime seconds: 0.04
Model Class: LP
Total variables: 10
Nonlinear variables: 0
Integer variables: 0
Total constraints: 21
Nonlinear constraints: 0
Total nonzeros: 83
Nonlinear nonzeros: 0
Variable Value Reduced Cost
X( 1) 0.000000 13.77778
X( 2) 0.000000 1.777778
X( 3) 1.000000 0.000000
X( 4) 2.000000 0.000000
X( 5) 0.5000000 0.000000
X( 6) 0.000000 7.444444
X( 7) 0.000000 3.444444
X( 8) 1.166667 0.000000
X( 9) 0.000000 0.7777778
X( 10) 2.000000 0.000000
Row Slack or Surplus Dual Price
1 20.66667 -1.000000
2 565.0000 0.000000
3 0.000000 -0.1111111E-01
4 4573.333 0.000000
5 8131.667 0.000000
6 102.1667 0.000000
7 0.000000 0.7777778
8 5.666667 0.000000
9 0.000000 7.000000
10 0.000000 0.2222222
11 0.000000 0.6666667
12 0.000000 0.000000
13 0.000000 0.000000
14 1.000000 0.000000
15 2.000000 0.000000
16 0.5000000 0.000000
17 0.000000 0.000000
18 0.000000 0.000000
19 1.166667 0.000000
20 0.000000 0.000000
21 2.000000 0.000000