Warm tip: This article is reproduced from stackoverflow.com, please click
c# or-tools traveling-salesman vehicle-routing

Fixed location loading time using OR tools with C#

发布于 2020-07-26 13:54:17

Im trying to solve Vehicle Routing Problem with Time Windows using OR tool with C#. Is it possible to add loading time (fixed duration, that vehicle have to stay at the location after arrival) to every location (no depot, but location)?

Questioner
Smyk L.
Viewed
15
2,085 2020-05-13 16:28

You can just add the loading time to all arcs going out of the node.

In your time transit callback simply return the service time + the travel time. e.g.

int transitCallbackIndex = routing.RegisterTransitCallback(
        (long fromIndex, long toIndex) => {
        // Convert from routing variable Index to time matrix NodeIndex.
        var fromNode = manager.IndexToNode(fromIndex);
        var toNode = manager.IndexToNode(toIndex);
        return data.TimeMatrix[fromNode, toNode] + data.ServiceTime[fromNode]; }
        );