1.设每天加工x公斤A1,y公斤A2,则
model:
max=24*x+16*y;
50>x/3+y/4;!牛奶总量50桶的限制;
480>x/3*12+y/4*8;!加工时间480小时上限的限制;
100>x;!设备每天最多加工100公斤A1;
end
运行结果:
Global optimal solution found.
Objective value: 3360.000
Total solver iterations: 2
Variable Value Reduced Cost
X 60.00000 0.000000
Y 120.0000 0.000000
Row Slack or Surplus Dual Price
1 3360.000 1.000000
2 0.000000 -48.00000
3 0.000000 -2.000000
4 40.00000 0.000000
2.应作这项投资,因为这时的实际获利是3360/50>38;
假设若投资,每天最多购买z桶牛奶,很显然这时与第一份相比,仅仅多了成本而已。
代码:
model:
max=24*x+16*y-38*z;
x/3+y/4=z;
50>x/3+y/4;!牛奶总量50桶的限制;
480>x/3*12+y/4*8;!加工时间480小时上限的限制;
100>x;!设备每天最多加工100公斤A1;
end
运行结果:
Global optimal solution found.
Objective value: 1460.000
Total solver iterations: 2
Variable Value Reduced Cost
X 60.00000 0.000000
Y 120.0000 0.000000
Z 50.00000 0.000000
Row Slack or Surplus Dual Price
1 1460.000 1.000000
2 0.000000 38.00000
3 0.000000 -10.00000
4 0.000000 -2.000000
5 40.00000 0.000000
3.若用临时工人以增加劳动时间,设付给临时工人的工资最多是每小时a元。
代码:
model:
max=a;
24*x+16*y-38*z-a*t>0;
x/3+y/4=z;
50>x/3+y/4;!牛奶总量50桶的限制;
t=x/3*12+y/4*8;
480>x/3*12+y/4*8;!加工时间480小时上限的限制;
100>x;!设备每天最多加工100公斤A1;
end
运行结果:
Local optimal solution found.
Objective value: 3.250000
Extended solver steps: 5
Total solver iterations: 148
Variable Value Reduced Cost
A 3.250000 0.000000
X 0.000000 0.4166667E-02
Y 200.0000 0.000000
Z 50.00000 0.000000
T 400.0000 0.000000
Row Slack or Surplus Dual Price
1 3.250000 1.000000
2 0.000000 -0.2500000E-02
3 0.000000 0.9500000E-01
4 0.000000 0.000000
5 0.000000 -0.8125000E-02
6 80.00000 0.000000
7 100.0000 0.000000
(1)甲99公斤A1,乙42公斤A2。获利2440元
(2)44桶,需1672元,最后获利768元。
(3)未知