VRP on several days

248 views
Skip to first unread message

Alberto Manzini

unread,
Nov 11, 2020, 9:45:06 AM11/11/20
to or-tools-discuss
Hi everyone, I'm trying to solve a VRP problem in which we want that the vehicles could come back to the depot if needed. For example, in the image below we can imagine that a single vehicle visits all the nodes in 4 different days.I could not figure out how to do it unless using a synthetic vehicle for each day that I want to optimize, then solve each of these fake vehicles and bring the solutions together. In this way, however I have to set the order of the optimized (single) days manually after the solver has finished its job.
Thanks for your help,
Alberto
Immagine.png

haak...@gmail.com

unread,
Nov 12, 2020, 3:25:42 AM11/12/20
to or-tools-discuss
You have to make nodes representing each depot visit since each node can only be visited once. In your case I would make 4 depot nodes, one for each day. Another alternative is to make a pickup node for every delivery. The pickup nodes can just be copies of the depot, but this allows you to visit the depot again whenever necessary.

Mizux Seiha

unread,
Nov 13, 2020, 6:14:24 AM11/13/20
to or-tools-discuss
you should take a look at reload sample:
https://github.com/google/or-tools/blob/stable/ortools/constraint_solver/samples/cvrp_reload.py

Basically add some reload node (or unload node), which are depot duplicate, so the vehicle can visit new locations once full (or empty)...

Alberto Manzini

unread,
Nov 16, 2020, 12:07:10 PM11/16/20
to or-tools-discuss
Thanks for help, actually I'm trying to put the capacity refill based on the distance traveled between nodes.
I have started working on https://github.com/google/or-tools/blob/stable/ortools/constraint_solver/samples/cvrp_reload.py as you suggested, simply modifying the "create_demand_evaluator" function, but it's not working.
Someone does have a hint to bugfix this code (see attachment)?
Thanks for your help,
Alberto

test_code.py
Reply all
Reply to author
Forward
0 new messages