I have been trying to format the pseudocode below combining algorithmicx and algpseudocode commands as well as following another related post
algorithmicx or algpseudocode custom command indentation within a while loop or if statement1
The following pseudocode is what I am trying to reproduce.
\usepackage[utf8]{inputenc}
\usepackage{algorithm}
\usepackage{algpseudocode}
\algnewcommand\algorithmicgenerate{\textbf{GENERATE}}
\algnewcommand\GENERATE[1]{\State\algorithmicgenerate\ #1}
\algnewcommand\algorithmicset{\textbf{SET}}
\algnewcommand\SET[1]{\State\algorithmicset\ #1}
\algloop{FOR}
\begin{document}
\begin{algorithm}[H]
\begin{algorithmic}[1]
\GENERATE{$S_t^{(i)} \qquad ,i=1,...,I,t=1,...,M$}
\SET{$C_t^0(S_t^{(i)})=0 \qquad
,i=1,...,I,t=1,...,M$}
\SET{$C_{M+1}^n(S_{M+1}^{(i)})=0 \qquad ,i=1,...,I,n=0,1,...,N$}
\SET{$\hat{\Phi}_t^{(n)}(S_t^{(i)})=0 \qquad, i=1,...,I,t=1,...,M,n=0,1,...,N$}
\FOR{$\quad t=M,...,1$}
\SET{$\iota_t^{(i)} = \arg\max_{a_t^{(i)}\in A}\{P(S_t^{(i)};a_t^{(i)})\} \qquad ,i=1,...,I$}
\FOR{$\, n=\max(1,N-t),...,N$}
\end{algorithmic}
\end{algorithm}
\end{document}
*As you can see Line 7 would not allow me to nest a second FOR loop indented at the same level as Line 6.
Are there any custom commands more suitable for what I am trying to achieve as i honestly find it a bit confusing?
Any help would be greatly appreciated.*