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)?
Asked
Active
Viewed 236 times
1 Answers
3
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]; }
);

Mizux
- 8,222
- 7
- 32
- 48

Laurent Perron
- 8,594
- 1
- 8
- 22
-
Could you please share some sample or link? thank you – Smyk L. May 06 '20 at 10:43
-
You have a distance matrix, or some function that returns the distance between 2 nodes. Add the loading time to that computed distance. – Laurent Perron May 06 '20 at 12:16