Files
mcm-26-b/docs/paper/sections/timing.tex
T
2026-09-13 18:05:59 +08:00

62 lines
3.1 KiB
TeX
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
\section{计时模型与会话状态机}
\begin{figure}[htbp]
\centering
\includegraphics[width=0.92\linewidth]{steps-state-machine.png}
\caption{会话状态机。进入后经 $5$ s 倒计时接口开放,主动退出或断连后进入关闭状态。}
\label{fig:statemachine}
\end{figure}
\subsection{动作耗时与累计虚拟时间}
题面将全部动作折算为虚拟耗时,见表~\ref{tab:actioncost}。
检测无论返回无信号、近距离还是示向度,均计 $5$ s;
清除成功计 $5$ s,其中光学定位 $3$ s、激光清除 $2$ s,
未命中目标时只支付光学检查的 $3$ s。
移动与换频没有独立指令,由相邻动作的位置与频道变化推断。
\begin{table}[htbp]
\centering\small
\caption{动作耗时规则。移动耗时等于直线距离除以 $5$ m/s。}
\begin{tabularx}{\linewidth}{l l l X}
\toprule
动作 & 指令 & 虚拟耗时/s & 说明\\
\midrule
进入 & \texttt{/enter} & 0 & 初始位置 $(0,0)$、初始频道 $1$\\
检测 & \texttt{/measure} & $5+$移动$+$换频 & 三种检测结果耗时相同\\
清除 & \texttt{/clear} & $5+$移动/$3+$移动 & 成功/未命中目标,均不切换测向频道\\
退出 & \texttt{/exit} & 0 & 路径终点自由,无需返回原点\\
换频 & 由检测推断 & 1 & 相邻 \texttt{/measure} 的频道变化\\
移动 & 由动作推断 & 距离$/5$ & 相邻动作的位置变化\\
\bottomrule
\end{tabularx}
\label{tab:actioncost}
\end{table}
设整个会话的移动距离为 $L$,检测、换频、成功清除与失败清除的次数分别为
$N_m,N_s,N_c^+,N_c^-$。忽略每段移动时间的微秒量化时,总虚拟耗时为
\begin{equation}
T=\frac{L}{5}+5N_m+N_s+5N_c^++3N_c^-.
\label{eq:time}
\end{equation}
式~\eqref{eq:time} 是后文任务排序的服务时间来源,
也是由官方累计量反推移动时间(式~\eqref{eq:residual})的依据。
图~\ref{fig:timingexample} 用附件的五步示例说明记账方式:
首次检测含移动 $100$ s 与检测 $5$ s,单步 $105$ s;
原地换到频道 $2$ 检测单步 $6$ s,累计 $111$ s;
清除目标频道 $3$ 未命中,移动 $80$ s 加光学检查 $3$ s,单步 $83$ s,累计 $194$ s;
清除不改变测向机频道,故随后原地以频道 $2$ 复测只需 $5$ s,累计 $199$ s,与附件一致。
\begin{figure}[htbp]
\centering
\includegraphics[width=0.55\linewidth]{timing-attachment-example-105-111-194-199.png}
\caption{附件计时示例的逐动作构成。移动项为距离除以 $5$ m/s,标题数字为该步合计。}
\label{fig:timingexample}
\end{figure}
\subsection{虚拟时间、现实预算与终止}
虚拟时间度量任务完成速度,现实预算约束程序能否继续发出请求,两者不能混用。
程序以 \texttt{/enter} 返回的 \texttt{remaining\_real\_duration\_s} 为准,
在每个动作前预留退出时间;虚拟时间以整数微秒累计,在线预测只用于规划与一致性核对。
因此后文的“耗时”一律指式~\eqref{eq:time} 的虚拟时间,程序运行时间在结果表中单列。
策略在预算不足或协议异常时主动退出并报告未解决频道,不以程序正常结束代替任务完成。