scipopt / scip

SCIP - Solving Constraint Integer Programs
Other
393 stars 63 forks source link

SCIP deal with the unbounded problem #103

Closed DouBiBaNi closed 1 month ago

DouBiBaNi commented 1 month ago

Hi,I doubt that SCIP solving the unbounded problem has some bugs.

When I'm solving the problem

\ SCIP STATISTICS
\   Problem name     : sub
\   Variables        : 11 (0 binary, 0 integer, 0 implicit integer, 11 continuous)
\   Constraints      : 10
Minimize
 Obj: -500 u1 +100 u2 +100 u3 +100 u4 +100 u5 +100 u6 +100 u7 +100 u8 +100 u9 +100 u10 +100 u11
Subject to
  +1 u1 +1 u2 >= +1.01
  +1 u1 +1 u3 >= +1.02
  +1 u1 +1 u4 >= +1.03
  +1 u1 +1 u5 >= +1.04
  +1 u1 +1 u6 >= +1.05
  +1 u1 +1 u7 >= +1.06
  +1 u1 +1 u8 >= +1.07
  +1 u1 +1 u9 >= +1.08
  +1 u1 +1 u10 >= +1.09
  +1 u1 +1 u11 >= +1.1
Bounds
End

I get the solution: u1 = u2 = ... = u11 = 100000, so i calculate the rays is (1, 1, 1, ..., 1). But the right rays is (1, 0, 0, ..., 0). How can i get the right answer without using SCIPenableReoptimization ?

DominikKamp commented 1 month ago

For unbounded problems SCIP will currently either provide a feasible solution or a hardly feasible solution at the infinity bound. This looks like a feasible solution, but as such it does not contain any information on the unbounded ray.

If SCIPhasPrimalRay(scip), you can access the ray values with SCIPgetPrimalRayVal(scip, var) but this is only the case if the unboundedness was not already detected in presolving. So it has to be switched off if you want to rely on it.

If you know in advance that you have an unbounded MILP and are only interested in a ray, you could also model the problem so that SCIP computes a ray directly. This works by removing integrality constraints, setting all existing variable bounds as well as constraint sides to zero, and add artificial non-zero variable bounds for the non-existing variable bounds. This way an optimal solution with negative objective value represents an unbounded direction of the LP relaxation.

Since this is already a LP, you may also want to use SoPlex directly where you can access rays more reliable.