Weeam93
Weeam93

Reputation: 11

Optaplanner VRP with Pickups Before DropOffs

I am working on using Optaplanner to solve the following a complex vrp problem with many requirements. I was able to handle most of them except for the following 2 aspects.

  1. Pickups before DropOffs only
  2. Enforce a specific path on the way to pickup customers.

The goal is to pickup a group of customers who are going to destinations that close together and put them in the same vehicle.

Thanks in Advance! I appreciate the help!

The Problem is very similar to the example VRP TimeWindow example but with the following changes.

Planning on Using Road Distances with the Score between each Pickup-to-Pickup is Known. Pickup -> Drop-Off is not known (Planning on using Air).

I'm having a hard time in enforcing that after leaving the circuit to drop-Off customers a vehicle may not come back to pickup more customers, and having this work with the fixed path a vehicle can make in the circuit.

My main idea was to do the following.

Upvotes: 1

Views: 488

Answers (1)

Geoffrey De Smet
Geoffrey De Smet

Reputation: 27312

I might consider a domain model like this:

@PlanningEntity
class Pickup implements PickupOrVehicle {
    Customer customer;

    @PlanningVariable
    PickupOrVehicle previousPickup;

    @PlanningVariable
    int dropOffPriority;

}
@PlanningEntity // Shadow entity
class Vehicle implements PickupOrVehicle {
    ...

    @ShadowVariable(based on dropOffPriority and previousPickup)
    List<Customer> dropOffOrderList;

    // For consistency we might also add pickUpOrderList
}

That dropOffPriority should either be globally unique (by initializing it uniquely and only configure SwapMoves for that variable.

Or otherwise, the VariableListener should just order 2 assignments with the same dropOffPriority by their customer's id (because the ordering must be deterministic!).

No sure if it will work well. If you do try it out, do let us know here if it works well or not.

Upvotes: 0

Related Questions