我是 lp_solve 的新手。我想把这两个计算结合起来,(因为原材料是一样的……)
第一次生产:
min: 13.21 x0 + 27.46 x1 + 35.66 x2 + 89.21 x3 + 60.69 x4;
x0 + x1 + x2 + x3 + x4 >= 200000;
x0 <= 69148;
x1 <= 25460;
x2 <= 34020;
x3 <= 69873;
x4 <= 737299;
-0.425 x0 + 0.086 x3 + -0.003 x4 >= 0;
/* 0.175*x0 + 0.60*x1 + 0.60*x2 + 0.686*x3 + 0.59745*x4 >= (x0 + x1 + x2 + x3 + x4)*0.6 */
第二次生产:
min: 13.21 y0 + 27.46 y1 + 35.66 y2 + 89.21 y3 + 60.69 y4;
y0 + y1 + y2 + y3 + y4 >= 50000;
y0 <= 69148;
y1 <= 25460;
y2 <= 34020;
y3 <= 69873;
y4 <= 737299;
-0.275 y0 + 0.15 y1 + 0.15 y2 + 0.236 y3 + 0.14745 y4 >= 0;
/* 0.175*y0 + 0.60*y1 + 0.60*y2 + 0.686*y3 + 0.59745*y4 >= (y0 + y1 + y2 + y3 + y4)*0.45 */
我的解决方案:
min: 13.21 x0 - 13.21 y0
+ 27.46 x1 - 27.46 y1
+ 35.66 x2 - 35.66 y2
+ 89.21 x3 - 89.21 y3
+ 60.69 x4 - 60.69 y4;
x0 + x1 + x2 + x3 + x4 >= 200000;
y0 + y1 + y2 + y3 + y4 >= 50000;
x0 + y0 <= 69148;
x1 + y1 <= 25460;
x2 + y2 <= 34020;
x3 + y3 <= 69873;
x4 + y4<= 737299;
-0.425 x0 + 0.086 x3 + -0.003 x4 >= 0;
-0.275 y0 + 0.15 y1 + 0.15 y2 + 0.236 y3 + 0.14745 y4 >= 0;
返回一个奇怪的结果:
x0 0
y0 69148
x1 25460
y1 0
x2 34020
y2 0
x3 4736.62921348315
y3 65136.3707865169
x4 135783.370786517
y4 601515.629213483
当我将 x 和 y 相加时:
x = 200,000 (okay)
y = 735,800 (not 50,000!)
所以我使用整个库存...而不是 250.000...