Value-Iteration.tex 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. \Statex Transition probabilities $f_{xy}(a) = \mathbb{P}(y | x, a)$
  23. \Statex Discounting factor $\alpha \in (0, 1)$, typically $\alpha = 0.9$
  24. \Procedure{ValueIteration}{$\mathcal{X}$, $A$, $g$, $f$, $\alpha$}
  25. \State Initialize $J, J': \mathcal{X} \rightarrow \mathbb{R}_0^+$ arbitrarily
  26. \While{$J$ is not converged}
  27. \State $J' \gets J$
  28. \For{$x \in \mathcal{X}$}
  29. \For{$a \in A(x)$}
  30. \State $Q(x, a) \gets g(x, a) + \alpha \sum_{j=1}^{n_x} f_{xj}(a) \cdot J'(j)$
  31. \EndFor
  32. \EndFor
  33. \For{$x \in \mathcal{X}$}
  34. \State $J(x) \gets \min_a \{Q(x, a)\}$
  35. \EndFor
  36. \EndWhile
  37. \Return $J$
  38. \EndProcedure
  39. \end{algorithmic}
  40. \caption{Value Iteration: Learn function $J: \mathcal{X} \rightarrow \mathbb{R}$}
  41. \label{alg:value-iteration}
  42. \end{algorithm}
  43. \end{preview}
  44. \end{document}