Optimize large number of nodes

154 views
Skip to first unread message

Prateek Khandelwal

unread,
Nov 8, 2022, 6:26:03 AM11/8/22
to or-tools-discuss
I'm using ortools (version: 9.3) in python to generate routes with constraints, I'm running the solver with ~1200 orders with capacity, service time, weight and some other constraints on vehicles and not getting the same result when splitting the data into clusters (5) with almost equal orders. I found this thread (https://groups.google.com/g/or-tools-discuss/c/ViEPGrYBils), but couldn't find an example of how to enable caching or pass time matrix to the solver. How can I optimize this and get the same result as small clusters.

```
# Setting first solution heuristic.
search_parameters = pywrapcp.DefaultRoutingSearchParameters()
if (
route_group_config["first_solution_strategy"]
== constants.PARALLEL_CHEAPEST_INSERTION
):
search_parameters.first_solution_strategy = (
routing_enums_pb2.FirstSolutionStrategy.PARALLEL_CHEAPEST_INSERTION
)
else: # default PATH_CHEAPEST_ARC
search_parameters.first_solution_strategy = (
routing_enums_pb2.FirstSolutionStrategy.PATH_CHEAPEST_ARC
)
search_parameters.local_search_metaheuristic = (
routing_enums_pb2.LocalSearchMetaheuristic.GUIDED_LOCAL_SEARCH
)
search_parameters.time_limit.FromSeconds(int(solution_time))
```
Let me know if more details are required.

watchdogs132

unread,
Nov 8, 2022, 6:31:52 AM11/8/22
to or-tools-discuss

Prateek Khandelwal

unread,
Nov 8, 2022, 6:56:51 AM11/8/22
to or-tools-discuss
@watchdogs132 Did it work for you? Enabling cache and setting limit using ABSL doesn't work in python? Can we just use RoutingModelParameters (https://github.com/google/or-tools/blob/82750ac12f1ee5354e1c7869894d9af3508778f2/ortools/constraint_solver/routing_flags.cc#L335)?

Prateek Khandelwal

unread,
Nov 9, 2022, 5:13:17 AM11/9/22
to or-tools-discuss
It did help in iterating more solutions but still didn't get the same number of solutions when splitting the problems into small chunks.
Reply all
Reply to author
Forward
0 new messages