CPMpy / cpmpy

Constraint Programming and Modeling library in Python, based on numpy, with direct solver access.
Apache License 2.0
214 stars 21 forks source link

Time limit semantics #279

Open IgnaceBleukx opened 1 year ago

IgnaceBleukx commented 1 year ago

Every solver has the optional argument time_limit in its solve call.

Right now there are some inconsistencies:

from cpmpy import *
model  = Model(boolvar())
model.solve(solver="ortools", time_limit=-1)
>> error
model.solve(solver="gurobi", time_limit=-1)
>> error
model.solve(solver="pysat", time_limit=-1)
>> True
model.solve(solver="z3", time_limit=-1)
>> True
model.solve(solver="minizinc", time_limit=-1)
>> False

I think a value <= 0 as time limit should correspond to "no time limit"

Thoughts?

Wout4 commented 1 year ago

There is no other viable way to interpret a negative time limit, so no time limit is the best option yes