I have an algorithm in latex, and I need to add an addition caption underneath the algorithm (just like in a figure at the bottom: "Figure 1: Whatever it is". I tried simply changing the \begin{algorithm}
to \begin{figure}
, this does put a caption below the algorithm, however, this also changes the layout of the algorithm, and I don't want that to happen. It is possible to remain the same layout, but somehow add an additional caption just like in figure
?
This is my code:
\begin{algorithm}[t]
\caption{Ant Colony Algorithm}
\label{ACA}
\begin{algorithmic}
\STATE Set parameters, initialize pheromone trails
\WHILE{stopping condition not met}
\STATE construct ant paths
\STATE local search (optional)
\STATE update pheromone
\ENDWHILE
\STATE \textbf{output:} the ACO solution path
\end{algorithmic}
\end{algorithm}
Best Answer
The
algorithm
float uses theruled
style of the float package, and this style can be changed.If you want to get rid of the last line below the caption (which looks better to me), use
\def\@fs@post{}
as indicated in the code. Likewise, you can get rid of any of the rules, if you wish so.