Dear all,
I'm working on an optimization problem using CP-SAT (Python API). I've found it very effective to converge towards an optimal solution to my problem.
For the sake of my project, I'd like to get several close-to-optimal solutions (say about 10), and I'm struggling to find an efficient way to do that with CP-SAT.
As I couldn't find a parameter to do that, I came up with the idea of :
- Running the solver a first time, keeping track of the optimum
- Adding this optimum as a constraint for the model
- Run the solver again, this time with the SearchForAllSolutions function
However, running the solver with this additionnal constraint is way longer. Even without using SearchForAllSolutions but sticking to Solve, the solver will take much longer to find one solution than it did to find one when trying to optimize in the first place.
Am I going in the right direction ? Is there a better way to get several good enough solutions for a problem using CP-SAT ?
Would love any insight on this question !
Regards,