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.
- Pickups before DropOffs only
- 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.
- Customers will be picked up at fixed locations (in a circuit)
- Every pickup Customer will have a drop off destination (outside of
Circuit) - The vehicle will not head to a drop-Off then come back to pickup again. (Once vehicle leaves circuit all it does is drop-Off its customers at set location)
- The Vehicle moving in the circuit has to move in a specific path (imagine a 1 way street)
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.
- Added a TYPE attribute to the customer to differentiate between pickup & customer
- Added a variable listener to the customer class that keep track of all the DropOffIds currently when a vehicle arrives to it so that it only goes to a dropOffLocation if it has a passenger heading to that place. When a vehicle arrives to a dropOff it removes that item from the list. (Essentially serves as a stack).
- The problem is theoretically this isn't stopping from a vehicle picking up a customer dropping him off then picking up another, if the customers locations are relatively close.
- Also having a hardtime enforcing a fixed route a vehicle must take in a circuit, was planning on using a Cost Matrix to use the soft constraint to enforce the route implicitity(A vehicle wont go backwards or a skip a point as the cost would be too high), but not working the way it should be.