Bilinear Program should be unbounded but GUROBI says it has a finite value
回答済みWhen I run the below code (using GUROBI V11.0.3) I get that the value is finite even though it should clearly be unbounded below (take x=-n and y=n and let n -> infinity). What am I doing wrong here?
import gurobipy as gp
from gurobipy import GRB
model = gp.Model()
x = model.addVar(name="x")
y = model.addVar(name="y")
model.setObjective(x * y, GRB.MINIMIZE)
model.addConstr(x + y <= 1, name="c1")
model.optimize()
if model.status == GRB.UNBOUNDED:
print("The problem is unbounded.")
elif model.status == GRB.OPTIMAL:
print("Optimal solution found:")
print(f"x = {x.X}, y = {y.X}")
else:
print(f"Optimization was not successful, status code: {model.status}")
-
Hi Lukas,
The default lower bound on variables is 0. If you want it to be something else you need to overwrite it with the lb argument when adding your variables. To remove the lower bound altogether use -float("inf"), float("-inf") or -GRB.INFINITY.
- Riley
0 -
Great, thanks for the clarification!
0 -
Even if I add the bounds GUROBI still does not detect unboundedness (albeit it finds feasible points with very small value).
0 -
Yes I can see why this is confusing when we arrive at an answer of
x = 1.0, y = -536870912000000.0
Here the variables are below 1, but if we add upper bounds of 1 to the problem then the model is declared unbounded. I can't say whether this is a bug, or just unintended consequences arising from multiplying two unbounded continuous variables together, hence the warning message
Warning: Model contains variables with very large bounds participating
in product terms.
Presolve was not able to compute smaller bounds for these variables.
Consider bounding these variables or reformulating the model.The log, when turning off heuristics gives some clues, as the incumbents are powers of 2 multiplied by 1e6. I'd guess it has something to do with spatial branching.
Jaromił Najman is a non-linear guru, have you got any insights mate?
0 -
Proving unboundedness for nonconvex models is very challenging. The issues arise in the convex (linear) relaxation that is constructed for a given nonconvex problem. Due to unbounded variable values, the numerics of the relaxation LP are horrific. This can lead to any sort of unexpected behavior, such as determining some very big value (in absolute terms) as optimal instead of stating that a given relaxation is actually unbounded. This is one of the reasons why we strongly recommend to bound all variables participating in nonlinear terms.
0
サインインしてコメントを残してください。
コメント
5件のコメント