1

I am trying to write an algorithm and I receive the following errors

Missing = inserted for \ifnum. \end{algorithmic}


Command \algorithmic already defined. }
Missing = inserted for \ifnum. \end{algorithmic}

Something's wrong--perhaps a missing \item. 
...methodTrace.Method.Owner.DeveloperGold==E}

Something's wrong--perhaps a missing \item. \ENDWHILE

Underfull \vbox (badness 1270) has occurred while \output is active []

\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts

% The preceding line is only needed to identify funding in the first 
%footnote. If that is unneeded, please comment it out.

\usepackage{cite}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{algorithmic}
\usepackage{algorithm,algpseudocode}

\usepackage{graphicx}
\usepackage{textcomp}
\usepackage{xcolor}
\usepackage{multirow}
\setlength{\textfloatsep}{0.1cm}

\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}
\begin{document}


\begin{algorithm}
\caption{Calculate $y = x^n$}
\begin{algorithmic} 

\FORALL{methodTrace in methodTraceList} 
\IF{methodTrace.Method.Owner.DeveloperGold==T}    methodTrace.Prediction=E 
\ELSIF{methodTrace.Method.Owner.DeveloperGold==N} methodTrace.Prediction=N 
\ELSIF{methodTrace.Method.Owner.DeveloperGold==E} methodTrace.Prediction=E  
\ENDIF
\ENDFOR
\WHILE{$OldPredictions \neq NewPredictions$}
    \FORALL{methodTrace in methodTraceList} 
        \IF{ \NOT methodtrace.Method.Callees.isEmpty() \AND  
        \NOT methodtrace.Method.Callers.isEmpty() 
        \AND methodtrace.Method.Callees.AllTs(methodtrace.Requirement, methodtraces2HashMap) 
        \AND methodtrace.Method.Callers.AllTs(methodtrace.Requirement, methodtraces2HashMap)
        } methodTrace.Prediction=E 
    \ENDFOR 
\ENDWHILE
\end{algorithmic}
\end{algorithm}

\end{document}
1

You have a missing \ENDIF for the last \IF and each \IF-\ELSIF requires a \STATE. Also, if-elsif-elsif-end should be if-elsif-else-end.

\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts

% The preceding line is only needed to identify funding in the first 
%footnote. If that is unneeded, please comment it out.

\usepackage{cite}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{algorithm,algorithmic}

\usepackage{graphicx}
\usepackage{textcomp}
\usepackage{xcolor}
\usepackage{multirow}
\setlength{\textfloatsep}{0.1cm}

\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}
\begin{document}


\begin{algorithm}
\caption{Calculate $y = x^n$}
\begin{algorithmic}
\FORALL {methodTrace in methodTraceList}  
    \IF {methodTrace.Method.Owner.DeveloperGold==T}  \STATE methodTrace.Prediction=E
    \ELSIF {methodTrace.Method.Owner.DeveloperGold==N} \STATE methodTrace.Prediction=N 
    \ELSIF {methodTrace.Method.Owner.DeveloperGold==E} \STATE methodTrace.Prediction=E  
    \ENDIF
\ENDFOR
\WHILE {$OldPredictions \neq NewPredictions$}    
    \FORALL{methodTrace in methodTraceList}   
        \IF {\NOT methodtrace.Method.Callees.isEmpty() \AND  
            \NOT methodtrace.Method.Callers.isEmpty() 
            \AND methodtrace.Method.Callees.AllTs(methodtrace.Requirement, methodtraces2HashMap) 
            \AND methodtrace.Method.Callers.AllTs(methodtrace.Requirement, methodtraces2HashMap)
            } \STATE methodTrace.Prediction=E
        \ENDIF 
    \ENDFOR 
\ENDWHILE
\end{algorithmic}
\end{algorithm}

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.