
예상 출력은
그리고 내 결과는
내 출력이 Brancing
올바른 위치에 있습니다. 처음 3개 항목은 에서 오른쪽으로 이동해야 하며 Brancing
에 Bounding
맞춰 정렬되도록 오른쪽으로 이동해야 합니다 Brancing
. 그리고 두 번째 3개 항목은 의 새 위치에서 오른쪽으로 이동해야 합니다 Bounding
.
혼란스러운 경우 예상되는 것과 일치합니다.
MWE
\documentclass{beamer}
\usetheme{Madrid}
\usepackage{algpseudocode}
\usefonttheme[onlymath]{serif}
%this code is from: https://tex.stackexchange.com/a/353165/101651
\algnewcommand\algorithmicinput{\textbf{Input:}}
\algnewcommand\algorithmicoutput{\textbf{Output:}}
\algnewcommand\algorithmicinitialization{\textbf{Initialize:}}
\algnewcommand\Input{\item[\algorithmicinput]}%
\algnewcommand\Output{\item[\algorithmicoutput]}%
\algnewcommand\Initialize{\item[\algorithmicinitialization]}%
\begin{document}
\begin{frame}[fragile]
\begin{block}{BnB algorithm for QWSRM problem}
\begin{algorithmic}
\Input $\mathcal{Q}_{\text{init}}, \mathcal{A}, \text{and} \mathcal{f} \text{(c)}.$
\Initialize Obtain $c_{i} \text{ by solving } \frac{\delta f(c)}{\delta c_{i}}=0, \text{ for } i\in\mathcal{N}.\text{ Set } k = 1, \mathcal{B} = \mathcal{Q}_{init},u_{1}=\gamma_{ub}(\mathcal{Q}_{init}) \text{ and } l_{1} = \gamma_{lb}(\mathcal{Q}_{init}).$\\
Check the feasibility of problem (17) with given
\If{feasible}
\State $c_{0} = \widetilde{c};$
\Else
\While{$u_{k} - l_{k} > \epsilon$}
\State Branching:
\begin{itemize}
\item Set $\mathcal{Q}_{k} = \mathcal{Q}, \text{ where } \mathcal{Q} \text{ satisfies } \gamma_{lb}(\mathcal{Q}) = l_{k}.$
\item Split $\mathcal{Q} \text{ into } \mathcal{Q}_{\rm{I}} \text{ and } \mathcal{Q}_{\rm{II}}, \text{ along one of its longest edges.}$
\item Update $\mathcal{B}_{k+1} = (\mathcal{B}_{k}\setminus{\{\mathcal{Q}_{k}\}}) \bigcup (\mathcal{Q}_{\rm{I}}, \mathcal{Q}_{\rm{II}}).$
\end{itemize}
Bounding:
\begin{itemize}
\item Update $u_{k+1} = \min_{\mathcal{Q}\in\mathcal{B}_{k+1}}{\{\gamma_{ub}(\mathcal{Q})}\}$
\item Update $l_{k+1} = \min_{\mathcal{Q}\in\mathcal{B}_{k+1}}{\{\gamma_{lb}(\mathcal{Q})}\}$
\end{itemize}
\EndWhile\\
Set $c_{0} = c_{min};$
\EndIf
\Output $c_{0}.$
\end{algorithmic}
\end{block}
\end{frame}
\end{document}
답변1
"분기"로 글머리 기호를 정렬하려면 항목별 환경 없이 글머리 기호를 수동으로 삽입할 수 있습니다.
\documentclass{beamer}
\usetheme{Madrid}
\usepackage{algpseudocode}
\usefonttheme[onlymath]{serif}
\begin{document}
\begin{frame}[fragile]
\begin{block}{BnB algorithm for QWSRM problem}
\begin{algorithmic}
\State Branching:
\State\quad\usebeamertemplate{itemize item} Set $\mathcal{Q}$...
\State\quad\usebeamertemplate{itemize item} Split $\mathcal{Q}$...
\State Bounding:
\State\quad\usebeamertemplate{itemize item} Update $u_{k+1}$
\end{algorithmic}
\end{block}
\end{frame}
\end{document}