1
$\begingroup$

Requirement overview: The trip route can have the following type of task

  • Delivery only
  • Pickup only
  • Pickup from one location and deliver to another location

Condition: Once a trip starts from depot, it should come back only when the trip is completed. During the trip, it shouldn’t come to depot.

As we understand, OR tools need delivery and pickup location for each order else it's giving issues. Ref: https://groups.google.com/g/or-tools-discuss/c/WyEOZAv8IJs/m/PxWb7Lq7AwAJ To overcome this, for all delivery orders we add depot as pick location and for all pick orders, we add depot as the delivery location. This is working fine if all orders are for delivery. However, if orders are having a mix of delivery and pick, in this scenario, during the trip if the depot location is near to the last pick node, the vehicle will go to the depot if OR-tools is optimizing like this (considering the last pick needs to be delivered at depot).

This leads to wrong route optimization. Looking for help here. Please advise if we are missing something or having a wrong understanding.

$\endgroup$
2
  • 1
    $\begingroup$ Please indicate when crossposting. $\endgroup$ Commented Jan 9, 2022 at 12:51
  • $\begingroup$ @Anuj0721, if you could provide a mathematical model/representation, it gives you more chance to answer the question. :) $\endgroup$
    – A.Omidi
    Commented Jan 10, 2022 at 11:11

1 Answer 1

1
$\begingroup$

I do not understand the question. Each vehicle does only one trip from depot to depot. And each node can only be visited once. So if a vehicle goes to the depot at one point in time, it cannot start another route after that.

$\endgroup$
3
  • $\begingroup$ A node can be visited more than once but vehicles should reach the depot either at the starting or at the end of the trip only. $\endgroup$
    – Anuj0721
    Commented Jan 9, 2022 at 13:12
  • $\begingroup$ Let's be clearer. An index can be visited only once. A duplicated node can be visited once per copy. I suppose the depot is not the depot as defined in the routing library, by one arbitrarly (duplicated) node you call depot. Then for each vehicle, create 2 nodes: depot_start and deport_end. Add them in a disjunction, and tweak the distance matrix such that only the start of the vehicle can go to the deport_start, and the only outgoing arc from the depot_end goes to the vehicle end. $\endgroup$ Commented Jan 9, 2022 at 13:19
  • $\begingroup$ can you please explain a little bit more? $\endgroup$
    – Anuj0721
    Commented Jan 10, 2022 at 7:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.