I'm porting my old (from 2010) OR-tools CP solver models to the CP-SAT solver (in Python3). There are quite a few differences between these systems, but most are quite easy to port to the CP-SAT solver.
However, one thing I haven't found in the CP-SAT solver documentation is the "reflection" methods that the old CP solver supports, such as getting lower/upper bounds of a decision variables. E.g.
# Old CP solver code
solver = pywrapcp.Solver("Name")
x = solver.IntVar(0,10, "x")
# ....
x_lb = x.Min() # lower bound
x_ub = x.Max() # upper bound
# ...
One can then use these lower/upper bounds of the variable to implement other constraints. (Here's a CP solver implementing the cumulative
constraint using Min
and Max
methods: http://hakank.org/or_tools/furniture_moving.py )
Does the CP-SAT solver supports these kind of reflection methods?
Aucun commentaire:
Enregistrer un commentaire