# 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.