【发布时间】:2019-05-31 13:24:37
【问题描述】:
我尝试在乳胶中键入算法的伪代码,它工作正常,但它只写到 midle 。其余的保持空白..这是源代码
\documentclass{IEEETran}
\usepackage{algpseudocode}
\usepackage{algorithm}
\begin{document}
\begin{algorithm}
\caption{GPX operator}
\hspace*{\algorithmicindent} \textbf{Input} s1 = $\lbrace V^{1}_{1}; ... ; V^{1}_{k}\rbrace$ and s2 = $\lbrace V^{2}_{1}; ... ; V^{2}_{k}\rbrace$ - parent solutions. \\
\hspace*{\algorithmicindent} \textbf{Output} $ s = \lbrace V_{1}; ... ; V_{k}\rbrace$ - offspring solution. \\
\begin{algorithmic}[1]
\For {$l(1\leq l \leq k)$}
\If{($l$ is odd)}
\State A=1
\Else
\State A=2;
\EndIf
\State choose $i$ such that $V^{A}_{i}$ has a maximum cardinality
\State $V_{l}$=$V^{A}_{i}$
\State remove the vertices of $V_{l}$ from $s1$ and $s2$
\EndFor
\State Assign randomly the vertices of $V - (V_{1} \cup ... \cup V_{k})$
\end{algorithmic}
\end{algorithm}
\end{document}
【问题讨论】:
-
我不明白你的问题。源代码和格式化文本的最后一行都是“随机分配...”。为什么说“它只写到中间,其余的保持空白”?
-
我的意思是水平中间......在算法2中的输入语句中它写父然后转到下一行
-
IEEEtran 的默认模式是双列。如果需要,请使用 \documentclass[onecolumn]{IEEEtran} 进行编译。
-
是乳胶的新手......你的建议很好......谢谢你..把它放在答案中