Exact tightened bounds in SCIP presolve?

21 Views Asked by At

In my current project, I want to make use of SCIP/PySCIPOpt to tighten the bounds of my system's variables given a number of constraints. However, it seems that the variable bounds after pre-computing are too tight. I have provided a minimal example below. Do you have a recommendation on how to obtain the correct result?

Example: My minimal test case involves three variables -5 <= x,y,z <= 5, as well as two equality constraints x + y = 5 and y + z = 5. These original bounds are deliberately too broad. Given the constraints, the tightened bounds should be 0 <= x,y,z <= 5, since any values below zero would violate one of the two equality constraints.

Problem: If I define that problem in PySCIPOpt, the bounds I obtain after the presolve step are collapsed. In the example below, SCIP returns variable bounds of x = 0, y = 5, and z = 0, which is not the correct result. Adding a maximization/minimization objective gives different (but still collapsed) bounds. Clearly, this is not what I want.

Question: Do you know what is happening here? Is there a way to retrieve the correct result 0 <= x,y,z <= 5 from SCIP?

from pyscipopt import Model

# Create a model
model = Model("minimal_example")  # model name is optional

# Add three variables bounded between -5 and 5
x = model.addVar("x", lb = -5, ub = 5)
y = model.addVar("y", lb = -5, ub = 5)
z = model.addVar("z", lb = -5, ub = 5)

# Add two constraints
model.addCons(x + y == 5)
model.addCons(y + z == 5)

# Setting an objective changes the bounds found during presolve; uncomment the line below to try
# model.setObjective(y)

model.presolve()

# Print the results
print("Tightened bounds after SCIP presolve:")
print("Bounds on x are: "+str(x.getLbLocal())+" <= x <= "+str(x.getUbLocal()))
print("Bounds on y are: "+str(y.getLbLocal())+" <= y <= "+str(y.getUbLocal()))
print("Bounds on z are: "+str(z.getLbLocal())+" <= z <= "+str(z.getUbLocal()))
0

There are 0 best solutions below