Difficulty with end depot locations

459 views
Skip to first unread message

Caleb Welton

unread,
Aug 10, 2016, 2:23:06 PM8/10/16
to or-tools-discuss
I'm trying to get start/end depots working.

- I can set start depots for each vehicle separately without issue.
- When I set the end depot for every vehicle to the start location of the first vehicle everything works fine
- When I set the end depot for every vehicle to its own start location, everything works fine
- When I set the end depot to a location that is not in the start depot list* then weird things happen.
  *(even when the the distances to that location are identical to the start location for each vehicle, e.g. it's the really just the same location with a different index)

1. If I have a single pickup/delivery then everything routes fine.
2. If I have multiple pickup/delivery locations then no routes can be found or it will error with `Exception: CP Solver fail`.

I was able to reproduce the same issue using the cvrptw example by simply setting `sameStartFinish=False`, see issue 226 over in github.  https://github.com/google/or-tools/issues/226

Caleb Welton

unread,
Aug 10, 2016, 4:09:23 PM8/10/16
to or-tools-discuss
Solution I came up with was:

 -> Create extra vehicles with 0 capacity which start on the target end locations and also assign the end locations to the real vehicles.

This makes every end location also a start location and seems to solve the issues with end locations not being in the set of start locations.

Would obviously be better if the system accepted target locations not in the set of origin locations.

Vincent Furnon

unread,
Aug 11, 2016, 9:11:21 PM8/11/16
to or-tools...@googlegroups.com
There is no problem having non-overlapping start and end depots. Usual issues come from incorrectly manipulating node and variable indices (which are not necessarily the same). To get a variable index from a node, use RoutingModel.NodeToIndex(). For instance if you want to get the next variable of node, call routing.NextVar(routing.NodeToIndex(node)). Other important point, the range of next variable and dimension variable (except cumul variable) indices is 0..RoutingModel.Size() - 1; the range of cumul variable indices is 0..RoutingModel.Size() + RoutingModel.vehicles() - 1.
The cvrptw example (https://github.com/google/or-tools/blob/master/examples/python/cvrptw_plot.py) actually had mistakes in the way variable indices were handled. A fix has been submitted with the necessary corrections - setting sameStartFinish to either False or True works now.

Vincent

--
You received this message because you are subscribed to the Google Groups "or-tools-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to or-tools-discuss+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages