Reuse variables in CP-SAT solver

156 views
Skip to first unread message

Yuehan Li

unread,
May 25, 2023, 2:14:05 AM5/25/23
to or-tools-discuss
Hi,
Is it possible to reset Boolean variables once they have been solved?
We have a lot of Boolean variables associated with a large dataset and use CP-SAT solver to determine their values .A small portion of the dataset undergoes frequent modifications.  Instead of rebuild the model each time, is it possible to reset and reuse the Boolean variables and solve them?

Frederic Didier

unread,
May 25, 2023, 3:59:51 AM5/25/23
to or-tools...@googlegroups.com
The input to CP-SAT is a CpModel proto, there is no issue modifying this in place between solves.
But the gain will be minimal since the solver will still rescan the whole proto and restart from scratch each time.
If the code to create a model is slow, then this can be beneficial though.

--
You received this message because you are subscribed to the Google Groups "or-tools-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to or-tools-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/or-tools-discuss/4daa8132-a680-4672-ab51-4e21ae06f761n%40googlegroups.com.

Yuehan Li

unread,
May 25, 2023, 9:58:41 AM5/25/23
to or-tools-discuss
Yes, the creation of the model is slow. How do I modify the variables so that I can reuse them ?

grego...@gmail.com

unread,
May 26, 2023, 4:53:39 AM5/26/23
to or-tools-discuss
Is it possible that large part without modifications doesn't need to be modeled completely ? I model a problem also with constraint solver. After initial propagation I have limited domains of variables, this information is very useful for cp-sat model since I can skip some parts of a model without feasible solution.

Laurent Perron

unread,
May 26, 2023, 5:58:11 AM5/26/23
to or-tools-discuss
Solve is stateless. So I guess the answer is no. 

--
You received this message because you are subscribed to the Google Groups "or-tools-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to or-tools-discu...@googlegroups.com.

watchdogs132

unread,
May 26, 2023, 7:21:15 AM5/26/23
to or-tools-discuss
Reply all
Reply to author
Forward
0 new messages