VRPTW and fixed service times #2365
-
|
What is the proper way to set fixed service times for specified locations? ort::Solver* solver = routingModel.solver();
std::string ss("Break on vehicle 0");
// vehicle break 45 minutes between hours 1 and 2
ort::IntervalVar* break_interval = solver->MakeFixedDurationIntervalVar(3600, 7200, 2700, false, ss);
std::vector<int64> service_times = { 0, 300, 600, 900 }; // depot 0 + three locations: 5, 10, 15 minutes
timeDimension->SetBreakIntervalsOfVehicle({break_interval}, 0, service_times); |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
int64 time_callback(NodeIndex from_index, NodeIndex to_index) {
from = manager.IndexToNode(from_index);
to = manager.IndexToNode(to_index);
return time_matrix[from][to] + service_times[from];
} |
Beta Was this translation helpful? Give feedback.
Your transit(fromA, toB) callback must return
service time(A) + travel time(A, B).Since your transit callback return the sum, when adding a break solver must need to know what is the service time part thus the SetBreakIntervals() method needs it.
So please show us your time dimension transit callback, which should be close to something like this: