I have the following LaTeX code for a pseudocode block.
\begin{algorithm}[H]
\caption{Particle Swarm Optimization para Dados Relacionais}
\begin{algorithmic}
\REQUIRE A matriz de dissimilaridade $D$, o número de clusters $k$, o número de partículas no enxame $n_p$, o número máximo de iterações e os coeficientes $c_1$ e $c_2$.
\ENSURE Produz um vetor de medóides $(G_1, G_2, \dots, G_k)$ e uma partição $P = (C_1, C_2, \dots, C_k)$ de $E$ para $K$.
\STATE Crie um enxame de tamanho $n_p$
\FOR{i = 1 até $n_p$}
\STATE Inicialize $p_i$
\STATE $pbest_i$ \leftarrow \text{posição atual}
\ENDFOR
\STATE gbest \leftarrow $(g_1, g_2, \dots, g_k)$ da partícula com melhor desempenho na função objetivo
\STATE t \leftarrow 0
\end{algorithmic}
\end{algorithm}
However, it renders with buggy indentation:
Note how the last statement before the endfor is not on the same indentation level as the previous statement. The last statement, t <- 0, is also not on the same indentation level as the rest of the algorithm. Why is this happening?
