Pickup/delivery initial load for capacity

33 views
Skip to first unread message

Harut Martirosyan

unread,
Apr 25, 2021, 12:24:53 AM4/25/21
to or-tools-discuss
In my model, vehicles do pickups and deliveries model. 
Each vehicle can carry max of 3 orders simultaneously.

How to assign an initial load to some vehicles that are already on their way to deliver an order?

final int capacityIndex =
    routing.registerUnaryTransitCallback((long index) -> {
      int nodeId = manager.indexToNode(index);
      for(int[] pds : data.pickupsDeliveries) {
        if(nodeId == pds[0]) return 1; // Increase on pickup
        if(nodeId == pds[1]) return -1; // Decrease on delivery
      }
      return 0;
    });
routing.addDimension(capacityIndex,
        0,
        1,
        false,
        "OrderCapacity");
RoutingDimension ordersDimension = routing.getMutableDimension("OrderCapacity");

amihai...@gmail.com

unread,
Apr 25, 2021, 8:43:23 AM4/25/21
to or-tools-discuss
Reply all
Reply to author
Forward
0 new messages