没什么大的问题,代码略作更改就能正常运行:
Max= I-O-F-C;
I=(x1*1000+x2*800)*100+(y1*1000+y2*1600)*100+(z1*800+z2*1600)*100;
O=50*(x1*800+x2*500+y1*800+y2*1000+z1*500+z2*1000);
F=x1*60000+x2*100000+y1*60000+y2*110000+z1*80000+z2*90000;
C=12600*(x1+500/800*x2+y1+1000/800*y2+500/800*z1+1000/800*z2);
x1+x2+y1+y2+z1+z2=20;
x1+x2<=12;
y1+y2<=12;
z1+z2<=12;
运行结果为:
Global optimal solution found.
Objective value: -49800.00
Infeasibilities: 0.000000
Total solver iterations: 0
Variable Value Reduced Cost
I 2720000. 0.000000
O 920000.0 0.000000
F 1560000. 0.000000
C 289800.0 0.000000
X1 0.000000 0.000000
X2 0.000000 40275.00
Y1 8.000000 0.000000
Y2 0.000000 3150.000
Z1 0.000000 37125.00
Z2 12.00000 0.000000
Row Slack or Surplus Dual Price
1 -49800.00 1.000000
2 0.000000 1.000000
3 0.000000 -1.000000
4 0.000000 -1.000000
5 0.000000 -1.000000
6 0.000000 -12600.00
7 12.00000 0.000000
8 4.000000 0.000000
9 0.000000 16850.00