Policy-Iteration.tex 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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{caption}
  10. \usepackage{algorithm}
  11. \usepackage[noend]{algpseudocode}
  12. \DeclareCaptionFormat{myformat}{#3}
  13. \captionsetup[algorithm]{format=myformat}
  14. \begin{document}
  15. \begin{preview}
  16. \begin{algorithm}[H]
  17. \begin{algorithmic}
  18. \Require
  19. \Statex Sates $\mathcal{X} = \{1, \dots, n_x\}$
  20. \Statex Actions $\mathcal{A} = \{1, \dots, n_a\},\qquad A: \mathcal{X} \Rightarrow \mathcal{A}$
  21. \Statex Cost function $g: \mathcal{X} \times \mathcal{A} \rightarrow \mathbb{R}$
  22. \Procedure{PolicyIteration}{$\mathcal{X}$, $A$, $g$}
  23. \State Initialize $\pi$ arbitrarily
  24. \While{$\pi$ is not converged}
  25. \State $J \gets$ solve system of linear equations $I - \alpha \cdot F(\pi) \cdot J = g(\pi)$
  26. \For{$x \in \mathcal{X}$}
  27. \For{$a \in A(x)$}
  28. \State $Q(x, a) \gets g(x, a) + \alpha \sum_{j=1}^{n_x} f_{xj}(a) \cdot J(j)$
  29. \EndFor
  30. \EndFor
  31. \For{$x \in \mathcal{X}$}
  32. \State $\pi(x) \gets \arg \min_a \{Q(x, a)\}$
  33. \EndFor
  34. \EndWhile
  35. \EndProcedure
  36. \end{algorithmic}
  37. \caption{Policy Iteration}
  38. \label{alg:policy-iteration}
  39. \end{algorithm}
  40. \end{preview}
  41. \end{document}