ds4dm / ecole

Extensible Combinatorial Optimization Learning Environments
https://www.ecole.ai
BSD 3-Clause "New" or "Revised" License
321 stars 68 forks source link

SetCoverGenerator keeps generating infeasible instances. #311

Closed yuandong-tian closed 2 years ago

yuandong-tian commented 2 years ago

Minimal program:

from pyscipopt import Model
import ecole

generator = ecole.instance.SetCoverGenerator(n_rows=500, n_cols=1000, density=0.05)
m = next(generator)
model = m.as_pyscipopt()
print("Infinity value: ", model.infinity())
print("SCIP version: ", model.version())
print("Ecole version: ", ecole.__version__)

model.presolve()
print(model.getStatus())
model.optimize()
print(model.getStatus())
print(model.getPrimalbound(), model.getDualbound())

In Ecole 0.8 + pyscipopt 4.0 + SCIP 8.0, it gives

Infinity value:  1e+20
SCIP version:  8.0
Ecole version:  0.8.0
infeasible
infeasible
1e+20 1e+20

In Ecole 0.7.3 + SCIP 7.0.3 + pyscipopt 3.2.2, it gives

Infinity value:  1e+20
SCIP version:  7.02
Ecole version:  0.7.3
unknown
optimal
124.0 124.0

Saving to .cip shows that there is a weird constraint in the generated program specification.

  [linear] <c_490>: 1 <= <x_3>[B] +<x_24>[B] +<x_35>[B] +<x_37>[B] +<x_39>[B] +<x_40>[B] +<x_42>[B] +<x_87>[B] +<x_98>[B] +<x_105>[B] +<x_123>[B] +<x_127>[B] +<x_143>[B] +<x_236>[B] +<x_255>[B] +<x_297>[B] +<x_303>[B] +<x_311>[B] +<x_315>[B] +<x_316>[B] +<x_335>[B] +<x_400>[B] +<x_410>[B] +<x_419>[B] +<x_435>[B] +<x_452>[B] +<x_460>[B] +<x_489>[B] +<x_496>[B] +<x_629>[B] +<x_639>[B] +<x_667>[B] +<x_684>[B] +<x_716>[B] +<x_728>[B] +<x_730>[B] +<x_734>[B] +<x_798>[B] +<x_838>[B] +<x_860>[B] +<x_889>[B] +<x_907>[B] +<x_930>[B] +<x_941>[B] +<x_954>[B] <= 2.12199579145934e-314;

Maybe SCIP Infinity is converted to 2.12199579145934e-314 (or a memory overflow error).

AntoinePrv commented 2 years ago

Hi @yuandong-tian,

We did make a change in the SetCoverGenrator in version 0.8.0 in #301, but it should only change the objective, not the constraints. It would be worth testing this with Ecole 0.8.0 and Scip 7

Can you reproduce you example with a fixed seed (.i.e making it deterministic for us).

yuandong-tian commented 2 years ago

Thanks @AntoinePrv for answering. It doesn't seem to be related to random seed. So any seed should just have the same issues. Also how to install Ecole 0.8.0 with SCIP 7?

AntoinePrv commented 2 years ago

@yuandong-tian, using Ecole 0.8 + pyscipopt 4.0 + SCIP 8.0, and running your example about ten times, I only got feasible instances (reading optimal).

gasse commented 2 years ago

Hi all,

@yuandong-tian I don't think you can install Ecole 0.8 with SCIP 7. I think @AntoinePrv meant SCIP 8.

I've tried also your minimal program on my side with both Ecole 0.7.3 and Ecole 0.8.0, I can't reproduce the issue. Given the weird numerical value you get in the constraint, my bet would be for a numerical rounding that occurred somewhere during the instance generation process. That's annoying, but since we can't reproduce it's hard to look into it. @yuandong-tian could you give us additional info about the machine you ran the code on ? Maybe also the python version, the version of the numpy library etc. ? If you're using conda, a conda list should give you that.

Best, Maxime