0

I need to use VRP and take into account that a client wants to either have a pick-up or a delivery. I know VRPB satisfies these requirements but that waits until the truck is empty before picking up from clients.

Is the VRPC able to deal with a negative demand? Which would make it a delivery.

Carlove
  • 429
  • 1
  • 4
  • 15

1 Answers1

0

After some looking around I found this link: https://discuss.graphhopper.com/t/negative-values-as-capacities/1310

You can use a PickUp class or a Delivery class and the code will do the rest. So yes, it is supported.

    Delivery delivery1 = Delivery.Builder.newInstance("1").addSizeDimension(WEIGHT_INDEX, 1).setLocation(Location.newInstance(5, 7)).build();
    Delivery delivery2 = Delivery.Builder.newInstance("2").addSizeDimension(WEIGHT_INDEX, 1).setLocation(Location.newInstance(5, 13)).build();

    Delivery delivery3 = Delivery.Builder.newInstance("3").addSizeDimension(WEIGHT_INDEX, 1).setLocation(Location.newInstance(15, 7)).build();
    Delivery delivery4 = Delivery.Builder.newInstance("5").addSizeDimension(WEIGHT_INDEX, 1).setLocation(Location.newInstance(15, 7)).build();
    Pickup pickup1 = Pickup.Builder.newInstance("4").addSizeDimension(WEIGHT_INDEX, 1).setLocation(Location.newInstance(15, 13)).build();


    VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
    vrpBuilder.addVehicle(vehicle);
    vrpBuilder.addJob(delivery1).addJob(delivery2).addJob(delivery3).addJob(pickup1).addJob(delivery4);
Carlove
  • 429
  • 1
  • 4
  • 15