## 3 Model for Security Resource Scheduling Based on MHALSTM-MPC
### Model Predictive Control (MPC)  
Model Predictive Control (MPC) is an advanced control strategy that optimizes the performance of a control system by creating a predictive model. The core idea is to use a predictive model to forecast the system's future behavior and, based on this forecast, calculate the optimal control sequence for the upcoming period. In recent years, MPC technology has been widely applied in various fields, and has been used to optimize the control of industrial engineering systems [21; 22; 23] and autonomous vehicles field [24]. Using the forecast outputs from the MHALSTM model, the predicted changes in future passenger flow are directly utilized as inputs for the MPC algorithm, providing data support for resource allocation decisions. The MPC algorithm optimizes the number of security lanes open and staff allocation in the short term based on these inputs, aiming to achieve predetermined operational efficiency and cost objectives. Listed below are the key components of the MPC model:  
Control actions \(u_{t}\) refer to the number of security lanes open at time t, which are the main computational targets of this model. The calculation results of control actions are based on current passenger flow forecasts and other constraints, including passenger queue time, channel adjustment frequency, and the threshold for changes in passenger flow. System State \[x_{t}=f(y_{t-3},y_{t-2},y_{t-1};\theta) \tag{13}\]  
The system state \(x_{t}\) represents the predicted passenger flow at time \(t\), which is obtained from the MHALSTM model based on historical data. It includes the actual passenger flows at times \(t-3\), \(t-2\), and \(t-1\). The model parameters, which include weights and biases, are learned from the training dataset and are used to map input data to predicted passenger flows. The objective function aims to minimize the total number or cost of security lanes open throughout the predicted time frame under the condition that all constraints are met. \[\underset{u_{t}}{min}\sum_{t=1}^{T}C(u_{t}) \tag{14}\]  
where \(C(u_{t})\) represents the cost of opening \(u_{t}\) security channels at time \(t\), and \(T\) is the total length of the forecast period. Constraints  
Passenger queue time constraint:  
\[N=b_{seconds}/a \tag{15}\]  
\[\widetilde{\text{x}_{t}}=\text{x}_{t}\times\text{b}_{\text{seconds}/600} \tag{16}\]  
\[u_{t}\geq\widetilde{x_{t}}/N \tag{17}\]  
where a is the average time required for a person to pass through security (in seconds), \(b_{seconds}\) is the upper limit of passenger queue time (in seconds), \(N\) is the maximum number of passengers that each security lane can check within the specified time, and \(\widetilde{x_{t}}\) is the value of the predicted passenger flow when adjusted according to the maximum queue time, assuming that the passenger flow is evenly distributed within 10 min. The aim of this constraint is to provide a sufficient number of security lanes \(u_{t}\) at each time t so that all predicted passengers can pass through security within a reasonable upper limit of waiting time. Adjustment frequency constraint:  
\[\Delta u_{t}=0,unless\ t-t_{last}\geq\tau \tag{18}\]  
We define the decision variable as follows: \(\Delta u_{t}=u_{t}-u_{t-1}\). This represents the change in the number of security channels between two consecutive time points, where \(t_{last}\) is the time point of the last adjustment in the number of security channels, and \(\tau\) is the minimum allowed adjustment interval. This constraint limits the frequency of adjustments to the number of security channels to prevent confusion and an increase in costs caused due to frequent changes. Passenger flow change threshold constraint:  
\[If\ \frac{\left|x_{t}-x_{t_{last}}\right|}{x_{t_{last}}}<\theta_{change},\ then\ \Delta u_{t}=0 \tag{19}\]  
where \(\theta_{change}\) is the threshold for changes in passenger flow and \(x_{t_{last}}\) is the passenger flow corresponding to the time point \(t_{last}\) of the last adjustment of the number of security channels.