You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to generate some random problems involving Inverse constraints and found OR-tools crashing on some of the instances.
Below, is a minimal example in Python:
fromortools.sat.pythonimportcp_modelasortmodel=ort.CpModel()
solver=ort.CpSolver()
x= [model.NewIntVar(0,1,name=f"x_{i}") foriinrange(4)]
rev1= [model.NewIntVar(0,1,name=f"rev1_{i}") foriinrange(2)]
rev2= [model.NewIntVar(0, 1, name=f"rev2_{i}") foriinrange(2)]
rev3= [model.NewIntVar(0, 1, name=f"rev3_{i}") foriinrange(2)]
model.AddInverse([x[0], x[3]], rev1)
model.AddInverse([x[0], x[1]], rev2)
model.AddInverse([x[2], x[0]], rev3)
# solver.parameters.cp_model_presolve=False # EDIT: uncommenting this makes the model run finestatus=solver.Solve(model)
ifstatus==ort.INFEASIBLE:
print("Model is UNSAT")
else:
print("Found solution")
>>Output:
Checkfailed: FixFromAssignment(sat_solver->Assignment(), new_to_old_index, context_)
***Checkfailurestacktrace: ***
By disabling presolve the solver does find a solution.
I am using OR-tools version 9.8.3296 on Ubuntu 22.04.
Kind regards,
Ignace
The text was updated successfully, but these errors were encountered:
Oh it seems I forgot to comment in the solver.parameters.cp_model_presolve = False line in the code snippet.
I fixed it now to reflect the actual output : )
Hi,
I was trying to generate some random problems involving
Inverse
constraints and found OR-tools crashing on some of the instances.Below, is a minimal example in Python:
By disabling presolve the solver does find a solution.
I am using OR-tools version 9.8.3296 on Ubuntu 22.04.
Kind regards,
Ignace
The text was updated successfully, but these errors were encountered: