## 3 Mathematical Model
### Constraints related to train operation
Specifically, for Line A, the research period \([t_{start},t_{end}]\) is divided into a series of time units based on the time-indexed method, and a set of time units \(\mathbf{T}\) is formed, involving time stamps \(\left\{t_{0},t_{1},t_{2},t_{3},t_{4},\cdots,t_{|\mathbf{T}|-2},t_{|\mathbf{T}| -1},t_{|\mathbf{T}|}\right\}\), where \(t_{start}=t_{0},t_{end}=t_{|\mathbf{T}|}\). Further combined with the arrival data of passengers on the Line, a dynamic passenger flow matrix \(\mathbf{D}\) can be set. \[\mathbf{D}=\left[ \begin{array}{cccccc}o_{1,1}&o_{1,2}&o_{1,3}&\cdots&o_{1,| \mathbf{T}|-1}&o_{1,|\mathbf{T}|}\\ o_{2,1}&o_{2,2}&o_{2,3}&\cdots&o_{2,|\mathbf{T}|-1}&o_{2,|\mathbf{T}|}\\ o_{3,1}&o_{3,2}&o_{3,3}&\cdots&o_{3,|\mathbf{T}|-1}&o_{3,|\mathbf{T}|}\\ \vdots&\vdots&\vdots&\cdots&\vdots&\vdots\\ o_{|\mathbf{S}^{A}|-1,1}&o_{|\mathbf{S}^{A}|-1,2}&o_{|\mathbf{S}^{A}|-1,3}& \cdots&o_{|\mathbf{S}^{A}|-1,|\mathbf{T}|-1}&o_{|\mathbf{S}^{A}|-1,|\mathbf{ T}|}\\ o_{|\mathbf{S}^{A}|,1}&o_{|\mathbf{S}^{A}|,2}&o_{|\mathbf{S}^{A}|,3}&\cdots&o_{| \mathbf{S}^{A}|,|\mathbf{T}|-1}&o_{|\mathbf{S}^{A}|,|\mathbf{T}|}\\ \end{array} \right]. \tag{34}\]  
Furthermore, for the coupling between the passenger flow and trains, the Boolean variable \(\lambda_{i,j,m}\) is introduced to characterize the relationship between the departure time \(d_{i,j}\) and each timestamp. It is specified that if \(d_{i,j}\) is not less than the timestamp \(t_{m}\), \(\lambda_{i,j,m}\) is equal to 1, otherwise, 0. Then, we obtain:  
\[\lambda_{i,j,m}=\left\{ \begin{matrix}1&d_{i,j}\geq t_{m}\\ 0&d_{i,j}<t_{m}\end{matrix} ,\ i\in\mathbf{N}^{A},\ j\in\mathbf{S}^{A},\ m\in \mathbf{T}.\right. \tag{35}\]  
Similarly, the Boolean variable \(\lambda_{i,j,m}\) is further introduced to characterize the relationship between the departure time \(d_{l,j}\) of the train \(l\) on Line A at station \(j\) and timestamps; therefore, we obtain:  
\[\lambda_{i,j,m}^{c}=\left\{ \begin{matrix}1&d_{l,j}\geq t_{m}\\ 0&d_{l,j}<t_{m}\end{matrix} ,\ j\in\mathbf{S}^{A}_{l},\ m\in\mathbf{T}.\right. \tag{36}\]  
Based on the above content, in terms of the newly arrived passenger volume within the departure interval of adjacent trains at the same station, for train \(i\), the train ahead may or may not be the cross-line backup train. If the train ahead is not the cross-line backup train, the new demand is the number of passengers arriving during the departure of trains \(i\) and \(i-1\). There are two situations in which the train ahead is not the backup train for train \(i\) at station \(j\). One is that the backup train does not pass through station \(j\), and the other is that the backup train passes through station \(j\), but its sequence is not between train \(i\) and \(i-1\) (i.e., \(z_{l,j-1}^{a}=0\)). Combined with Figure 5, for \(i,i-1\in\mathbf{N}^{A},j\in\mathbf{S}^{A}\backslash\mathbf{S}^{A}_{l}\), we obtain:  
\[v_{i,j}^{add}=\sum_{m=1}^{|\mathbf{T}|}\left(\lambda_{i,j,m}-\lambda_{i-1,j,m} \right)\times o_{j,m}. \tag{37}\]At the same time, if \(z^{a}_{l,i-1}=0\), for \(i,i-1\in\mathbf{N}^{A}\), \(j\in\mathbf{S}^{A}_{l}\), we obtain:  
\[v^{add}_{i,j}=\sum_{m=1}^{\left|\mathbf{T}\right|}\left(\lambda_{i,j,m}-\lambda_ {i-1,j,m}\right)\times o_{j,m}. \tag{38}\]  
Otherwise, if \(z^{a}_{l,i-1}=1\) and \(j\in\mathbf{S}^{A}_{l}\), for \(i\in\mathbf{N}^{A}\), we obtain:  
\[v^{add}_{i,j}=\sum_{m=1}^{\left|\mathbf{T}\right|}\left(\lambda_{i,j,m}- \lambda^{c}_{l,j,m}\right)\times o_{j,m}. \tag{39}\]  
In terms of the cross-line backup train, the new demand also needs to be calculated in conjunction with timestamps and Boolean variables. For \(j\in\mathbf{S}^{A}_{l}\), \(i,i-1\in\mathbf{N}^{A}\), if \(z^{a}_{l,i-1}=1\), we obtain:  
\[v^{add}_{l,j}=\sum_{m=1}^{\left|\mathbf{T}\right|}\left(\lambda^{c}_{l,j,m}- \lambda_{i-1,j,m}\right)\times o_{j,m}. \tag{40}\]  
In terms of the number of stranded passengers, due to the cross-line backup train, it is necessary to consider whether the train in front of train \(i\) at station \(j\) is the backup train.