简单的线性规划,代码如下:
model:
min=X1+X2+X3+X4+X5+X6;
X1+X6>=60;
X1+X2>=70;
X2+X3>=60;
X3+X4>=50;
X4+X5>=20;
X5+X6>=30;
end
运行结果:
Global optimal solution found.
Objective value: 150.0000
Infeasibilities: 0.000000
Total solver iterations: 4
Model Class: LP
Total variables: 6
Nonlinear variables: 0
Integer variables: 0
Total constraints: 7
Nonlinear constraints: 0
Total nonzeros: 18
Nonlinear nonzeros: 0
Variable Value Reduced Cost
X1 60.00000 0.000000
X2 10.00000 0.000000
X3 50.00000 0.000000
X4 0.000000 0.000000
X5 30.00000 0.000000
X6 0.000000 0.000000
Row Slack or Surplus Dual Price
1 150.0000 -1.000000
2 0.000000 0.000000
3 0.000000 -1.000000
4 0.000000 0.000000
5 0.000000 -1.000000
6 10.00000 0.000000
7 0.000000 -1.000000
最优值150,VALUE那一列就是对应的变量的取值。