Advertisement
Sax

Algorithm environments in LaTeX

Sax
Jul 3rd, 2019
366
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Latex 0.58 KB | None | 0 0
  1. % Put this in your preamble
  2. \usepackage{algorithm, algpseudocode}
  3.  
  4. % ----
  5. % Put this in the desired chapter
  6.  
  7. \begin{algorithm}
  8. \caption{(1+1) Evolutionary Algorithm}
  9. \label{alg:1-1EA}
  10. \begin{algorithmic}[1]
  11.     \State $p_m \gets 1/n$ \Comment{Set probability of mutation}\tabularnewline
  12.     \State Choose randomly an initial bit string $x \in \{0,1\}^n$
  13.     \While{Stopping criteria not satisfied}
  14.         \State Compute $x'$ by flipping independently each bit $x_i$ with probability $p_m$
  15.         \State Replace $x$ by $x'$ iff $f(x') \geq f(x)$
  16.     \EndWhile
  17. \end{algorithmic}
  18. \end{algorithm}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement