1
\begin{algorithm}
    \hspace*{\algorithmicindent} \textbf{Input:}  V, E, S, S\textsubscript {ai}, P, P\textsubscript{ai}, R\textsubscript{s}, p\textsubscript{a},r\textsubscript{asp}, $a \in V$, ${s\textsubscript{i} \in s\textsubscript{ai}}$ , $r \in  R$\\
    \hspace*{\algorithmicindent} \textbf{Output:} W\textsubscript{r} ($r \in R$), P \textsubscript{va} ($a \in V$)
    \begin{algorithmic}%[1]
        \caption{Initialization} \label{algorithm: cds bw}
    %   \Ensure  
    %   \Require A connected graph $G(V, E)$
        \State $UA \gets V 
        \State $T \gets 0\\
        \State $Makspan \gets 0\\
        \State $SrtS \gets Sort(S)\\
        \State $rXs \gets SrtS\\
        \item for $s \in S do 
        \State $Wr \gets Compute

        \EndFor             
    \end{algorithmic}
\end{algorithm}

these are the erros.

Command \item invalid in math mode. \State $T \gets 0\\
Something's wrong--perhaps a missing \item. \State
Something's wrong--perhaps a missing \item. \State
Command \item invalid in math mode. \State
Missing $ inserted. \State
Missing } inserted. \State
Extra }, or forgotten \endgroup. \State
Command \item invalid in math mode. \State $Makspan \gets 0\\
Something's wrong--perhaps a missing \item. \State
Something's wrong--perhaps a missing \item. \State
Command \item invalid in math mode. \State
Missing $ inserted. \State
Missing } inserted. \State
Extra }, or forgotten \endgroup. \State
Command \item invalid in math mode. \State $SrtS \gets Sort(S)\\
Something's wrong--perhaps a missing \item. \State
Something's wrong--perhaps a missing \item. \State
Command \item invalid in math mode. \State
Missing $ inserted. \State
Missing } inserted. \State
Extra }, or forgotten \endgroup. \State
Command \item invalid in math mode. \State $rXs \gets SrtS\\
Something's wrong--perhaps a missing \item. \item
Something's wrong--perhaps a missing \item. \item
Command \item invalid in math mode. \item
Missing $ inserted. \item f
Missing } inserted. \item f
Extra }, or forgotten \endgroup. \item f
Command \item invalid in math mode. \State
Something's wrong--perhaps a missing \item. \State
Something's wrong--perhaps a missing \item. \State
Missing $ inserted. \State $Wr \gets
Missing $ inserted.
Missing } inserted.
Extra }, or forgotten \endgroup.
Missing number, treated as zero. \EndFor
You have requested document class `CIITThesissV1', but the document class provides `CIITThesis'.
\@starttoc has already been redefined; tocloft bailing out.
Label `tab:Rwork' multiply defined.
Label `hourly_load' multiply defined.
Label `hourly_cost' multiply defined.
Label `total_cost' multiply defined.
Label `hourly_load' multiply defined.
Label `par' multiply defined.
Label `res' multiply defined.
Overfull \hbox (23.54465pt too wide) in paragraph
Underfull \hbox (badness 10000) in paragraph
Font shape `OT1/cmr/m/n' in size <16> not available(Font) size <17.28> substituted
Underfull \hbox (badness 10000) in paragraph
Overfull \hbox (23.54465pt too wide) in paragraph
Overfull \hbox (61.94633pt too wide) in paragraph
Font shape `OT1/cmr/bx/n' in size <16> not available(Font) size <17.28> substituted
Overfull \hbox (0.1874pt too wide) in paragraph
Overfull \hbox (25.4857pt too wide) in paragraph
Overfull \hbox (1.18094pt too wide) in paragraph
Overfull \hbox (8.83087pt too wide) in paragraph
Overfull \hbox (7.82118pt too wide) in paragraph
\fancyhead's `E' option without twoside option is useless
Citation `almeida2016priority' on page 2 undefined
Citation `Xiao2013' on page 3 undefined
Citation `almeida2016priority' on page 3 undefined
Citation `Shen2016' on page 3 undefined
Citation `Yilmaz2017c' on page 4 undefined
Citation `McCrae1992' on page 4 undefined
Underfull \hbox (badness 10000) in paragraph
Overfull \hbox (3.23318pt too wide) in paragraph
Overfull \hbox (2.25476pt too wide) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Overfull \hbox (3.5836pt too wide) in paragraph
Overfull \hbox (4.00179pt too wide) in paragraph
Overfull \hbox (4.05122pt too wide) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Overfull \hbox (9.31604pt too wide) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Overfull \hbox (6.07863pt too wide) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 3088) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 1953) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 4505) in paragraph
Underfull \hbox (badness 4805) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 1622) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Overfull \hbox (5.9644pt too wide) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 7415) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 3746) in paragraph
Overfull \hbox (11.96724pt too wide) in paragraph
Overfull \hbox (31.72905pt too wide) in alignment
Overfull \hbox (31.72905pt too wide) in alignment
Overfull \hbox (31.72905pt too wide) in alignment
Overfull \hbox (31.72905pt too wide) in alignment
Citation `Yilmaz2017c' on page 8 undefined
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 3439) in paragraph
Underfull \hbox (badness 2245) in paragraph
Underfull \hbox (badness 10000) in paragraph
Citation `Acuna2015' on page 8 undefined
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 4686) in paragraph
Underfull \hbox (badness 2865) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 6188) in paragraph
Underfull \hbox (badness 3482) in paragraph
Underfull \hbox (badness 3895) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 1371) in paragraph
Underfull \hbox (badness 3780) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 2142) in paragraph
Underfull \hbox (badness 7944) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 4416) in paragraph
Underfull \hbox (badness 3815) in paragraph
Overfull \hbox (3.62376pt too wide) in paragraph
Underfull \hbox (badness 5133) in paragraph
Underfull \hbox (badness 5908) in paragraph
Underfull \hbox (badness 1681) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 3815) in paragraph
Underfull \hbox (badness 1983) in paragraph
Underfull \hbox (badness 2005) in paragraph
Underfull \hbox (badness 2080) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 1019) in paragraph
Underfull \hbox (badness 2608) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 1127) in paragraph
Underfull \hbox (badness 6944) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 1320) in paragraph
Underfull \hbox (badness 1460) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Overfull \hbox (7.45625pt too wide) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 1067) in paragraph
Underfull \hbox (badness 1107) in paragraph
Underfull \hbox (badness 3460) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 3078) in paragraph
Overfull \hbox (7.45625pt too wide) in paragraph
Underfull \hbox (badness 1215) in paragraph
Underfull \hbox (badness 2409) in paragraph
Underfull \hbox (badness 4328) in paragraph
Underfull \hbox (badness 1540) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 4024) in paragraph
Overfull \hbox (31.72905pt too wide) in alignment
Underfull \hbox (badness 2460) in paragraph
Underfull \hbox (badness 2521) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 7558) in paragraph
Underfull \hbox (badness 2027) in paragraph
Underfull \hbox (badness 3128) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 1769) in paragraph
Underfull \hbox (badness 3323) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 1769) in paragraph
Underfull \hbox (badness 3323) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 2197) in paragraph
Underfull \hbox (badness 5563) in paragraph
Overfull \hbox (31.72905pt too wide) in alignment
Overfull \hbox (31.72905pt too wide) has occurred while \output is active
Overfull \hbox (31.72905pt too wide) has occurred while \output is active
Overfull \hbox (31.72905pt too wide) has occurred while \output is active
Overfull \hbox (31.72905pt too wide) has occurred while \output is active
Overfull \hbox (31.72905pt too wide) has occurred while \output is active
Overfull \hbox (24.90535pt too wide) in paragraph
Overfull \hbox (18.39624pt too wide) in paragraph
Overfull \hbox (29.31572pt too wide) in paragraph
Overfull \hbox (16.65823pt too wide) in paragraph
Overfull \hbox (19.66542pt too wide) in alignment
Overfull \hbox (19.66542pt too wide) in alignment
Overfull \hbox (19.66542pt too wide) in alignment
Overfull \hbox (19.66542pt too wide) in alignment
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 4792) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 2401) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 1092) in paragraph
Underfull \hbox (badness 6094) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Overfull \hbox (4.0105pt too wide) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 6559) in paragraph
Underfull \hbox (badness 1895) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 1990) in paragraph
Underfull \hbox (badness 2961) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Overfull \hbox (4.0105pt too wide) in paragraph
Underfull \hbox (badness 7667) in paragraph
Underfull \hbox (badness 1062) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 4726) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 4479) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 7012) in paragraph
Overfull \hbox (4.0105pt too wide) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 6477) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 4660) in paragraph
Underfull \hbox (badness 1622) in paragraph
Underfull \hbox (badness 2376) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 4048) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 4634) in paragraph
Underfull \hbox (badness 3884) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 4072) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 5741) in paragraph
Underfull \hbox (badness 1342) in paragraph
Underfull \hbox (badness 4479) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 5288) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 7451) in paragraph
Underfull \hbox (badness 1275) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 2119) in paragraph
Overfull \hbox (4.0105pt too wide) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 2401) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 3179) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 4608) in paragraph
Underfull \hbox (badness 1990) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 2951) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 3078) in paragraph
Underfull \hbox (badness 3579) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 1629) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 8132) in paragraph
Underfull \hbox (badness 10000) in paragraph
Overfull \hbox (19.66542pt too wide) in alignment
Overfull \hbox (19.66542pt too wide) has occurred while \output is active
Overfull \hbox (19.66542pt too wide) has occurred while \output is active
Overfull \hbox (19.66542pt too wide) has occurred while \output is active
Underfull \hbox (badness 10000) in paragraph
Overfull \hbox (16.6747pt too wide) in paragraph
Reference `prob1' on page 23 undefined
Reference `appliances' on page 23 undefined
Reference `appliance_parameters' on page 23 undefined
`h' float specifier changed to `ht'.
\headheight is too small (20.0pt): Make it at least 27.05003pt.
`h' float specifier changed to `ht'.
`h' float specifier changed to `ht'.
`h' float specifier changed to `ht'.
Reference `eqsba2' on page 24 undefined
Reference `cons1' on page 24 undefined
Reference `cons2' on page 24 undefined
Reference `wt' on page 24 undefined
\headheight is too small (20.0pt): Make it at least 27.05003pt.
\headheight is too small (20.0pt): Make it at least 27.05003pt.
`h' float specifier changed to `ht'.
\headheight is too small (20.0pt): Make it at least 27.05003pt.
`h' float specifier changed to `ht'.
`h' float specifier changed to `ht'.
\headheight is too small (20.0pt): Make it at least 27.05003pt.
`h' float specifier changed to `ht'.
\headheight is too small (20.0pt): Make it at least 27.05003pt.
`h' float specifier changed to `ht'.
`h' float specifier changed to `ht'.
\headheight is too small (20.0pt): Make it at least 27.05003pt.
`h' float specifier changed to `ht'.
`h' float specifier changed to `ht'.
\headheight is too small (20.0pt): Make it at least 27.05003pt.
Reference `prob2' on page 31 undefined
Reference `appliance_parameters' on page 31 undefined
\headheight is too small (20.0pt): Make it at least 27.05003pt.
Reference `load_cat' on page 32 undefined
Reference `appliance_parameters' on page 32 undefined
Reference `rtp' on page 32 undefined
\headheight is too small (20.0pt): Make it at least 27.05003pt.
`h' float specifier changed to `ht'.
`h' float specifier changed to `ht'.
\headheight is too small (20.0pt): Make it at least 27.05003pt.
`h' float specifier changed to `ht'.
\headheight is too small (20.0pt): Make it at least 27.05003pt.
\headheight is too small (20.0pt): Make it at least 27.05003pt.
`h' float specifier changed to `ht'.
`h' float specifier changed to `ht'.
\headheight is too small (20.0pt): Make it at least 27.05003pt.
`h' float specifier changed to `ht'.
`h' float specifier changed to `ht'.
\headheight is too small (20.0pt): Make it at least 27.05003pt.
\headheight is too small (20.0pt): Make it at least 27.05003pt.
\headheight is too small (20.0pt): Make it at least 27.05003pt.
Reference `prob1' on page 52 undefined
Reference `prob2' on page 52 undefined
Overfull \hbox (6.04266pt too wide) in paragraph
Reference `prob1' on page 53 undefined
Overfull \hbox (98.1064pt too wide) in paragraph
Overfull \hbox (6.26265pt too wide) in paragraph
Reference `prob2' on page 71 undefined
Overfull \hbox (3.55907pt too wide) in paragraph
Overfull \hbox (72.13777pt too wide) in paragraph
Overfull \hbox (72.13777pt too wide) in paragraph
Overfull \hbox (56.43698pt too wide) in paragraph
Overfull \hbox (56.43698pt too wide) in paragraph
There were undefined citations.
Size substitutions with differences(Font) up to 1.28pt have occurred.
There were undefined references.
There were multiply-defined labels.
name{CSA_text} has been referenced but does not exist, replaced by a fixed one
name{csa1_text} has been referenced but does not exist, replaced by a fixed one
name{SA_text} has been referenced but does not exist, replaced by a fixed one
name{home_text} has been referenced but does not exist, replaced by a fixed one
name{sell_text} has been referenced but does not exist, replaced by a fixed one
name{pur_text} has been referenced but does not exist, replaced by a fixed one
name{ev1_text} has been referenced but does not exist, replaced by a fixed one
name{iv_text} has been referenced but does not exist, replaced by a fixed one
name{ev_text} has been referenced but does not exist, replaced by a fixed one
name{pv_text} has been referenced but does not exist, replaced by a fixed one
name{wt_text} has been referenced but does not exist, replaced by a fixed one
name{milp_text} has been referenced but does not exist, replaced by a fixed one
  • 1
    A quick guess you are entering the math mode by means of the dollar in the \State commands but you don't really leave it. same for the \item. – albert Oct 24 '18 at 16:19
  • As it is possible to add line from one statement to another i.e. ruled, vlined etc – Iftikhar Ahmad Oct 24 '18 at 18:12
  • @albert please guide me in this regard – Iftikhar Ahmad Oct 25 '18 at 8:19
  • I think the answer from Werner gives the answers. – albert Oct 25 '18 at 8:38
