0

I need some help to reproduce the following algorithm in LaTeX enter image description here

1
  • 8
    Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. • Note this is a Q&A site, not a please do this for me service. What do you have so far. Please search for the word Algorithm on this site and I think you will get some examples.
    – albert
    Commented Jan 13, 2019 at 17:00

1 Answer 1

6

The algorithm is written using algorithm2e:

enter image description here

\documentclass{article}

\usepackage[ruled,vlined,linesnumbered]{algorithm2e}

\newcommand{\funccall}{\textit}

\begin{document}

\begin{algorithm}
  \caption{Basic BDI agent control loop}
  \KwIn{$B_0$: Initial beliefs}
  \KwIn{$I_0$: Initial intentions}
  $B \gets B_0$\;
  $I \gets I_0$\;
  $\pi \gets \funccall{null}$\;
  \While{\funccall{alive}}{
    $p \gets \funccall{getPercept}()$\;
    $B \gets \funccall{update}(B, p)$\;
    $D \gets \funccall{wish}(B, I)$\;
    $I \gets \funccall{focus}(B, D, I)$\;
    $\pi \gets \funccall{plan}(B, I)$\;
    $\funccall{execute}(\pi)$\;
  }
\end{algorithm}

\end{document}
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .