VRP: a sub optimal assignment due to misscalculation of the objective value

48 views
Skip to first unread message

amihai...@gmail.com

unread,
Jun 2, 2021, 11:11:39 AM6/2/21
to or-tools-discuss
I have a small instance of a vrptw with pickup and deliveries and a start location and end location for each vehicle. 16 locations and 2 vehicles.

I noticed that when the solver uses only one vehicle, say veh_1,  it skips adding transit(veh2.start_location, veh_2,end_location) to the objective value. It then returns a sub optimal assignment because there's a bias towards using less vehicles although I don't have any costs for the vehicles.
Is there something I can do to make sure the solver counts all transits, even start to end locations of unused vehicles?

Thanks a lot,
Amihai

Mizux Seiha

unread,
Jun 2, 2021, 12:46:34 PM6/2/21
to or-tools-discuss
Yes, be default arc cost from start to end (i.e. empty vehicle route) is "forced" to zero (even if the transit callback return a non zero value !), you may use the following method to disable this "feature".

https://github.com/google/or-tools/blob/b37d9c786b69128f3505f15beca09e89bf078a89/ortools/constraint_solver/routing.h#L947-L950

amihai...@gmail.com

unread,
Jun 2, 2021, 1:03:52 PM6/2/21
to or-tools-discuss
Thanks! Now it works well for me!
Reply all
Reply to author
Forward
0 new messages