\doxysection{Action.\+hpp}
\hypertarget{Action_8hpp_source}{}\label{Action_8hpp_source}\index{/home/chr/devel/PhD/Environment/pub/PCBEnv/pcbenv/cxx/RL/Action.hpp@{/home/chr/devel/PhD/Environment/pub/PCBEnv/pcbenv/cxx/RL/Action.hpp}}

\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ }
\DoxyCodeLine{00002\ \textcolor{preprocessor}{\#ifndef\ GYM\_PCB\_RL\_ACTION\_H}}
\DoxyCodeLine{00003\ \textcolor{preprocessor}{\#define\ GYM\_PCB\_RL\_ACTION\_H}}
\DoxyCodeLine{00004\ }
\DoxyCodeLine{00005\ \textcolor{preprocessor}{\#include\ "{}Defs.hpp"{}}}
\DoxyCodeLine{00006\ \textcolor{preprocessor}{\#include\ "{}RL/Reward.hpp"{}}}
\DoxyCodeLine{00007\ \textcolor{preprocessor}{\#include\ <string>}}
\DoxyCodeLine{00008\ }
\DoxyCodeLine{00009\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classAgent}{Agent}};}
\DoxyCodeLine{00010\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classNavGrid}{NavGrid}};}
\DoxyCodeLine{00011\ }
\DoxyCodeLine{00013\ \textcolor{keyword}{class\ }Action}
\DoxyCodeLine{00014\ \{}
\DoxyCodeLine{00015\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00016\ \ \ \ \ \textcolor{keyword}{using\ }Index\ =\ uint16\_t;}
\DoxyCodeLine{00017\ \ \ \ \ \textcolor{keyword}{constexpr}\ \textcolor{keyword}{static}\ \textcolor{keyword}{const}\ Index\ IndexNone\ =\ std::numeric\_limits<Index>::max();}
\DoxyCodeLine{00018\ }
\DoxyCodeLine{00019\ \ \ \ \ \textcolor{keyword}{using\ }CacheRef\ =\ uint32\_t;}
\DoxyCodeLine{00020\ }
\DoxyCodeLine{00021\ \ \ \ \ \textcolor{keyword}{struct\ }Result\ \{}
\DoxyCodeLine{00022\ \ \ \ \ \ \ \ \ Result()\ \{\ \}}
\DoxyCodeLine{00023\ \ \ \ \ \ \ \ \ Result(Reward\ r,\ \textcolor{keywordtype}{bool}\ ok,\ \textcolor{keywordtype}{bool}\ t\ =\ \textcolor{keyword}{false})\ :\ R(r),\ Success(ok),\ Termination(t)\ \{\ \}}
\DoxyCodeLine{00024\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{bool}\ operator<(\textcolor{keyword}{const}\ Result\&)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00025\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{bool}\ operator>(\textcolor{keyword}{const}\ Result\ \&that)\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ that\ <\ *\textcolor{keyword}{this};\ \}}
\DoxyCodeLine{00026\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{bool}\ operator==(\textcolor{keyword}{const}\ Result\&)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00027\ \ \ \ \ \ \ \ \ std::string\ str()\ \textcolor{keyword}{const};}
\DoxyCodeLine{00028\ \ \ \ \ \ \ \ \ Reward\ R;}
\DoxyCodeLine{00029\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{structRouterResult}{RouterResult}}\ Router;}
\DoxyCodeLine{00030\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{bool}\ Success\{\textcolor{keyword}{true}\};\ \textcolor{comment}{//\ Don't\ change\ the\ defaults!}}
\DoxyCodeLine{00031\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{bool}\ Termination\{\textcolor{keyword}{false}\};}
\DoxyCodeLine{00032\ \ \ \ \ \};}
\DoxyCodeLine{00033\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00034\ \ \ \ \ Action(\textcolor{keyword}{const}\ std::string\ \&name,\ uint\ index\ =\ std::numeric\_limits<Index>::max())\ :\ mName(name),\ mIndex(index)\ \{\ \}}
\DoxyCodeLine{00035\ \ \ \ \ \textcolor{keyword}{virtual}\ \mbox{\hyperlink{classAction}{\string~Action}}()\ \{\ \}}
\DoxyCodeLine{00036\ }
\DoxyCodeLine{00037\ \ \ \ \ \textcolor{keyword}{const}\ std::string\&\ name()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mName;\ \}}
\DoxyCodeLine{00038\ \ \ \ \ Index\ index()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mIndex;\ \}}
\DoxyCodeLine{00039\ \ \ \ \ \textcolor{keywordtype}{bool}\ legal()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mLegal;\ \}}
\DoxyCodeLine{00040\ }
\DoxyCodeLine{00041\ \ \ \ \ \textcolor{keyword}{virtual}\ \mbox{\hyperlink{structAction_1_1Result}{Result}}\ performAs(Agent\&\ context,\ PyObject\ *arg\ =\ 0)\ \{\ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{structAction_1_1Result}{Result}}();\ \}}
\DoxyCodeLine{00042\ }
\DoxyCodeLine{00043\ \ \ \ \ \textcolor{keyword}{virtual}\ \textcolor{keywordtype}{void}\ clearCache(CacheRef\ =\ 0)\ \{\ \}}
\DoxyCodeLine{00044\ \ \ \ \ \textcolor{keyword}{virtual}\ \mbox{\hyperlink{structAction_1_1Result}{Result}}\ performAs(Agent\&\ context,\ PyObject\ *arg,\ CacheRef)\ \{\ \textcolor{keywordflow}{return}\ performAs(context);\ \}}
\DoxyCodeLine{00045\ }
\DoxyCodeLine{00046\ \ \ \ \ \textcolor{keyword}{virtual}\ \mbox{\hyperlink{structAction_1_1Result}{Result}}\ undoAs(Agent\&);}
\DoxyCodeLine{00047\ \ \ \ \ Action\ *getUndo()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mUndo;\ \}}
\DoxyCodeLine{00048\ }
\DoxyCodeLine{00049\ \ \ \ \ \textcolor{keywordtype}{void}\ setUndo(Action\ *A)\ \{\ mUndo\ =\ A;\ \}}
\DoxyCodeLine{00050\ \ \ \ \ \textcolor{keywordtype}{void}\ setIndex(Index\ a)\ \{\ mIndex\ =\ a;\ \}}
\DoxyCodeLine{00051\ \ \ \ \ \textcolor{keywordtype}{void}\ setLegal(\textcolor{keywordtype}{bool}\ b)\ \{\ mLegal\ =\ b;\ \}}
\DoxyCodeLine{00052\ }
\DoxyCodeLine{00053\ \ \ \ \ \textcolor{keywordtype}{void}\ setActionCountIncrement(uint\ n)\ \{\ mActionCountIncrement\ =\ n;\ \}}
\DoxyCodeLine{00054\ }
\DoxyCodeLine{00055\ \ \ \ \ \textcolor{keyword}{virtual}\ PyObject\ *getPy()\ \textcolor{keyword}{const};}
\DoxyCodeLine{00056\ \textcolor{keyword}{protected}:}
\DoxyCodeLine{00057\ \ \ \ \ Action\ *mUndo\{0\};}
\DoxyCodeLine{00058\ \ \ \ \ uint\ mActionCountIncrement\{1\};}
\DoxyCodeLine{00059\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00060\ \ \ \ \ \textcolor{keyword}{const}\ std::string\ mName;}
\DoxyCodeLine{00061\ \ \ \ \ Index\ mIndex\{std::numeric\_limits<Index>::max()\};}
\DoxyCodeLine{00062\ \ \ \ \ \textcolor{keywordtype}{bool}\ mLegal;}
\DoxyCodeLine{00063\ \};}
\DoxyCodeLine{00064\ \textcolor{keyword}{inline}\ \textcolor{keywordtype}{bool}\ Action::Result::operator<(\textcolor{keyword}{const}\ \mbox{\hyperlink{structAction_1_1Result}{Action::Result}}\ \&that)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00065\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00066\ \ \ \ \ \textcolor{keywordflow}{return}\ (Success\ <\ that.Success)\ ||\ (Success\ ==\ that.Success\ \&\&\ R\ <\ that.R);}
\DoxyCodeLine{00067\ \}}
\DoxyCodeLine{00068\ }
\DoxyCodeLine{00069\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ GYM\_PCB\_RL\_ACTION\_H}}

\end{DoxyCode}
