routeIndices = []
for r in routeNodes:
routeIndices.append([self.manager.NodeToIndex(n) for n in r])
self.routing.CloseModel()
initialAssignment = self.routing.solver().Assignment()
success = self.routing.RoutesToAssignment(routeIndices, True, True, initialAssignment)
self.logger.debug(f"Warm starting of route {'successful' if success else 'failed'}")
return self.routing.SolveFromAssignmentWithParameters(
initialAssignment, searchParameters
)
Here, routeNodes is a list of node i's per vehicle, e.g. [ [4, 6, 5], [9, 8, 7, 10] ] for a case with 2 vehicles, where [0,1] are the start/end node of vehicle 1 and [2,3] are the start/end node of vehicle 2.
This does work as expected, however it does not allow me to append vehicles that do not yet have any nodes (except for a start- and endnode to depot). I have already tried to add an empty list [], but they seem to be ignored, and I'm unable to find proper documentation on this. Does anyone know how I can implement this?
Thank you for your time.
Kind regards,
Bart