Implementing "Stop search after no new solutions found in last X seconds" CPSAT Python ortools 9.1 and onwards

121 views
Skip to first unread message

Priidik Vilumaa

unread,
Nov 8, 2021, 2:22:33 AM11/8/21
to or-tools-discuss
Hey guys!

We are interested in implementing the "stop search after no new solutions found in last X seconds" termination condition while using CPSAT with Python. I remember this condition being quite common and useful in metaheuristics. So I figured it could help us as well, particularly since we are having a hard time guesstimating a good time limit based on instance size.

Until OR-Tools v9.1, I would have just implemented a callback, kept track of the time and used `SolveWithSolutionCallback`. However, as `SolveWithSolutionCallback` will be deprecated, what's a good approach that is compatible with future versions?

Note, that we're more interested in actual solutions rather than bound improvements. And obviously we are using multiple workers :)

Best,
Priidik

Laurent Perron

unread,
Nov 8, 2021, 4:06:42 AM11/8/21
to or-tools...@googlegroups.com
Just use Solve() with the same arguments
Laurent Perron | Operations Research | lpe...@google.com | (33) 1 42 68 53 00



--
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/52887d71-5ca1-4005-bed3-5c6039e8857an%40googlegroups.com.

Priidik Vilumaa

unread,
Nov 8, 2021, 4:13:39 AM11/8/21
to or-tools-discuss
Oh my, thanks :)
Reply all
Reply to author
Forward
0 new messages