Objective and short problem description
The objective is to load as many passenger vehicles as possible on an auto-train. The train consists of multiple wagons with two levels each. The wagons are connected to each other. Every vehicle has to enter the train from the rear on the upper or the lower level and drive all the way to its assigned position. Once it entered a level it can not be moved to the other level and once it is positioned the following vehicles cant be in front of the vehicle.
The vehicles are parked very close to each other in one (first problem instance) or multiple (second instance) rows. We have to load the first vehicle before we load the second vehicle before we load the third vehicle and so on. If there are multiple rows we can always choose the currently first vehicle of each row.
Multiple constraints limit the capacity of the train. Each wagon is constrained in terms of length. Both levels of a wagon are constrained in terms of weight and height. On the bottom level the entry and exit of the wagons are sloped. Because of that on the first and last position of each wagon the height is more limited than the height on the positions in between.
Modeling approach
I currently model the problem as an assignment problem due to the complex precedence constraints. The train has a number of Wagons and a number of positions $P$ both levels ($W_l$ are sub-sets of platforms that are on the lower (0) and upper level (1)). Each wagon has a maximum of 6 positions on both levels which I model by building multiple subsets $W \in P$. Any of the positions can remain empty.
Weight and length constraints are very easy to implement by summing up lengths & weights of the vehicles $v \in V$ on the positions $p \in W$ over all the wagons. I model the height constraints with the help of auxiliary variables. In case the sum of the lengths of the vehicles on the lower level of a wagon is above a certain threshold, we have to account for the extra height of vehicle on the first position on the lower level of this wagon (which is now standing on a slope). If the sum is above a second threshhold we also have to consider the extra height due to the slope of the last position on the lower level of this wagon.
Question / Problem
I have implemented all of these constraints and they are working fine. I have also successfully implemented the precedence constraints in case there is only a single row of vehicles:
- For a single row for every vehicle $v$ we build a set of pairs that models the precedence requirements for every vehicle according to the order in the row: v < u: $(v, u) \in A$.
Decision variable $x_{pv}$ is equal to 1, if vehicle $v$ is on position $p$ and 0, otherwise
The two constraints I use that work are:
- $\sum\limits_{p\in W_l}px_{pv} \leq \sum\limits_{p\in W_l}px_{pu} + (1-\sum\limits_{p\in W_l}x_{pu})*M\quad \forall (v,u) \in A:W_{l\in 0/1}$
- $\sum\limits_{p\in P}x_{pv} \geq \sum\limits_{p\in P}x_{p(v+1)} \quad\forall v \in {0, ..., |V|-1}$
The precedence constraints I want to model are:
- The train has to be loaded from the back to the front on both levels
- The vehicles are now parked in multiple rows and I can always only access the currently first vehicle in each row.
For example there are three rows with vehicles: [0, 1, 2] [3, 4, 5] [6, 7, 8] . 0 has to be loaded before 1, 1 before 2, 3 before 4, ...
If I use the above constraints (1) and (2) I can only model the precedences within each single row. However, there is also a precedence that connects the different rows which is that I can always only load the currently first vehicle of each row.
This problem becomes more clear if I show the result for the small example above:
Top level Wagon 1: [0, 4, 6, 5], Wagon 2: [...], ...
Bot level Wagon 1: [1, 2, 7, 3, 8], Wagon 2: [...], ...
Vehicle 4 and 7 can not be loaded because neither 6 nor 3 are loaded. A correct result would be:
Top level: [0, 3, 6, 5], Wagon 2: [...], ...
Bot level: [1, 2, 7, 4, 8], Wagon 2: [...], ...
I am searching for multiple days straight but can not figure out the right way to do it. My guess is that I somehow have to relate the predecessors of the vehicles between the rows.