## 3 Model and Methods
### Speed-Up Routines
#### 3.2.1 Lazy Constraint Attribute  
In AIMMS, the user is allowed to label constraints as \"lazy\". When the solver recognizes lazy constraints, it does not directly include them in the model. Instead, it solves a \"relaxed\" model with these lazy constraints omitted. Each time it finds a feasible solution of this \"relaxed\" model, it checks the solution against the lazy constraints. If it detects violation of a lazy constraint, it then forms a new \"relaxed\" model by adding the violated lazy constraint and resolves the model. In the model, all of the station and siding capacity constraints except the ones involving only binary variables were defined as lazy constraints. 2.2 Solution Space Restriction Algorithm for Reducing the Number of Binary Variables and Constraints  
As mentioned before, the model hosts a very large number of constraints. However, very few of the constraints for conflict resolution will actually be binding. Moreover, most of the binary variables defined for meetings will simply be zero. Therefore, if we can eliminate the constraints that are very unlikely to be binding and the binary variables which are very likely to be zero in the optimal solution, then a significant reduction in problem size and thus computation time may be achieved. Such progress was already made by defining the station or siding capacity constraints as \"lazy constraints\". Hence, a heuristic solution space restriction algorithm has been developed to aid the solver in the solution procedure. It involves implementing a greedy heuristic that does not consider station capacity constraints to see what a solution may actually \"look like\". Then, the actual solution will be restricted to being \"properly similar\" to the outcome of this greedy heuristic. The greedy heuristic is quite simple: starting from scratch, it finds all the conflicts and resolves them one by one. Finally, it arrives at a feasible solution. The heuristic tackles the constraints in \"time order\": it finds the first conflict with respect to time, resolves it, then finds the next conflict and resolves it, repeating until there are no conflicts left. The decision logic of the heuristic is very simple and myopic, hence making it a greedy heuristic. When it detects the conflict, it first resolves the conflict by delaying one of the two conflicting trains. It then computes the total weighted unrecoverable delay of two trains in conflict after this local resolution. Then, it reverses the solution and resolves the conflict by delaying the other conflicting train. After that, it again computes the total weighted unrecoverable delay of two trains in conflict after local resolution. The alternative that gives the lower total weighted unrecoverable delay of two trains will be selected. The heuristic will then update the departure and arrival times of the delayed train and find the next conflict. The heuristic's steps of execution are as follows:  
Step 1. For all trains, compute the departure times from and arrival times at all stations as if all trains can move on a dedicated track with no conflicts. Step 2 Find all of the (meeting, headway, overtaking, etc.) conflicts in the system. If there are no conflicts left, terminate and report the final solution (all departure and arrival times for all trains plus the locations of meetings and overtakes). If there is at least one remaining conflict, go to Step 3. Step 3: Determine the possible occurrence times of the conflicts by calculating the intersection points of the train paths. Step 4: Find the earliest conflict and resolve it. Step 5: Update the departure and arrival times of the train to be delayed in the immediate conflict resolution, as done in Step 1, and go to Step 2. This algorithm is guaranteed to give a feasible solution for the relaxed problem where all stations are assumed to have infinite capacity.