# Combined Optimization of Maintenance Works and Crews in Railway Networks
## 3 Methodological Framework and Problem Formulation
### Formulation of the Objective Function and Constraints  
The track possession problem, considering the scheduling of maintenance works in railway networks is formulated as a mathematical optimization problem. The mathematical program can be written as follows. \[Min{\sum}_{lcl}\sum_{t\in T}C_{lt}\ \cdot M_{lt}+\sum_{kck}\sum_{pep}\sum_{ del}B_{kpl}\cdot D_{kpl}\cdot\left(CCost_{kl}+MCost_{kpl}\right)\ \ \ s.t. \tag{4}\]  
\[\sum_{t\in T}Xalt=Gal\  
to another. However, a fixed value is added each time a task is performed and there is a movement of a crew between two consecutive links.  
In the objective function of Equation (4), we have added the following part to formulate our enhanced program:  
\[Min\sum_{e\in E}\sum_{t=1}^{T-1}\sum_{l\in LL}\sum_{q\in LL\
ot l}W_{lq}\left[1 -\left(\sum_{a\in A}H_{\mathit{salt}}-\sum_{a\in A}H_{\mathit{eal}(t+1)} \right)\right] \tag{14}\]  
To formulate the enhanced programming problem, several new constraints should be considered. First, a work crew can work on only one workstation. This is ensured by the constraint of Equation (15), i.e., the execution of a task by a given maintenance work crew \(e\in E\) at link \(l\in LL\) can be performed by a single crew at a time \(t\in T\). The constraint of Equation (16) states that each scheduled maintenance task \(a\in A\), which was presented in the baseline model, must be equal to and correspond to a work crew \(e\in E\) at each link \(l\in L\) at each time \(t\in T\). For this to happen, a work crew must be available and assigned by the decision variable to perform the task. Finally, the constraint of Equation (17) ensures that each work crew \(e\in E\) at each time \(t\in T\) is required to move either to a link \(l\in L\) or stay in the depot. In this way, the general movement of each work crew can be tracked from start to finish within the planning horizon. \[\sum_{a\in A}\sum_{l\in LL}H_{\mathit{salt}}\leq 1 \forall t\in T,\;e\in E \tag{15}\]  
\[X_{\mathit{alt}} =\sum_{e\in E}H_{\mathit{salt}}\cdot Z_{\mathit{salt}} \forall l\in L,\;t\in T,a\in A \tag{16}\]  
\[\left|\sum_{a\in A}H_{\mathit{ea0}t}-\sum_{a\in A}\sum_{l\in L}H_{\mathit{ ealt}}\right|=1 \forall t\in T,\;e\in E \tag{17}\]  
Our proposed (enhanced) model is a binary nonlinear model. It is nonlinear because of the constraints of Equation (17). To be able to solve it to global optimality, we must first linearize it by performing a transformation. The rationale behind the transformation lies in our objective to maintain linearity within the model's constraints, thereby enabling the computation of a globally optimal solution. For the transformation of the nonlinear Equation (17), a large positive number \(M_{big}\) and two variables must be added. The variables are \(\delta_{et}\) as a binary decision variable and \(R_{et}\) as a continuous variable. The transformation is performed by replacing Equation (17) with the following equisatisfiable equations:  
\[R_{et} \geq\sum_{a\in A}H_{\mathit{ea0}t}-\sum_{a\in A}\sum_{l\in L}H_{ \mathit{ealt}} \forall t\in T,e\in E \tag{17.1}\] \[R_{et} \geq-\sum_{a\in A}H_{\mathit{ea0}t}-\sum_{a\in A}\sum_{l\in L}H_{ \mathit{ealt}} \forall t\in T,e\in E\] (17.2) \[R_{et} \geq\delta_{et}\cdot Mbig+\sum_{a\in A}H_{\mathit{ea0}t}-\sum_{a \in A}\sum_{l\in L}H_{\mathit{ealt}} \forall t\in T,e\in E\] (17.3) \[R_{et} \geq 1-\delta_{et}\cdot Mbig+\sum_{a\in A}H_{\mathit{ea0}t}-\sum_{a \in A}\sum_{l\in L}H_{\mathit{ealt}} \forall t\in T,e\in E\] (17.4) \[R_{et} =1 \forall t\in T,e\in E \tag{17.5}\]  
**Remark 1**. : _This transformation results in a mixed-binary linear programming model with affine equality and inequality constraints and a linear objective function. This mixed-binary linear programming model can be solved to global optimality, guaranteeing the quality of the solution._The optimization algorithms used to solve the above problem are Branch-and-Cut and the Simplex method.