2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-24 22:08:04 +02:00

Update pseudocode to include cost function as parameter

This commit is contained in:
Martin Thoma 2016-07-13 20:10:55 +02:00
parent 23462814aa
commit 940436c883
4 changed files with 17 additions and 6 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Before After
Before After

View file

@ -7,7 +7,12 @@
\usepackage[T1]{fontenc} % this is needed for correct output of umlauts in pdf
\usepackage{amssymb,amsmath,amsfonts} % nice math rendering
\usepackage{braket} % needed for \Set
\usepackage[noend]{algorithm,algpseudocode}
\usepackage{caption}
\usepackage{algorithm}
\usepackage[noend]{algpseudocode}
\DeclareCaptionFormat{myformat}{#3}
\captionsetup[algorithm]{format=myformat}
\begin{document}
\begin{preview}
@ -16,7 +21,8 @@
\Require
\Statex Sates $\mathcal{X} = \{1, \dots, n_x\}$
\Statex Actions $\mathcal{A} = \{1, \dots, n_a\},\qquad A: \mathcal{X} \Rightarrow \mathcal{A}$
\Procedure{PolicyIteration}{$\mathcal{X}$, $A$}
\Statex Cost function $g: \mathcal{X} \times \mathcal{A} \rightarrow \mathbb{R}$
\Procedure{PolicyIteration}{$\mathcal{X}$, $A$, $g$}
\State Initialize $\pi$ arbitrarily
\While{$\pi$ is not converged}
\State $J \gets$ solve system of linear equations $I - \alpha \cdot F(\pi) \cdot J = g(\pi)$

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Before After
Before After

View file

@ -7,7 +7,12 @@
\usepackage[T1]{fontenc} % this is needed for correct output of umlauts in pdf
\usepackage{amssymb,amsmath,amsfonts} % nice math rendering
\usepackage{braket} % needed for \Set
\usepackage[noend]{algorithm,algpseudocode}
\usepackage{caption}
\usepackage{algorithm}
\usepackage[noend]{algpseudocode}
\DeclareCaptionFormat{myformat}{#3}
\captionsetup[algorithm]{format=myformat}
\begin{document}
\begin{preview}
@ -16,10 +21,10 @@
\Require
\Statex Sates $\mathcal{X} = \{1, \dots, n_x\}$
\Statex Actions $\mathcal{A} = \{1, \dots, n_a\},\qquad A: \mathcal{X} \Rightarrow \mathcal{A}$
\Statex Cost function $g: \mathcal{X} \times \mathcal{A} \rightarrow \mathbb{R}$
% TODO: g? \alpha?
% Q?
% f_ij(a)
\Procedure{ValueIteration}{$\mathcal{X}$, $A$}
\Procedure{ValueIteration}{$\mathcal{X}$, $A$, $g$}
\State Initialize $J, J': \mathcal{X} \rightarrow \mathbb{R}_0^+$ arbitrarily
\While{$J$ is not converged}
\State $J' \gets J$
@ -35,7 +40,7 @@
\EndProcedure
\end{algorithmic}
\caption{Calculate value function}
\label{alg:calculateLegendreSymbol}
\label{alg:value-iteration}
\end{algorithm}
\end{preview}
\end{document}