Remove unwanted algorithm line numbers

algorithmicalgorithmsieeetran

I am using the IEEEtran template in Overleaf. I am writing an algorithm in the overleaf.
enter image description here

However, it adds a series of unwanted zeros on the left of the algorithm and also an unwanted =0 at the last line, here is also my code,

\begin{algorithm}
    \caption{Migration algorithm}
    \begin{algorithmic}
    \label{alg:migration}
        \For {$iteration=1,2,\ldots$,N}
            \For {$episodes=1,2,\ldots,M$}
                \State $R_b \leftarrow 0$
                \State $R_l \leftarrow 0$
                \For {$timesteps=1,2,\ldots,T$}
                    \State Run a trajectory $\pi_{\theta_{old/new}}$ for $T$ timesteps
                    \State Compute the timestep latency reward $r_l$
                    \State Compute the timestep binpacking reward $r_b$
                \EndFor
                \State $R_b \leftarrow R_b + r_b$
                \State $R_l \leftarrow R_l + r_l$
            \EndFor
            \State $R \leftarrow w_1 R_b + w_2 R_l$
            \State Optimize the RL Agent policy $\pi$ based on R
            \State Move the containers based on $\pi$
        \EndFor
    \end{algorithmic}
\end{algorithm}

Theses are also the list of packages related to the algorithm that I'm using.

\usepackage{algorithmic}[1]
\usepackage{algpseudocode}
\usepackage{algorithm}

Instead of zeros I want the line number of the algorithm and also at the end I don't want the end for=0 part.

Best Answer

(this answer builds on an earlier comment)

I suggest you (a) not load the algorithmic package and (b) change \begin{algorithmic} to \begin{algorithmic}[1] to enable line numbering.

enter image description here

\documentclass{IEEEtran}
\usepackage{amsmath,newtxtext,newtxmath}
%\usepackage{algorithmic}[1] % <-- don't load this package
\usepackage{algpseudocode}
\usepackage{algorithm}
\begin{document}

\begin{algorithm}
    \caption{Migration algorithm} \label{alg:migration}
    \begin{algorithmic}[1] % <-- added '[1]' to control line numbering
        \For {$\textrm{iteration}=1,2,\ldots,N$}
            \For {$\textrm{episodes}=1,2,\ldots,M$}
                \State $R_b \leftarrow 0$
                \State $R_l \leftarrow 0$
                \For {$\textrm{timesteps}=1,2,\ldots,T$}
                    \State Run a trajectory $\pi_{\theta_{\textrm{old/new}}}$ for $T$ timesteps
                    \State Compute the timestep latency reward $r_l$
                    \State Compute the timestep binpacking reward $r_b$
                \EndFor
                \State $R_b \leftarrow R_b + r_b$
                \State $R_l \leftarrow R_l + r_l$
            \EndFor
            \State $R \leftarrow w_1 R_b + w_2 R_l$
            \State Optimize the RL Agent policy $\pi$ based on $R$
            \State Move the containers based on $\pi$
        \EndFor
    \end{algorithmic}
\end{algorithm}

\end{document}