具有最小和最大固定成本的线性编程

时间:2017-04-05 12:27:32

标签: linear-programming constraint-programming minmax maximization mixed-integer-programming

我在以下优化问题中需要您的帮助。 我有一个最大化混合整数线性规划问题。 我想考虑最低和最低最高固定费用。

我已经这样做了..

cost = max(minimum fixed cost , cost rate * x)
cost >= minimum fixed cost
cost >= cost rate * x
cost = min(maximum fixed cost , cost rate * x)
cost <= maximum fixed cost
cost <= cost rate * x

但是,这变成了不可行的解决方案。 你能不能帮助我优化这个问题。

2 个答案:

答案 0 :(得分:2)

分段线性函数

我认为你的意思如下:

A = minimum fixed cost / cost rate
B = maximum fixed cost / cost rate

然后你想模拟分段线性函数:

cost = minimum fixed cost   if x < A
       cost rate * x        if A <= x <= B 
       maximum fixed cost   if x > B

enter image description here

在MIP模型中使用分段线性函数不是问题。您可以通过不同的方法来实现这一目标:

  • 使用额外的二元变量(见(1))
  • 使用SOS2变量(见(1))
  • 像AMPL和Gurobi这样的系统具有表达分段线性函数的特殊功能。

实施例制剂

具有SOS2变量的公式如下:

引入数据点px和py

  px     py
  --------------------------
  0      minimum fixed cost
  A      minimum fixed cost
  B      maximum fixed cost
  C      maximum fixed cost

我们假设0<=x<=C。即C是x的上限。

然后做:

  set p = {1,2,3,4}
  sos2 variables lambda(p)
  sum(p, lambda(p)) = 1
  x = sum(p, lambda(p)*px(p))
  cost = sum(p, lambda(p)*py(p)) 

参见例如(2)

您的方法有什么问题

请注意,您的方法(显示在问题中)不正确:

cost >= minimum fixed cost
cost >= cost rate * x
cost <= maximum fixed cost
cost <= cost rate * x

真的是

minimum fixed cost <= cost <= maximum fixed cost
cost = cost rate * x

x限制为A <= x <= B

参考

(1)H.Paul Williams,“数学规划中的模型构建”,Wiley

(2)GAMS: Piecewise linear functions with SOS2 variables

答案 1 :(得分:1)

分段线性函数:

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

我已经用这种方式完成了它。但是,解算器仍然显示不可行的解决方案。你能在这个表述中看到错误吗?!

相关问题