## 2 Related Works  
In this section, we explore existing literature on LoS and resource scheduling in EDs. Our analysis emphasizes how different studies approach performance metrics and crucial operational factors such as nonstationary demand, patient return visits, patient number control, and resource allocation scheduling. A summary of these studies is presented in Table 1, detailing their methodologies and focus areas.  
\begin{table}
\begin{tabular}{l l c c c c} \hline \hline \multirow{2}{*}{**Research**} & \multirow{2}{*}{**Performance Metrics**} & **Nonstationary** & **Patient** & **Patient Number** & **Allocation** \\  & & **Demand** & **Return** & **Control** & **Scheduling** \\ \hline [PERSON] et al. (2006) [23] & Patient’s abandonment ratio & N & N & N & N \\ [PERSON] et al. (2012) [25] & Offered load & Y & N & N & Y \\ [PERSON] et al. (2014) [26] & Service level of patients & N & N & N & Y \\ \hline [PERSON] et al. (2009) [27] & Average patient waiting time & Y & Y & N & N \\ [PERSON] et al. (2020) [28] & Patient waiting time & Y & N & N & N \\ \hline [PERSON] et al. (2020) [29] & Patient waiting time & Y & N & Y & Y \\ [PERSON] et al. (2021) [24] & LoS & Y & N & Y & N \\ \hline \hline \end{tabular}
\end{table}
Table 1: Related Works.  
[PERSON] et al. (2006) [23] examined the patient abandonment ratio without addressing nonstationary demand, patient returns, patient number control, or allocation scheduling. Their study focuses solely on how often patients leave the ED without being seen. [PERSON] et al. (2012) [25] measured the offered load, acknowledging nonstationary demand and incorporating allocation scheduling, but did not consider patient returns or patient number control. [PERSON] et al. (2014) [26] used service level of patients as their performance metric and included allocation scheduling, yet did not account for nonstationary demand, patient returns, or patient number control. [PERSON] et al. (2009) [27] and [PERSON] et al. (2020) [28] both used patient waiting time as their primary performance metric. [PERSON] et al. considered both nonstationary demand and patient returns but did not include allocation scheduling or patient number control, whereas [PERSON] et al. focused only on nonstationary demand without considering other factors. [PERSON] et al. (2020) [29], [PERSON] et al. (2021) [24], and [PERSON] et al. (2023) [31] all assessed patient waiting time, with [PERSON] and [PERSON] including nonstationary demand, patient returns, and allocation scheduling in their methodologies. [PERSON] et al. considered nonstationary demand and patient returns but did not integrate allocation scheduling. [PERSON] et al. (2022) [30] and [PERSON] et al. (2023) [32] analyzed the divergence between the physician's service productivity and patient demands and total patient waiting time, respectively, with both acknowledging nonstationary demand. [PERSON] included allocation scheduling, but [PERSON] did not, and neither study addressed patient returns or patient number control. [PERSON] et al. (2024) [33] focused on patient queue length and was one of the few studies to address all indicators, including nonstationary demand, patient returns, and patient number control, although without incorporating allocation scheduling.  
This comprehensive examination highlights the critical role of advanced scheduling techniques, especially online allocation scheduling, in adapting to fluctuating demands and optimizing resource allocation. Building on these findings, our research aims to address existing gaps by integrating machine learning to enhance responsiveness and operational efficiency in EDs, ultimately reducing LoS across varied demand scenarios.