分段线性函数:
cost = 0.02 x if 0 <= x <= 500
0.03 x if 500 <= x <= 1500
0.04 x if 1500<= x <= 10000
SOS2 解决方案:
x[a, b, c, d, e] = (x1[a, b, c, d, e] * 0) +
(x2[a, b, c, d, e] * 500) +
(x3[a, b, c, d, e] * 1500) +
(x4[a, b, c, d, e] * 10000)
cost[a, b, c, d, e] = (x1[a, b, c, d, e] * 0 * 0 )+
(x2[a, b, c, d, e] * 500 * 0.02)+
(x3[a, b, c, d, e] * 1500 * 0.03)+
(x4[a, b, c, d, e] * 10000 * 0.04)
x1[a, b, c, d, e] + x2[a, b, c, d, e] + x3[a, b, c, d, e] + x4[a, b, c, d, e]>= 0
x1[a, b, c, d, e] <= y1[a, b, c, d, e]
x2[a, b, c, d, e] <= y1[a, b, c, d, e] + y2[a, b, c, d, e]
x3[a, b, c, d, e] <= y2[a, b, c, d, e] + y3[a, b, c, d, e]
x4[a, b, c, d, e] <= y3[a, b, c, d, e]
y1[a, b, c, d, e] + y2[a, b, c, d, e] + y3[a, b, c, d, e] = 1
我已经这样做了。但是,求解器仍然显示不可行的解决方案。你能看出这个公式有什么问题吗?!