Policy-Iteration.tex 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. \documentclass{article}
  2. \usepackage[pdftex,active,tightpage]{preview}
  3. \setlength\PreviewBorder{2mm}
  4. \usepackage[utf8]{inputenc} % this is needed for umlauts
  5. \usepackage[ngerman]{babel} % this is needed for umlauts
  6. \usepackage[T1]{fontenc} % this is needed for correct output of umlauts in pdf
  7. \usepackage{amssymb,amsmath,amsfonts} % nice math rendering
  8. \usepackage{braket} % needed for \Set
  9. \usepackage[noend]{algorithm,algpseudocode}
  10. \begin{document}
  11. \begin{preview}
  12. \begin{algorithm}[H]
  13. \begin{algorithmic}
  14. \Require
  15. \Statex Sates $\mathcal{X} = \{1, \dots, n_x\}$
  16. \Statex Actions $\mathcal{A} = \{1, \dots, n_a\},\qquad A: \mathcal{X} \Rightarrow \mathcal{A}$
  17. \Procedure{PolicyIteration}{$\mathcal{X}$, $A$}
  18. \State Initialize $\pi$ arbitrarily
  19. \While{$\pi$ is not converged}
  20. \State $J \gets$ solve system of linear equations $I - \alpha \cdot F(\pi) \cdot J = g(\pi)$
  21. \For{$x \in \mathcal{X}$}
  22. \For{$a \in A(x)$}
  23. \State $Q(x, a) \gets g(x, a) + \alpha \sum_{j=1}^{n_x} f_{xj}(a) \cdot J(j)$
  24. \EndFor
  25. \EndFor
  26. \For{$x \in \mathcal{X}$}
  27. \State $\pi(x) \gets \arg \min_a \{Q(x, a)\}$
  28. \EndFor
  29. \EndWhile
  30. \EndProcedure
  31. \end{algorithmic}
  32. \caption{Policy Iteration}
  33. \label{alg:policy-iteration}
  34. \end{algorithm}
  35. \end{preview}
  36. \end{document}