Multi Depot Routing

92 views
Skip to first unread message

Divya Manikantan

unread,
Jul 21, 2024, 5:20:18 AM (5 days ago) Jul 21
to or-tools-discuss
I have few depots, amnd all vehicles will start and end based on their nearest depot , but the issue I am facing is I have too keep num vehicles same as num depots or python crashes without any error. Example 2 depots then 2 vehicles, how do I solve this problem?

Mizux Seiha

unread,
Jul 22, 2024, 10:11:00 AM (3 days ago) Jul 22
to or-tools-discuss
When using the override method: 
 RoutingIndexManager(int num_nodes, int num_vehicles,
                      const std::vector<NodeIndex>& starts,
                      const std::vector<NodeIndex>& ends);

What is your problem to fulfill the constraint:
starts.size() == ends.size() == num_vehicles ?

If you have 2 vehicles starting from A, two vehicles starting from B, and all vehicles finishing at C then you can write:
RoutingIndexManager(
...., # num locations
/*num_vehicles=*/4, 
/*starts=*/[A, A, B, B],
/*ends=*/[C, C, C, C])

Divya Manikantan

unread,
Jul 22, 2024, 3:05:38 PM (3 days ago) Jul 22
to or-tools...@googlegroups.com
Thanks for the input, my query is that, I want to dynamically choose the start and end depots, based on minimum distance example I have 2 depots A,B and suppose order is to be picked from X and delivered to Y, the start and end depots to be determined based on proximity to the pickup or drop. Example X is closer to B and Y is closer to A then, B --> X ---> Y ---> A, is this possible?

--
You received this message because you are subscribed to a topic in the Google Groups "or-tools-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/or-tools-discuss/XefaijbHOi8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to or-tools-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/or-tools-discuss/5b57a740-594b-4cda-b064-e3c44bb21f57n%40googlegroups.com.


Analytics Quad4 works with businesses globally to deliver top notch technology solutions.
AI - Analytics - Mobile Apps - Web Apps - Data Engineering
The information in this e-mail is confidential, and is intended solely for the addressee or addressees. If you are not the intended recipient, please delete the mail and kindly notify the sender of misdelivery. Unauthorised publication, use, dissemination, forwarding, printing or copying of this e-mail and its associated attachment(s) is strictly prohibited.
Message has been deleted

Huib Donkers

unread,
Jul 24, 2024, 4:21:57 AM (yesterday) Jul 24
to or-tools-discuss
I see my previous message was deleted, maybe because it look too much like spam, containing only half a sentence and a single link?
Anyway, if I understand correctly, you basically want the solver to have free choice of where vehicles start and end, so it'll pick the depot locations that yield the best objective value (which probably means it'll be the closest depot). You can use/modify the approach described in the "guide" pages on google or-tools. I'd give the link but I tried that before.. You can google for "google or tools common routing tasks" or "google or tools arbitrary start and end locations" to find the page. It doesn't give much information, but the key idea is to set the distance to 0, between your actual depots (nodes) and the node that OR-tools thinks is your (start/end) depot. Technically your routes will still always start and end at the same location, but you modify the graph such that the second and the second-to-last vertices must be one of your depots.

Divya Manikantan

unread,
Jul 24, 2024, 7:13:22 AM (yesterday) Jul 24
to or-tools-discuss
Thank you will try this one and update
Reply all
Reply to author
Forward
0 new messages