- 1 Depo
- Multiple Costumers (lets assume 4)
- Multiple Days (lets assume 3)
- Multiple Vehicle Types with:
- Price per km
- specific capacity
- Every Costumer has:
- Delivery frequency
- Demand per delivery
- Every costumer has to be assigned to a delivery pattern. Multiple delivery patterns are possible for each frequency. The pattern decide if a delivery is possible on that day or not. For a frequency of 1 and 3 working days: [[1,0,0],[0,1,0],[0,0,1]], a frequency of 2 [[1,1,0],[1,0,1],[1,1,0]], a frequency of 3: [1,1,1]. These are the possible patterns.
- The demand of each costumer per delivery is the same for every day a delivery is performed.
So we have a set of costumers that have to be delivered by one depo. Multiple Vehicle Types are available for the job. The day of service is flexible because only the frequency is fixed to a costumer, but there are multiple possibilities to fulfill the demand. To choose pattern [1,0,0],[0,1,0] or [0,0,1] for a frequency of 1.
What I did so far:
- I copied every node by the number of working days.
- I restrict the start and end to the depo nodes of each day.
- I multiply the vehicles by the number of days. Furthermore, I handle the days as different kinds of cargo. I do assign a capacity of zero to the vehicle when it should not be used on that day. [[10, 15, 15, 0, 0, 0, 0, 0, 0], [0, 0, 0, 10, 15, 15, 0, 0, 0], [0, 0, 0, 0, 0, 0, 10, 15, 15]].:The First 3 vehicles are for day one, the second three are day two and the last 3 are day 3.
- For the demand matrix I use the same trick. In a case of 4 costumers + 1 depo the demand matrix could look like this [[0, 3, 0, 5, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0, 3, 4, 5, 2, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 2]], The second entry in the first list (3) and the 7th entry in the second list (3) are for the same costumer just on two different days. The nodes were copied.
This works good so far. But it's not what I want to do.
I do assign a demand for every costumer and day by hand, but I want to assign the demand by a chosen delivery pattern for each costumer.
The model could assign pattern [1,0,1] to one costumer with a frequency of 2 and a pattern of [0,0,1] to another costumer. This would result in the possibility to plan a tour on day 3 with both demands combined.
I need help to define a dimension that manages the assignment of patterns to costumers which results in "flexible" demand matrix.
Thank you for your help.
Find my code attached.