1

I am using the google's ortools library in python to find an optimal path between a set of points. The set of points is broken up into subsets. For example, set A may contain 10 points, set B contains 6 points, set C contains 48 points. The sets of points must be visited in order, i.e. all points in A must be visited before moving to the points in set B, and all points in B must be visited before the points in C. I have a working solution by running the algorithm on set A, noting the end location (which is arbitrarily chosen by using a dummy node and setting the distance to this node from any point to zero). Then starting from the last point in A and using it as the start for B.

Is there a way I can allow the algorithm to optimize for all of the sets and apply the order constraints?

Jonathan
  • 303
  • 4
  • 14

1 Answers1

0

Just forbid any arc B->A, C->B or C->A.

You can do it by returning a value greater than the vehicle capacity OR by directly removing the nodes from the NextVar() list. routing.NextVar(index).RemoveValues([...])

Mizux
  • 8,222
  • 7
  • 32
  • 48