# Bilateral Matching Decision Model and Calculation of High-Speed Railway Train Crew Members
## 2 Problem Description and Modeling
### Construction of the Train Crew Matching Model
#### 2.2.3 Model Establishment  
In summary, a bilateral matching optimization model (M1) considering stability is established with the objective of minimizing the complete preference order value of both the stewards and chief stewards:  
\[MinZ_{1}=\sum_{i=1}^{m}\sum_{j=1}^{n}\vec{r}_{ij}^{q}x_{ij}^{q} \tag{1}\]  
\[MinZ_{2}=\sum_{i=1}^{m}\sum_{j=1}^{n}\vec{s}_{ij}^{q}x_{ij}^{q} \tag{2}\]  
Figure 3: One-to-one two-sided matching between virtual chief stewards and stewards. Figure 2: Matching transformation diagram. s.t. \[\sum_{i=1}^{m}x_{ij}^{q}\leq 1\ \ \ j\in N,q\in\{1,2,\ldots,c_{j}\} \tag{3}\]  
\[\sum_{j=1}^{n}x_{ij}^{q}\leq 1\ \ i\in M,q\in\{1,2,\ldots,c_{j}\} \tag{4}\]  
\[x_{ij}^{q}\in\{0,1\}\ \ \ i\in M,j\in N,q\in\{1,2,\ldots,c_{j}\} \tag{5}\]  
In the model M1: Equations (1) and (2) are the objective functions; Equation (3) indicates that each steward can only be matched with one virtual chief steward; Equation (4) indicates that each virtual chief steward can only be matched with one steward; and Equation (5) defines the range of decision variables. This model is a multi-objective integer optimization model where the objective functions have non-negative characteristics, and the two objective functions share the same dimensions. Therefore, a linear weighting method is used to linearly weight the two objectives, resulting in a single objective function. The model is then converted into a single-objective optimization model (M2) for computation. The expression for mathematical model M2 is:  
\[MinZ=\alpha_{1}\sum_{i=1}^{m}\sum_{j=1}^{n}\overline{r}_{ij}^{q}x_{ij}^{q}+ \alpha_{2}\sum_{i=1}^{m}\sum_{j=1}^{n}\widehat{s}_{ij}^{q}x_{ij}^{q} \tag{6}\]  
s.t. \[\sum_{i=1}^{m}x_{ij}^{q}\leq 1\ \ j\in N,q\in\{1,2,\ldots,c_{j}\} \tag{7}\]  
\[\sum_{j=1}^{n}x_{ij}^{q}\leq 1\ \ i\in M,q\in\{1,2,\ldots,c_{j}\} \tag{8}\]  
\[MinZ_{2}=\sum_{i=1}^{m}\sum_{j=1}^{n}\vec{s}_{ij}^{q}x_{ij}^{q} \tag{2}\]0  
Refer to the above model (6)-(9) as M2, which is a single-objective integer optimization model. Specialized optimization software such as Cplex, Lingo, and Gurobi can be used to obtain the exact solution of this mathematical model. In practical work, it is usually considered that the positions of stewards and chief stewards are equally important in the matching process. Therefore, during the solving process, this equality can be assumed. In this study, the problem was solved using Python programming language on a Windows 10 system with an Intel i7-1165G7 processor, utilizing the Gurobi optimization solver. Assuming a passenger line has 4 chief stewards and 12 stewards, each chief steward \(B_{j}\) evaluates the stewards \(A_{i}\) based on their own preferences, work abilities, and other indicators, resulting in a preference order vector \(s_{ij}\), as shown in \[MinZ_{2}=\sum_{i=1}^{m}\sum_{j=1}^{n}\vec{s}_{ij}^{q}x_{ij}^{q} \tag{2}\]1  
Steward \(A_{i}\), based on their own preferences and management abilities, comprehensively evaluates chief steward \(B_{j}\), resulting in a preference order vector \(r_{ij}\), as shown in \[MinZ_{2}=\sum_{i=1}^{m}\sum_{j=1}^{n}\vec{s}_{ij}^{q}x_{ij}^{q} \tag{2}\]2 \begin{table}
\begin{tabular}{c c c c c c c c c c c c c} \hline  & \(A_{1}\) & \(A_{2}\) & \(A_{3}\) & \(A_{4}\) & \(A_{5}\) & \(A_{6}\) & \(A_{7}\) & \(A_{8}\) & \(A_{9}\) & \(A_{10}\) & \(A_{11}\) & \(A_{12}\) \\ \hline \(B_{1}\) & 9 & 5 & 8 & 11 & 2 & 10 & 4 & 3 & 12 & 7 & 1 & 6 \\ \(B_{2}\) & 8 & 1 & 2 & 12 & 9 & 5 & 6 & 11 & 3 & 4 & 10 & 7 \\ \(B_{3}\) & 12 & 6 & 7 & 5 & 1 & 8 & 11 & 10 & 4 & 2 & 9 & 3 \\ \(B_{4}\) & 12 & 6 & 3 & 5 & 9 & 8 & 1 & 2 & 4 & 10 & 7 & 11 \\ \hline \end{tabular}
\end{table} 
Table 2: The complete preference order of the chief stewards to stewards. The one-to-many bilateral matching process between the chief steward and the stewards can be described as follows: First, according to the equations, the problem is transformed into a one-to-one bilateral matching problem.