选课策略LINGO
![选课策略LINGO](https://img.360docs.net/imge7/1r0w0e67pf15b11750cwb8l1p19zomqz-71.webp)
![选课策略LINGO](https://img.360docs.net/imge7/1r0w0e67pf15b11750cwb8l1p19zomqz-52.webp)
选课策略
max z=5x 1+4x 2+4x 3+3x 4+4x 5+3x 6+2x 7+2x 8+3x 9;
123452x x x x x ++++≥
356893x x x x x ++++≥
46792x x x x +++≥ 32120x x x --≤ 740x x -≥ 52120x x x --≤
760x x -≥
580x x -≥
92120x x x --≤
916i i x
==∑;
LINGO 出程序:
model :
max =5*x1+4*x2+4*x3+3*x4+4*x5+3*x6+2*x7+2*x8+3*x9; x1+x2+x3+x4+x5>=2;
x3+x5+x6+x8+x9>=3;
x4+x6+x7+x9>=2;
2*x3-x1-x2<=0;
x4-x7<=0;
2*x5-x1-x2<=0;
x6-x7<=0;
x8-x5<=0;
2*x9-x1-x2<=0;
x1+x2+x3+x4+x5+x6+x7+x8+x9=6;
@bin (x1);@bin (x2);@bin (x3);@bin (x4);@bin (x5);@bin (x6); @bin (x7);@bin (x8);@bin (x9);
@gin(x1);@gin(x2);@gin(x3);@gin(x4);@gin(x5);@gin(x6);
@gin(x7);@gin(x8);@gin(x9);
end
运行结果
Global optimal solution found.
Objective value: 22.00000
Objective bound: 22.00000
Infeasibilities: 0.000000
Extended solver steps: 0
Total solver iterations: 0
Model Class: PILP
Total variables: 9
Nonlinear variables: 0
Integer variables: 9
Total constraints: 11
Nonlinear constraints: 0
Total nonzeros: 47
Nonlinear nonzeros: 0
Variable Value Reduced Cost X1 1.000000 -5.000000 X2 1.000000 -4.000000 X3 1.000000 -4.000000 X4 0.000000 -3.000000 X5 1.000000 -4.000000 X6 0.000000 -3.000000 X7 1.000000 -2.000000 X8 0.000000 -2.000000 X9 1.000000 -3.000000 Row Slack or Surplus Dual Price
1 22.00000 1.000000
2 2.000000 0.000000
3 0.000000 0.000000
4 0.000000 0.000000
5 0.000000 0.000000
6 1.000000 0.000000
7 0.000000 0.000000
8 1.000000 0.000000
9 1.000000 0.000000
10 0.000000 0.000000
11 0.000000 0.000000