\documentclass[twocolumn,12pt]{article}\usepackage[utf8]{inputenc} % 处理 UTF-8\usepackage{amsmath,amssymb} % 数学公式支持\usepackage{graphicx} % 插入图片\usepackage[colorlinks=true, allcolors=blue]{hyperref} % 链接\usepackage{geometry} % 页边距\usepackage{setspace} % 行距\usepackage{titlesec} % 标题格式更灵活\usepackage{fontspec}\setmainfont{Times New Roman}\usepackage{xeCJK}\doublespacing\usepackage[margin=1in]{geometry}\raggedright\usepackage{indentfirst}\setlength{\parindent}{1.27cm}\usepackage{fancyhdr}\pagestyle{fancy}\fancyhf{}\fancyhead[R]{\thepage} % 右上角姓+页码\usepackage{float}\usepackage{caption} % (导言区加,只要加一次)\usepackage{booktabs} % 在导言区加这个\usepackage{stfloats}\titleformat{\section} % 修改 \section 的格式 {\normalfont\bfseries} % 正常字体大小 + 加粗 {} % 没有编号 {0pt} % 编号后间距(无编号所以无所谓) {} % 标题内容之前无附加内容% 页面设置\geometry{ a4paper, left=2.45cm, right=2.45cm, top=2.45cm, bottom=2.45cm}% 为了贴近 Markdown 层级,这里稍作标题设置\titleformat{\section}{\large\bfseries}{\thesection.}{0.5em}{}\titleformat{\subsection}{\normalsize\bfseries}{\thesubsection.}{0.5em}{}\titleformat{\subsubsection}{\normalsize\bfseries}{\thesubsubsection.}{0.5em}{}\title{To what extent can queueing theory and behavioral simulations be used to reduce perceived crowding in school cafeteria environments?}\author{Alan Yu}\date{\today}\begin{document}\maketitle% 您的内容从此开始% ==============================% 原始 Markdown 第一行: # ***[Over crowding + ]***% 原始 Markdown 里的 “### Abstract” -> \section\section*{\textbf{Abstract}}\section{\textbf{Introduction}}In my own experience, I often had to spend over fifteen minutes in line, only to wait for food. This personal frustration led me to question whether these delays were simply due to high demand or rooted in deeper systemic inefficiencies. Long queue times and overcrowding in school cafeterias are known to be serious problems facing students. This issue has been well documented in previous studies that have emphasized the impact of poorly designed cafeterias on student satisfaction, waiting times, and the overall dining experience. Surveys conducted at our school have shown that many students are dissatisfied with the current cafeteria setup, citing overcrowding and long wait times as major annoyances. However, no one has fully explored why these issues persist after years of improvement or how specific factors - such as cafeteria layout, queuing systems, and crowding during peak hours - contribute to the problem. If we can identify the root causes of inefficient cafeteria operations, we can not only improve the dining experience, but also optimize space usage and human resources. This study aims to investigate the root causes of cafeteria crowding by analyzing queue dynamics, conducting simulations, and exploring potential improvements. By identifying and addressing these issues, I hope to reduce waiting times, increase student satisfaction, and improve overall operational efficiency. Even now, many students joke that eating lunch is a 'survival game', reflecting how ingrained this problem has become in daily school life.First, we break down the students' 'dissatisfaction' into two main areas. Firstly, the long waiting time consumes their patience, which is totally unnecessary. Second, the crowded cafeteria makes it difficult for them to move around. In this paper, we will analyze these two problems separately and look for potential solutions. To understand the mechanisms behind these inefficiencies, it is essential to examine existing theoretical frameworks and studies related to queueing behavior and cafeteria management. One of the most widely used approaches in this area is queuing theory, which provides mathematical tools to analyze waiting lines and service dynamics.\section{\textbf{Literature Review}}Queuing theory, a subfield of operations research, focuses on analyzing and optimizing systems where entities wait in line for service. The foundational models—such as M/M/1, M/M/c, and M/D/1—have been widely adopted to understand arrival patterns, service rates, and queue dynamics under probabilistic assumptions (Kambli et al. 64). These models are defined by Kendall’s notation, where 'M' refers to Markovian (Poisson) arrival and/or service times, and the number indicates the quantity of parallel servers (Ajiboye and Saminu 304). Little’s Law, a fundamental result in queueing theory, relates average wait time to arrival rate and system capacity (Tang et al. 30). In the context of campus cafeterias, queueing theory has been extensively employed to address issues of student congestion during lunch hours, which are particularly pronounced due to synchronized class schedules (Zuo 183). The application of models such as M/M/n/m has shown practical potential in optimizing the number of open windows and reducing average waiting time by reallocating resources during peak demand (Chen and Wang 42). Simulation studies demonstrate that queue optimization can reduce waiting times by nearly 45\% (Ye 76). Another study using a multi-stage queue model reduced average customer dwell time from over 500 minutes to under 15 minutes by redesigning queue architecture and service logic (Ajiboye and Saminu 309). Despite these successes, classical queueing models exhibit limitations when applied to real-world cafeteria environments. Most models assume steady-state behavior, homogenous service stations, and exponentially distributed arrival and service times, which rarely match the fluctuating and clustered nature of student behavior (Lu et al. 202). Furthermore, traditional models fail to account for human behavioral dynamics, such as balking, reneging, or jockeying—where students leave or switch queues due to perceived delays (Chen and Wang 44). Extensions to these models have attempted to incorporate dynamic arrival rates and customer patience thresholds (Li and Saminu 893). Moreover, complex queue networks involving multiple food stations and checkout counters require simulation or agent-based modeling, as closed-form analytical solutions are infeasible (Kambli et al. 65; Deng et al. 62).Therefore, while queueing theory provides a strong theoretical framework for diagnosing and improving campus cafeteria service systems, its practical application necessitates integration with behavioral insights, discrete-event simulation, and data-driven modeling tools to adapt to modern high school or university environments. Future research should also focus on combining real-time data collection technologies with adaptive queue control algorithms to ensure continuous optimization and student satisfaction.This methodology was selected because it enables the formulation of a structured, quantitative framework to address crowding issues through measurable parameters such as arrival rate, service rate, and wait time. Unlike anecdotal or observational methods, queueing theory allows for reproducible simulation and modeling, which can be validated and iteratively refined. Additionally, it provides a scalable structure to simulate various design interventions—such as staggered schedules or reallocation of service counters—without disrupting actual cafeteria operations. Given the dynamic and high-density nature of student lunch periods, this approach offers a pragmatic balance between analytical rigor and real-world applicability.\subsection{Research Gap}经典的排队论模型是一个静态模型,只能够模拟一些变量不随时间变化的情景。而对于动态的变量,比如随着时间变化的到达率,还没有一个合适的理论模型来描述。本研究尝试将午餐时段分为无数个时间段,分别对它们应用静态排队论模型,以此来得到变化的输出。% GAP 对于特定时间,而不是持续时间\begin{figure} \centering \includegraphics[width=0.5\linewidth]{WechatIMG39.jpg} \caption{Layout of school cafeteria} \label{fig:enter-label}\end{figure}\section{Data Collection}\subsection{Observation}The data for this study came from field observations in our school's cafeteria, and data were collected from December 2 to December 5, 2024, and December 9 to December 12, 2024 (8 days in total). Data collection under each schedule lasted for four days due to the school's schedule of one cycle every two days. The data primarily covered the third and fourth periods which are lunch periods, and the peak hours. Specifically, it includes the number of students entering/leaving the cafeteria during each period, the service time of each window, and the number of windows.Data collection was performed through the cafeteria's monitoring system during the daytime hours, which recorded the timestamp of each student's entry into the cafeteria. The specific time period for data collection was from 11:50 to 13:35 each day. During this time period, the number of students entering the cafeteria was recorded by manual count, and the service time of each service window was recorded by simple observations. The mean value of the window service time is the average value obtained by several manual timings.\subsection{Data pre-processing}During the data cleaning process, all the collected data met the preset criteria, so no data was eliminated. During the data preprocessing stage, timestamps were converted to relative times with respect to peak hours and grouped for counting at 2-minute intervals during peak hours. For off-peak hours, group counts were performed at 5-minute intervals.\subsection*{Total Population}We get the average Entries and Exits ($E_t$ and $L_t$) by simply adding them together and divided by the number of days. Notice that our school's cafeteria has 2 entrances (marked as A and B here). \\So for each time interval t,\begin{align*}\text{Enter}_{\text{Total}} &=\frac{\sum_{i=1}^{8} \text{Enter A}_{\text{Day}i}}{8} \\&\ + \frac{\sum_{i=1}^{8} \text{Enter B}_{\text{Day}i}}{8}\end{align*}It is the same way to calculate ${\text{Leave}_{\text{Total}}}$.\subsection{Data characterization}According to Figure 2, the results of the data analysis showed that the arrival time of students to the cafeteria showed obvious peak characteristics, especially between 11:50 and 12:10 (0 min - 20 min), when an average of about 20 people entered the cafeteria per minute, while the number of arrivals decreased significantly at other times.\begin{figure} \centering \includegraphics[width=1\linewidth]{EnterLeave6.jpg} \caption{Average Enter vs Leave Counts} \label{fig:enter-label}\end{figure}\begin{figure} \centering \includegraphics[width=1\linewidth]{net_population_final_uniformed.png} \caption{Average Net Population} \label{fig:enter-label}\end{figure}We can also graph the net population in the cafeteria. According to Figure 3, similarly, there are particularly large numbers of students at the starts of the 2 launch periods, and then the numbers drop off over time.\section*{Data Processing}Once the data collection was complete we next used the data to calculate the student arrival rate, which is a variable that changes over time during every lunch time.\begin{table*}[htbp]\centering\begin{tabular}{l p{9cm} l}\toprule\textbf{Symbol} & \textbf{Description} & \textbf{Unit} \\\midrule$E_t$ & Total number of individuals entering the location during interval $t$ & Count \\$L_t$ & Total number of individuals leaving the location during interval $t$ & Count \\$p(t)$ & Probability that an entering individual seeks service & Fraction \\$r$ & Probability that a service seeker stays after service & Fraction \\$S_t$ & Number of individuals arriving for service during interval $t$ & Count \\$\lambda(t)$ & Average arrival rate of customers during interval $t$ & People/s \\\bottomrule\end{tabular}\caption{Definitions of variables used in the crowd flow model.}\label{tab:flow-symbols}\end{table*}\subsection*{Number of Service Seekers Arriving During Interval t ($S_t$)}Then we consider the following factors. We know that not all of the students who enter the cafeteria will have any food, and that some may only stay for a short time before leaving (e.g., using the cafeteria as a hallway just to walk through it). In addition to this, since our school has an outdoor dining area. It has the same capacity as an indoor cafeteria. Some people order their lunch and go straightly to the outdoor dining area, while others stay indoors to eat their lunch. We will mainly focus on those students who stay indoors.According to Table 1, we have a fraction $p$ of entrants seek service, where the others leave immediately. After services, some service seekers leave immediately as well, and some stay after service. The fraction $r$ of service seekers stay in the area. However, $r$ does not vary roughly with the time in a day because people will always look for uncrowded locations. In this case we suggests that they prefer to stay indoors when it is crowded outdoors, and they prefer to go outside when it is crowded indoors. But it has been observed that it increases significantly during the cold season, when people are reluctant to have lunch outdoors where it is colder. So in winter it usually gets more crowded indoors.\subsection*{Arrival rate estimation}在这里我们假设最简单的“理想人”流转路径,根据Figure 4,故我们假设只有两种情况:\begin{enumerate} \item 进门后,\textbf{不买饭}的部分(占比 $1-p(t)$)立即离开(几乎忽略在场时间); \item 进门后,\textbf{去买饭}的部分(占比 $p(t) \times r$),在食堂会停留一段时间再离开; 这段时间包含了服务时间 $T$,以及在堂食区停留时间 $D$ 。若有比例 $r$ 会堂食,则总“滞留”时间写为 \[ \tau_{net} \approx T + rD. \tag{1} \]\end{enumerate}\begin{figure}[H] \centering \includegraphics[width=0.8\linewidth]{StudentWay.png} \caption{Enter Caption} \label{fig:enter-label}\end{figure}由于我们只有外部数据(某时间段 t 的进入速率 $E_t$ 与离开速率 $L_t$),无法获得某个时间段想要服务的人数。因此我们设立若干种情况 —— 买饭且在食堂食用的那部分人,约在 $\tau_1$ 秒后离开;买饭且准备离开的那部分人,约在 $\tau_2$ 秒之后才出现在离开队伍里;而\textbf{不买饭}的那部分人几乎瞬时进、瞬时出。由此可以写出一个“\textbf{带延迟的简化守恒}”关系式(2)。\begin{figure*}[!t]\[L_t \;\approx\; \underbrace{\bigl(1 - p(t)\bigr)\times E_t}_{\text{当下进门马上离开}} \;+\; \underbrace{r \times p(t-\tau_1)\times E_{t-\tau_1}}_{\text{先前时刻吃完饭的那批人, 现在离开}} \;+\; \underbrace{(1 - r) \times S_{t - \tau_2}}_{\text{先前时刻买饭的那批人, 现在离开}}. \tag{2}\]\end{figure*}但在实际情况下, $p(t)$ 变化不那么快。在先前的观测中,随着时间的推移,穿过食堂的人数比例只会略微下降。于是可以把 $p(t - \tau_1)\approx p(t)$。这样就得到:\[L(t) \;\approx\; \bigl(1 - p(t)\bigr)\,E_t \;+\; p(t)\,E_{t - \tau_1} \;+\; r \, S_{t - \tau_2}.\]将这条式子整理一下,并将 $S_{t - \tau_2}$ 替换为 $p(t)E_{t - \tau_2}$:\[\begin{aligned} L_t &= E_t \;-\; p(t)E_t \;+\; p(t)E_{t - \tau_1} \;+\; r \, p(t)E_{t - \tau_2}\\&= E_t \;+\; p(t)\,\Bigl[E_{t - \tau_1}\;-\;E_t \;+\; r \, E_{t - \tau_2} \Bigr]. \\\end{aligned}\]因此,可以粗略地解出\[p(t) \;\approx\; \dfrac{\,L_t \;-\; E_t}{\, E_{t - \tau_1} \;-\; E_t \;+\; rE_{t - \tau_2} \,}.\tag{3}\]再次根据等式(1)的近似,我们将 $\tau_1$ 和 $\tau_2$ 合并为 $\tau_{net}$\[\boxed{ p(t) \;\approx\; \dfrac{\,L_t \;-\; E_t}{\, E_{t - \tau_{net}} \;-\; E_t \,} }.\tag{4}\]我们根据 $p(t) = \frac{S_t}{E_t}$ 得到\[\frac{S_t}{E_t} \approx \dfrac{\,L_t \;-\; E_t}{\, E_{t - \tau_{net}} \;-\; E_t \,}.\]根据研究所示,高中生平均用餐时间为20分钟,所以我们计算\[\tau_{net} \approx 20r + T.\]对于 $r$ 我们直接使用室内外座椅数量估计。人们总是会前往座位空闲的地方,\[r = \frac{N_{indoor}}{N_{outdoor} + N_{indoor}} \approx \frac{47}{59 + 47} \approx 0.443.\]最后我们将 $S$ 除以 $t$ 得出顾客到达率\[\bar{\lambda_t} = \frac{S_t}{t_{\text{period}}}.\]\vspace{-\baselineskip}\begin{figure}[H] \centering \includegraphics[width=1\linewidth]{lambda.png} \caption{Arrival rate (λ) & Standard Deviation (σ)} \label{fig:enter-label}\end{figure}\vspace{-1\baselineskip}得出的数据如Figure 5所示。我们首先使用多天平均的数据 $E$ 和 $L$ 计算出平均顾客到达率 $\lambda_{\text{average}}$。在此之后我们分别计算每一天的数据的 $\lambda$ ,并且将其与 $\lambda_{\text{average}}$ 做差,得出标准差 $\sigma$。\[\sigma_t = \sqrt{\frac{1}{n-1} \sum_{i=1}^n \left(\lambda_{t,i} - \bar{\lambda_t}\right)^2}\]对于这类数据我们将它近似为正态分布,也就是\[X_t \sim \mathcal{N}(\lambda(t), \sigma(t)), \quad \forall t \in [0,6300].\]\subsection{平滑样条函数拟合(Smoothing Spline Fitting)}为构建一个时间连续变化的平均到达间隔时间函数 $\mu(t)$ 以及其标准差函数 $\sigma(t)$,本文采用了\textbf{平滑样条拟合}(Smoothing Spline Fitting)方法。该方法基于一组离散时间点 $\{t_i\}_{i=1}^n$ 与对应的观测值 $\{y_i\}_{i=1}^n$,通过在最小化数据残差的同时控制函数弯曲程度,从而拟合出一个光滑连续的函数 $f(t)$。其数学表达为以下优化问题:\[\min_{f \in C^2} \left\{ \sum_{i=1}^n \left( y_i - f(t_i) \right)^2 + \lambda \int_{a}^{b} \left( f''(t) \right)^2 \, dt \right\}.\]其中:\begin{itemize} \item $y_i$ 表示第 $i$ 个时间段中计算得到的目标值; \item $f(t)$ 是待拟合的连续函数; \item $\lambda$ 是平滑因子(smoothing factor),控制拟合精度与平滑程度之间的权衡,当 $\lambda = 0$ 时,拟合函数严格通过所有点(即插值);当 $\lambda \to \infty$ 时,拟合函数趋于线性;\end{itemize}本研究中,我们使用 python 中的\texttt{UnivariateSpline} 方法对 $\mu(t)$ 和 $\sigma(t)$ 进行拟合。该函数基于三次样条(cubic spline)构建,并自动进行节点选择与最优拟合。\[\mu(t) \approx \sum_{i=0}^{n} c_i B_i(t).\]最终得到的函数 $f(t)$ 可在任意时间点 $t$ 上进行评估,生成连续的时间-间隔函数 $\mu(t)$ 及标准差函数 $\sigma(t)$,用于描述 $G(t)/M/c$ 模型中顾客的动态到达分布。将离散变量拟合成连续变量可以更好地拟合随时间变化的到达率,提高对于动态排队过程的预测精度。\section{Service Time Data}对于服务率数据,我们调取服务窗口旁的监控并且记录了100条服务时常数据,见Figure 6。\begin{figure}[H] \centering % 占位图示例,请替换为真实图片文件 \includegraphics[width=1\linewidth]{snapshot-1744736997962@2x.png} \caption{Service Time (1/λ)} \label{fig:servicetime}\end{figure}\begin{table} \centering \caption{Service Time Data} \begin{tabular}{lcc} \toprule \textbf{Variable} & \textbf{Value} \\ \midrule Sample size & 100 \\ mean & 32.378 \\ std & 20.478926 \\ $\lambda$ & 0.030885 \\ D & 0.3510 \\ Pval & 0.1045 \\ \bottomrule \end{tabular}\end{table}我们使用 K-S (Kolmogorov-Smirnov) 检验来检测此数据是否能够近似为某个分布。我们首先检测指数分布。K-S 检验表明,对 100 个观测服务时间进行指数分布拟合,平均服务率为 $\lambda \approx 0.030885$(即平均每 32.378 秒服务一人)。根据 Table 2, K-S检验得到 $p$ 值为 0.1045,大于显著性水平 $\alpha$,说明无法拒绝服务时间服从指数分布的原假设,因此可以合理建模为 $G/M/c$ 排队模型。\begin{table*}[b] \centering \caption{Variables in the model} \begin{tabular}{llc} \toprule \textbf{Symbol} & \textbf{Explanation} & \textbf{Unit} \\ \midrule $\lambda(t)$ & Average arrival rate of customers & people/s \\ $\mu$ & Average service rate of a single service window & services/s \\ $c$ & Number of service windows & Number \\ $\rho(t)$ & System utilization rate & / \\ $C_a(t)$ & Coefficient of variation & / \\ $W_q(t)$ & Mean waiting time & s \\ $L_q(t)$ & Average number of people in the queue & Number \\ $P_0(t)$ & Probability that the system is empty & / \\ \bottomrule \end{tabular}\end{table*}\section{Model Establishment}基于前文对数据的检验,我们认为到达率符合正态分布且服务率符合指数分布(即服务过程是无记忆性的)。故选用$G(t)/M/c$进行描述.\subsection{基本参数}根据 Table 3, 其中系统稳定系数\[\rho(t) = \frac{\lambda(t)}{c\mu}, \quad \rho < 1 \text{(系统稳定条件)}.\tag{5}\]到达时间分布的变异系数 $C_a(t)$\[C_a(t) = \frac{\sigma_a(t)}{1/\lambda(t)},\tag{6}\]其中 $\sigma_a$ 为前文计算的到达率的标准差。我们使用 $C_a$(到达时间的变异系数)来修正 $M/M/c$ 公式,即可得到 $G/M/c$ 的结果。\subsection{模型计算}使用 Pollaczek-Khinchin (P-K) 公式的推广形式,可得队列平均等待时间\[W_q = \frac{C_a^2 + 1}{2} \cdot W_{q, M/M/c},\tag{7}\]其中 $W_{q, M/M/c}$ 是 $M/M/c$ 模型下的平均等待时间:\[W_{q, M/M/c} = \frac{L_{q, M/M/c}}{\lambda}.\tag{8}\]平均队列人数 $L_q$:\[L_q = \frac{C_a^2 + 1}{2} \cdot L_{q, M/M/c}.\tag{9}\]而 $L_{q, M/M/c}$(平均排队人数)可以由 Erlang-C 公式给出:\[L_{q, M/M/c} = \frac{P_0 \cdot \frac{(\lambda / \mu)^c}{c!} \cdot \frac{c \rho}{(1 - \rho)^2}} {\left( \sum_{k=0}^{c-1} \frac{(\lambda / \mu)^k}{k! } \right) + \frac{(\lambda / \mu)^c}{c!} \cdot \frac{1}{1 - \rho}}.\tag{10}\]系统空闲概率 $P_0$:\[P_0 = \left( \sum_{k=0}^{c-1} \frac{(\lambda / \mu)^k}{k!} + \frac{(\lambda / \mu)^c}{c!} \cdot \frac{1}{1 - \rho} \right)^{-1}.\tag{11}\]最后得出系统平均等待时间 $W$、系统平均人数 $L$\[W = W_q + \frac{1}{\mu}, \quadL = L_q + \frac{\lambda}{\mu}.\tag{12}\]我们将这些输出变量绘制成图像\begin{figure}[H] \centering \includegraphics[width=1\linewidth]{RHO2.png} \caption{System Stability During Peak Hour} \label{fig:enter-label}\end{figure}\begin{figure} \centering \includegraphics[width=1\linewidth]{AVG Result.png} \caption{Model Result (W and L)} \label{fig:enter-label}\end{figure}\subsection{模型输出}可以发现,在高峰时间段 (前5分钟),学生到达率超过了服务率,也就导致了服务永远不可能完成。这种情况下系统是混乱的,并且在这些瞬间的等待人数、等待时间会无限增长,没有稳定状态。从上文的公式中我们了解到系统稳定的条件是\[\frac{\lambda}{c\mu} < 1, \quad \text{或} \quad \lambda < c\mu.\]所以在本研究收集到的数据中,想要让系统保持稳定,到达率需要控制在以下区间内\[\lambda < 3 \times 0.030885 \quad \Rightarrow \quad \lambda < 0.09.\]除此之外,由于食堂区域的布局限制,窗口最多仅能开放四个。并且服务过程中的交流也会显著延长服务时间,导致服务率降低。我们在此假设一个理想的服务时间,即控制平均服务时间在25s。那么我们依然需要控制到达率\[\lambda < 4 \times 0.04 \quad \Rightarrow \quad \lambda < 0.16.\]因此,给出的初步解决方案如下。由于冬季 $r$ 会上升,我们需要允许更多学生滞留在食堂。于是针对不同季节,冬天需要限制人流到 0.12,夏天需要限制到 0.14。如 Figure 9 所示,如果我们将人流限制在0.12以下,其最长平均等待时间大约在50s左右,已经处于一个非常良好的范围了。\begin{figure}[H] \centering \includegraphics[width=1\linewidth]{Optimized WL.png} \caption{Optimized Result (W and L)} \label{fig:enter-label}\end{figure}\section{优化策略与动态仿真}为缓解当前的问题,我们基于 $G(t)/M/c$ 模型分析结果,提出如下优化策略:\begin{itemize} \item 在 0--600 秒期间,系统负载率 $\rho$ 显著上升,超过 1,服务能力过饱和。建议\textbf{增加 1 个窗口},并通过\textbf{培训服务员将平均装餐时间缩短至 25s},以在高峰时段减少排队长度。 \item 进行\textbf{限流}措施,每 2 分钟放行 12--14 人,时间集中在前 10 分钟。\end{itemize}为确定限流最有效的位置,本研究使用动态仿真模拟中午就餐过程。\begin{figure}[H] \centering \includegraphics[width=0.45\textwidth]{Pasted image 20250415232238.png} \caption{动态模拟示意图} \label{fig:dynamic}\end{figure}我们根据食堂的平面图设定各个元素。根据 Figure 10,橙色部部分为墙壁,即行人无法通过的部分。这里椅子中间的间距很窄,我们假设行人无法通过桌椅中间的位置。最顶上左侧的绿色线段和底部最左侧的绿色线段为两个出入口位置。绿色箭头则为排队方向,绿色圆点则为窗口位置。左侧还有一块绿色阴影为通道。随后我们在AnyLogic中建模,将先前计算的到达率函数和服务率函数输入进去,并根据比例 $P(t)$ 和 $r$ 界定一个人的行为。当一个人进入室内位置就餐后或离开食堂则判定结束,即删除这个个体。\subsection{热力图分析(KDE)}\begin{figure}[H] \centering \includegraphics[width=0.45\textwidth]{myplot 1.png} \caption{第 200 秒模拟的热力图} \label{fig:kde}\end{figure}热力图基于核密度估计(KDE)得到,其数值并不代表绝对人数,而是单位面积附近的人流密度。若某些区域出现超过 4 的 KDE 值,说明此区域人群极度集中,需要进一步的空间或排队管理措施。此值还会受带宽参数影响,带宽越小对局部拥挤越敏感。通过 Figure 11 我们可以发现人流密集区域基本集中在靠近窗口的一部分,而走廊的密度相对较少。因此,我们可以在所有窗口的最左侧,也就是学生们进入窗口排队的必经之路处,派遣一名老师或者学生志愿者来控制人流。具体操作可以是每2分钟放行12 - 14人,持续10分钟,也就是放行5次。\section{Discussion}综上所述,优化策略验证表明,增加一条服务窗口并将平均装餐时间压缩至 25 秒,可在高峰期显著降低等待时间;配合窗口边的限流措施(每两分钟仅放行 12–14 人),能够有效控制高峰人流突然涌入,从而将系统负载率 $\rho$ 控制在 0.8–0.9 的安全区间内,使平均等待时间大致维持在 50 秒以内。此外,AnyLogic 动态仿真与热力图分析进一步揭示,排队区域比通道中最容易出现高密度聚集,针对性布置限流控制,可有效地降低拥挤感受。在与已有研究的异同方面,本文的动态排队建模思路在实际应用中较为少见;大多数研究依赖稳态模型进行优化,而本文尝试使用动态 $G(t)/M/c$,并结合平滑样条函数对服务率进行非参数估计,使模型更贴近实际。然而,在模型设计与数据处理过程中,仍存在一定的误差来源与局限性,值得进一步探讨。首先,观察数据样本仅覆盖 8 天,且忽略了节假日、特殊活动等情形的影响;其次,对学生行为的刻画较为简化,仅考虑了“买饭”“不买饭”及室内外偏好,未纳入换队(jockeying)、离队(reneging)等更复杂行为。此外,研究并未对“感知拥挤”与“实际拥挤”之间的心理学差异进行深入探讨,这对于提升学生用餐体验至关重要。另外需要注意的是,基于时间变化的排队模型容易忽视顾客在系统中的“累积效应”,可能低估排队长度或高峰延迟。除此之外还有其他误差来源,包括对到达过程的近似、服务时间分布的简化,以及人工观察记录中的偏差。特别的,即使本研究中服务时间通过 K-S 检验基本符合指数分布,高峰时段出现的多任务或顾客犹豫等行为可能导致实际服务过程的偏离。未来工作或研究可在以下几方面展开:一是扩大样本量,收集至少30天的数据来提升结果精度;二是结合问卷或生理指标等方式,量化学生在不同布局与排队策略下的“感知拥挤”水平;三是将模型推广至多种学校类型(初中、高中、大学)与不同规模的食堂环境,以评估其通用性。\section{Conclusion}本研究验证了排队论与行为仿真在缓解食堂拥挤问题上的有效性,并提出一种使用动态数据建立动态模型的思路描述变化的场景。本研究基于多日实地数据与 $G(t)/M/c$ 模型,定量揭示了午餐高峰期因到达率超出服务能力而导致的系统失稳,并通过增设窗口、缩短装餐时间及限流策略,将平均等待时间有效降低至50秒以内。这为后续在实际校园环境中落地实施提供了量化依据及技术路线。AnyLogic 动态仿真与热力图分析进一步确定了最佳限流位置。尽管样本时段与行为模型尚有简化,研究成果已为校园食堂管理者在调控方面提供了明确的量化依据。未来可扩展模型通用性并进一步提升人流管理水平。同时在理论与应用层面,本研究也为其他类似的学校食堂乃至公共服务场景提供了一种较为可行的排队系统分析思路。\section{参考文献(Works Cited)}\begin{enumerate}\item Ajiboye, Adegoke S., and Kayode A. Saminu. “A Multi-Stage Queue Approach to Solving Customer Congestion Problem in a Restaurant.” \textit{Open Journal of Statistics}, vol. 8, no. 2, 2018, pp. 302–316.\item Chen, Jinyang, and Hongbo Wang. “Optimization of University Cafeteria Using a Hybrid Queueing Model.” \textit{Journal of Huangshi Institute of Technology}, vol. 27, no. 3, 2011, pp. 41–44.\item Deng, Shounian, et al. “Queueing System Simulation Based on MATLAB for Multi-Server Models.” \textit{Journal of Anqing Teachers College (Natural Science Edition)}, vol. 17, no. 3, 2011, pp. 61–63.\item Kambli, Ashish, et al. “Improving Campus Dining Operations Using Capacity and Queue Management: A Simulation-Based Case Study.” \textit{Journal of Hospitality and Tourism Management}, vol. 43, 2020, pp. 62–70.\item Li, Yuguang. “Simulation of Queueing Problems Based on MATLAB.” \textit{Journal of Wuhan University of Technology (Information \& Management Edition)}, vol. 32, no. 6, 2010, pp. 892–896.\item Lu, Yiqiang, et al. “Stochastic Simulation of Parallel Queue Systems.” \textit{Mathematics in Practice and Theory}, vol. 51, no. 4, 2021, pp. 200–206.\item Tang, Tie-Qiao, et al. “Statistical Analysis and Modeling of Pedestrian Flow in University Canteen during Peak Period.” \textit{Physica A: Statistical Mechanics and Its Applications}, vol. 521, 2019, pp. 29–40.\item Ye, Z. “Application of M/M/C Queueing Model in Hairdressing Service.” \textit{Journal of Chongqing Normal University}, vol. 26, no. 2, 2009, pp. 75–78.\item Zuo, Boyi. “Analysis and Optimization of Noodle Queue Efficiency in College Canteens.” \textit{Value Engineering}, vol. 39, no. 32, 2020, pp. 183–184.\item Li, Longyue, et al. “Performance Analysis and Optimal Allocation of Layered Defense M/M/N Queueing Systems.” \textit{Mathematical Problems in Engineering}, 2016, pp. 1–21.\end{enumerate}\end{document}