
期待される出力は
そして、私のアウトプットは
私の出力では はBrancing
正しい位置にあります。最初の 3 つの項目は から右に移動しBrancing
、Bounding
と揃うように右に移動する必要がありますBrancing
。2 番目の 3 つの項目は から新しい位置へ右に移動する必要がありますBounding
。
混乱している場合は、予想される と一致します。
ムウェ
\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
箇条書きを「分岐」に合わせて配置するには、itemize 環境を使用せずに箇条書きを手動で挿入します。
\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}