Documentation mismatch for range constraints
回答済みAccording to the documentation, adding a range constraint for L ≤ f(x) ≤ U produces an equation f(x) - s = L for a new continuous nonnegative slack variable s ≤ U-L. However, the following Python code
from gurobipy import *
m = Model("")
x = m.addVar()
y = m.addVar()
m.update()
m.addRange(x + y, 5, 20)
m.write('debug.lp')yields the following debug.lp file contents:
\ LP format - for model browsing. Use MPS format to capture full model detail.
Minimize
Subject To
R0: C0 + C1 + RgR0 = 20
Bounds
RgR0 <= 15
EndSo it apparently adds the equation f(x) + s = U. The same problem arises using the C API.
-
Hi Matthias,
Thank you for reporting this.
Both are correct implementations, and the value from one slack variable can be derived from another using the equation
s_1 + s_2 = U - L
I'm not sure if there are circumstances where sometimes one implementation is used, and in other circumstances the other is used, but I'll check and propose a change to the documentation.
It's likely that at some point we made a simple change between the implementations and assumed it was an internal detail that wasn't publicly documented.
Thanks,
Riley0
サインインしてコメントを残してください。
コメント
1件のコメント