Interrupting search in routing; is the best solution returned?

211 views
Skip to first unread message

rdl

unread,
Jun 6, 2012, 5:50:52 AM6/6/12
to or-tools-discuss

I run a routing solver.

At some point, I interrupt the computation,
using a SearchMonitor, and the method FinishCurrentSearch.

I wat to get the best solution found so far;
is it the one that is returned by the method routing.Solve() ?
If not, how can I get it?

Thank you

--
Renaud

Mark Farkas

unread,
Jun 6, 2012, 7:12:10 AM6/6/12
to or-tools...@googlegroups.com
Hi!

You can create a custom SearchMonitor and override its AtSolution
method. In that method you can get the objective value and assignments
from the RoutingModel. Based on the objective value you just need
to store the best assignment so far in the SearchMonitor or anywhere
else.

Regards,
Mark

Luc Mercier

unread,
Jun 6, 2012, 11:50:18 AM6/6/12
to or-tools...@googlegroups.com
There is already such a monitor predefined for you:

It does exactly what Mark suggested.
Reply all
Reply to author
Forward
0 new messages