\makeatletter \newif\if@restonecol \makeatother \let\algorithm\relax \let\endalgorithm\relax \usepackage[linesnumbered,ruled]{algorithm2e}%[ruled,vlined]{ \usepackage{algpseudocode} \usepackage{amsmath} \renewcommand{\algorithmicrequire}{\textbf{Input:}} % Use Input in the format of Algorithm \renewcommand{\algorithmicensure}{\textbf{Output:}} % Use Output in the format of Algorithm
\begin{algorithm}[H] \renewcommand{\algorithmcfname}{算法名} \renewcommand{\thealgocf}{4-1} //设置行号 \KwIn{current period $t$, initial inventory $I_{t-1}$, initial capital $B_{t-1}$, demand samples} \KwOut{Optimal order quantity $Q^{\ast}_{t}$} initialization\; \While{not at end of this document}{ read current \text{中文}\; \eIf{understand}{ go to next section\; current section becomes this one\; }{ go back to the beginning of current section\; } } $r\leftarrow t$\; $\Delta B^{\ast}\leftarrow -\infty$\; \While{$\Delta B\leq\Delta B^{\ast}$ and $r\leq T$}{$Q\leftarrow\arg\max_{Q\geq 0}\Delta B^{Q}_{t,r}(I_{t-1},B_{t-1})$\; $\Delta B\leftarrow\Delta B^{Q}_{t,r}(I_{t-1},B_{t-1})/(r-t+1)$\; \If{$\Delta B\geq\Delta B^{\ast}$}{$Q^{\ast}\leftarrow Q$\; $\Delta B^{\ast}\leftarrow\Delta B$\;} $r\leftarrow r+1$\;} \caption{Simulation-optimization heuristic}\label{algorithm} \end{algorithm} \end{CJK}