2

Here are some corrections:

  1. Use \State without a closing \\.

  2. When opening math mode, also close it $...$.

  3. Use \For{<condition>}...\EndFor.

  4. \caption should be outside the algorithmic environment.

enter image description here

\documentclass{article}

\usepackage{algorithm,algpseudocode}

\begin{document}

\begin{algorithm}
  \caption{Initialization} \label{algorithm: cds bw}
  \hspace*{\algorithmicindent} \textbf{Input:}
    V, E, S, S\textsubscript{ai}, P, P\textsubscript{ai}, R\textsubscript{s}, p\textsubscript{a},r\textsubscript{asp}, 
    $a \in V$, ${s\textsubscript{i} \in s\textsubscript{ai}}$ , $r \in  R$\\
  \hspace*{\algorithmicindent} \textbf{Output:} 
    W\textsubscript{r} ($r \in R$), P \textsubscript{va} ($a \in V$)
  \begin{algorithmic}
    \State $UA \gets V$ 
    \State $T \gets 0$
    \State $Makspan \gets 0$
    \State $SrtS \gets Sort(S)$
    \State $rXs \gets SrtS$
    \For{$s \in S$}
      \State $Wr \gets Compute$
    \EndFor             
  \end{algorithmic}
\end{algorithm}

\end{document}

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.