VRP Soft time dimension

67 views
Skip to first unread message

R2 D2

unread,
Aug 20, 2025, 6:08:59 AMAug 20
to or-tools-discuss
Is it possible to set *soft* maximum working hours for a depot?
Normally we add time dimension by: routingModel.addDimension which is hard requirement.
In a situation when 9 nodes are placed together but remotely from depot it is more profitable to serve them all in one day at a cost of extended working hours.

Laurent Perron

unread,
Aug 20, 2025, 10:12:48 AMAug 20
to or-tools...@googlegroups.com
there are a soft lower and soft upper bound on dimension cumul variables
Laurent Perron | Operations Research | lpe...@google.com | (33) 1 42 68 53 00



--
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-discu...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/or-tools-discuss/7438aeaa-404f-436e-9d5c-9b77e23d8a28n%40googlegroups.com.

Vincent Furnon

unread,
Aug 27, 2025, 9:48:35 AMAug 27
to or-tools...@googlegroups.com
You should use RoutingDimension::SetSoftSpanUpperBoundForVehicle(BoundCost bound_cost, int vehicle) which adds bound_cost.cost * (span - bound_cost.bound) to the cost if span > bound_cost.bound, where span is the dimension span on the route of the given vehicle. This allows to minimize extended working hours without enforcing route start or end times.
As mentioned by Laurent, you can also specify soft lower or upper bounds on specific cumul variables (for instance at the start or the end of the route) if you want to stay close to some specific start and end times for the route.

Reply all
Reply to author
Forward
0 new messages