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

\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{preprocessor}{\#ifndef\ GYM\_PCB\_RL\_AGENT\_H}}
\DoxyCodeLine{00002\ \textcolor{preprocessor}{\#define\ GYM\_PCB\_RL\_AGENT\_H}}
\DoxyCodeLine{00003\ }
\DoxyCodeLine{00004\ \textcolor{preprocessor}{\#include\ "{}Defs.hpp"{}}}
\DoxyCodeLine{00005\ \textcolor{preprocessor}{\#include\ "{}Py.hpp"{}}}
\DoxyCodeLine{00006\ \textcolor{preprocessor}{\#include\ "{}Parameter.hpp"{}}}
\DoxyCodeLine{00007\ \textcolor{preprocessor}{\#include\ "{}Signals.hpp"{}}}
\DoxyCodeLine{00008\ \textcolor{preprocessor}{\#include\ "{}RL/Action.hpp"{}}}
\DoxyCodeLine{00009\ \textcolor{preprocessor}{\#include\ "{}RL/Stats.hpp"{}}}
\DoxyCodeLine{00010\ \textcolor{preprocessor}{\#include\ "{}UI/LockStep.hpp"{}}}
\DoxyCodeLine{00011\ \textcolor{preprocessor}{\#include\ <chrono>}}
\DoxyCodeLine{00012\ \textcolor{preprocessor}{\#include\ <map>}}
\DoxyCodeLine{00013\ \textcolor{preprocessor}{\#include\ <memory>}}
\DoxyCodeLine{00014\ \textcolor{preprocessor}{\#include\ <mutex>}}
\DoxyCodeLine{00015\ \textcolor{preprocessor}{\#include\ <set>}}
\DoxyCodeLine{00016\ \textcolor{preprocessor}{\#include\ <vector>}}
\DoxyCodeLine{00017\ }
\DoxyCodeLine{00018\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classActionSpace}{ActionSpace}};}
\DoxyCodeLine{00019\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classPolicy}{Policy}};}
\DoxyCodeLine{00020\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classStateRepresentation}{StateRepresentation}};}
\DoxyCodeLine{00021\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classPCBoard}{PCBoard}};}
\DoxyCodeLine{00022\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classConnection}{Connection}};}
\DoxyCodeLine{00023\ }
\DoxyCodeLine{00024\ \textcolor{keyword}{constexpr}\ \textcolor{keyword}{const}\ uint\ PCB\_PY\_I\_METHOD\_EVENT\ =\ 0;}
\DoxyCodeLine{00025\ \textcolor{keyword}{constexpr}\ \textcolor{keyword}{const}\ uint\ PCB\_PY\_I\_METHOD\_V\ =\ 1;}
\DoxyCodeLine{00026\ \textcolor{keyword}{constexpr}\ \textcolor{keyword}{const}\ uint\ PCB\_PY\_I\_METHOD\_Q\ =\ 2;}
\DoxyCodeLine{00027\ \textcolor{keyword}{constexpr}\ \textcolor{keyword}{const}\ uint\ PCB\_PY\_I\_METHOD\_P\ =\ 3;}
\DoxyCodeLine{00028\ \textcolor{keyword}{constexpr}\ \textcolor{keyword}{const}\ uint\ PCB\_PY\_I\_METHOD\_P\_V\ =\ 4;}
\DoxyCodeLine{00029\ }
\DoxyCodeLine{00030\ \textcolor{keyword}{class\ }Agent}
\DoxyCodeLine{00031\ \{}
\DoxyCodeLine{00032\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00033\ \ \ \ \ \textcolor{keyword}{static}\ Agent\ *create(\textcolor{keyword}{const}\ std::string\ \&type);}
\DoxyCodeLine{00034\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00035\ \ \ \ \ Agent(\textcolor{keyword}{const}\ std::string\ \&name);}
\DoxyCodeLine{00036\ \ \ \ \ \textcolor{keyword}{virtual}\ \string~Agent();}
\DoxyCodeLine{00037\ \ \ \ \ \textcolor{keyword}{const}\ std::string\&\ name()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mName;\ \}}
\DoxyCodeLine{00038\ \ \ \ \ \textcolor{keyword}{virtual}\ \textcolor{keywordtype}{void}\ setStateRepresentationParams(PyObject\ *)\ \{\ \}}
\DoxyCodeLine{00039\ \ \ \ \ \textcolor{keywordtype}{void}\ setParameters(PyObject\ *);}
\DoxyCodeLine{00040\ \ \ \ \ \textcolor{keyword}{virtual}\ \textcolor{keywordtype}{void}\ setParameter(\textcolor{keyword}{const}\ std::string\ \&varName,\ \textcolor{keywordtype}{int}\ index,\ PyObject\ *);}
\DoxyCodeLine{00041\ \ \ \ \ \textcolor{keyword}{const}\ std::map<std::string,\ Parameter\ *>\&\ getParameters()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mParameters;\ \}}
\DoxyCodeLine{00042\ \ \ \ \ \textcolor{keywordtype}{void}\ setPythonInterface(PyObject\ *);}
\DoxyCodeLine{00043\ \ \ \ \ \textcolor{keywordtype}{void}\ setTrainingMode(\textcolor{keywordtype}{bool}\ on);}
\DoxyCodeLine{00044\ }
\DoxyCodeLine{00045\ \ \ \ \ \textcolor{keyword}{virtual}\ \textcolor{keywordtype}{void}\ setPCB(\textcolor{keyword}{const}\ std::shared\_ptr<PCBoard>\&);}
\DoxyCodeLine{00046\ \ \ \ \ \textcolor{keyword}{virtual}\ \textcolor{keywordtype}{void}\ setManagedConnections(\textcolor{keyword}{const}\ std::set<Connection\ *>\&);}
\DoxyCodeLine{00047\ \ \ \ \ \textcolor{keywordtype}{void}\ setManagedConnectionsToUnrouted();}
\DoxyCodeLine{00048\ \ \ \ \ \textcolor{keywordtype}{void}\ setActionSpace(\textcolor{keyword}{const}\ \mbox{\hyperlink{classActionSpace}{ActionSpace}}\&);}
\DoxyCodeLine{00050\ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{classAgent_af0e78287226d3c9cc945e4a673e6e3c1}{setPolicy}}(\mbox{\hyperlink{classPolicy}{Policy}}\ *);}
\DoxyCodeLine{00051\ \ \ \ \ \textcolor{keywordtype}{void}\ setRewardFn(\mbox{\hyperlink{classRewardFunction}{RewardFunction}}\ *);}
\DoxyCodeLine{00052\ \ \ \ \ \textcolor{keywordtype}{void}\ setStateRepresentation(\mbox{\hyperlink{classStateRepresentation}{StateRepresentation}}\ *);}
\DoxyCodeLine{00053\ }
\DoxyCodeLine{00054\ \ \ \ \ \textcolor{keyword}{virtual}\ \textcolor{keywordtype}{bool}\ \_run()\ \{\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};\ \}}
\DoxyCodeLine{00055\ \ \ \ \ \textcolor{keywordtype}{bool}\ run();}
\DoxyCodeLine{00056\ \ \ \ \ \textcolor{keywordtype}{void}\ setRunArgs(PyObject\ *);}
\DoxyCodeLine{00057\ \ \ \ \ \textcolor{keywordtype}{void}\ setTimeout(uint64\_t\ usec);}
\DoxyCodeLine{00058\ \ \ \ \ \textcolor{keywordtype}{void}\ setTimeoutExpired();}
\DoxyCodeLine{00059\ \ \ \ \ \textcolor{keywordtype}{void}\ setActionLimit(int64\_t\ count);}
\DoxyCodeLine{00060\ \ \ \ \ \textcolor{keywordtype}{void}\ setClearBoardBeforeRun(\textcolor{keywordtype}{bool});}
\DoxyCodeLine{00061\ \ \ \ \ \textcolor{keywordtype}{float}\ getProgress()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mProgress;\ \}}
\DoxyCodeLine{00062\ }
\DoxyCodeLine{00063\ \ \ \ \ \textcolor{keyword}{virtual}\ PyObject\ *step(PyObject\ *)\ \{\ \textcolor{keywordflow}{return}\ 0;\ \}}
\DoxyCodeLine{00064\ \ \ \ \ \textcolor{keyword}{virtual}\ PyObject\ *get\_state(PyObject\ *)\ \{\ \textcolor{keywordflow}{return}\ 0;\ \}}
\DoxyCodeLine{00065\ \ \ \ \ \textcolor{keyword}{virtual}\ PyObject\ *reset()\ \{\ \textcolor{keywordflow}{return}\ 0;\ \}}
\DoxyCodeLine{00066\ }
\DoxyCodeLine{00067\ \ \ \ \ \textcolor{keywordtype}{void}\ eraseManagedConnections();}
\DoxyCodeLine{00068\ }
\DoxyCodeLine{00070\ \ \ \ \ \mbox{\hyperlink{classPCBoard}{PCBoard}}\ *\mbox{\hyperlink{classAgent_accf3d7d2c4452d1cff72ed7180a0a3f8}{getPCB}}()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mPCB.get();\ \}}
\DoxyCodeLine{00071\ \ \ \ \ \mbox{\hyperlink{classRewardFunction}{RewardFunction}}\&\ getRewardFn()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ *mRewardFn.get();\ \}}
\DoxyCodeLine{00072\ \ \ \ \ Policy\ *getPolicy()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mPolicy.get();\ \}}
\DoxyCodeLine{00073\ \ \ \ \ StateRepresentation\ *getSR()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mStateRep.get();\ \}}
\DoxyCodeLine{00074\ \ \ \ \ uint32\_t\ getIteration()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mIteration;\ \}}
\DoxyCodeLine{00075\ \ \ \ \ uint64\_t\ numActions()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mNumActions;\ \}}
\DoxyCodeLine{00076\ \ \ \ \ uint64\_t\ usecsSinceStart()\ \textcolor{keyword}{const};}
\DoxyCodeLine{00077\ \ \ \ \ \textcolor{keyword}{const}\ std::vector<Connection\ *>\&\ getConnections()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mConnections;\ \}}
\DoxyCodeLine{00078\ \ \ \ \ \textcolor{keyword}{const}\ std::set<Connection\ *>\&\ getConnectionSet()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mConnectionSet;\ \}}
\DoxyCodeLine{00079\ \ \ \ \ Connection\ *setConnectionLRU(PyObject\ *);}
\DoxyCodeLine{00080\ \ \ \ \ Connection\ *getConnectionLRU()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mConnectionLRU;\ \}}
\DoxyCodeLine{00081\ \ \ \ \ Action::Result\ evaluateCurrentState()\ \textcolor{keyword}{const};}
\DoxyCodeLine{00082\ }
\DoxyCodeLine{00083\ \ \ \ \ \textcolor{keywordtype}{void}\ startTimer();}
\DoxyCodeLine{00084\ \ \ \ \ \textcolor{keywordtype}{bool}\ hasTimerExpired()\ \textcolor{keyword}{const};}
\DoxyCodeLine{00085\ \ \ \ \ \textcolor{keywordtype}{void}\ resetActionCount();}
\DoxyCodeLine{00086\ \ \ \ \ \textcolor{keywordtype}{void}\ resetActionLimit();}
\DoxyCodeLine{00087\ \ \ \ \ \textcolor{keywordtype}{void}\ countActions(\textcolor{keywordtype}{int});}
\DoxyCodeLine{00088\ \ \ \ \ \textcolor{keywordtype}{bool}\ actionLimitExceeded()\ \textcolor{keyword}{const};}
\DoxyCodeLine{00089\ }
\DoxyCodeLine{00093\ \ \ \ \ std::vector<float>\ \mbox{\hyperlink{classAgent_afa9959a7e57b0dd01ac6b92cbe9a31f0}{py\_V}}(PyObject\ *states)\ \{\ \textcolor{keywordflow}{return}\ pycall\_floatarray(PCB\_PY\_I\_METHOD\_V,\ states);\ \}}
\DoxyCodeLine{00094\ \ \ \ \ std::vector<float>\ py\_Q(PyObject\ *states)\ \{\ \textcolor{keywordflow}{return}\ pycall\_floatarray(PCB\_PY\_I\_METHOD\_Q,\ states);\ \}}
\DoxyCodeLine{00095\ \ \ \ \ std::vector<float>\ py\_P(PyObject\ *states)\ \{\ \textcolor{keywordflow}{return}\ pycall\_floatarray(PCB\_PY\_I\_METHOD\_P,\ states);\ \}}
\DoxyCodeLine{00096\ \ \ \ \ std::vector<float>\ py\_P\_V(PyObject\ *states)\ \{\ \textcolor{keywordflow}{return}\ pycall\_floatarray(PCB\_PY\_I\_METHOD\_P\_V,\ states);\ \}}
\DoxyCodeLine{00098\ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{classAgent_a77d1fd8c9e829806a58728cb303fd7f3}{py\_event}}(PyObject\ *event);}
\DoxyCodeLine{00099\ }
\DoxyCodeLine{00100\ \ \ \ \ \mbox{\hyperlink{classStepLock}{StepLock}}\&\ getStepLock()\ \{\ \textcolor{keywordflow}{return}\ mStepLock;\ \}}
\DoxyCodeLine{00101\ \textcolor{keyword}{protected}:}
\DoxyCodeLine{00102\ \ \ \ \ std::shared\_ptr<PCBoard>\ mPCB;}
\DoxyCodeLine{00103\ \ \ \ \ std::vector<Connection\ *>\ mConnections;}
\DoxyCodeLine{00104\ \ \ \ \ std::set<Connection\ *>\ mConnectionSet;}
\DoxyCodeLine{00105\ \ \ \ \ \mbox{\hyperlink{classConnection}{Connection}}\ *mConnectionLRU\{0\};}
\DoxyCodeLine{00106\ \ \ \ \ \textcolor{keyword}{const}\ ActionSpace\ *mActionSpace\{0\};}
\DoxyCodeLine{00107\ \ \ \ \ std::unique\_ptr<Policy>\ mPolicy;}
\DoxyCodeLine{00108\ \ \ \ \ std::unique\_ptr<StateRepresentation>\ mStateRep;}
\DoxyCodeLine{00109\ \ \ \ \ std::unique\_ptr<RewardFunction>\ mRewardFn;}
\DoxyCodeLine{00110\ \ \ \ \ ResultCollection\ mStats;}
\DoxyCodeLine{00111\ \ \ \ \ uint32\_t\ mIteration\{0\};}
\DoxyCodeLine{00112\ \ \ \ \ \textcolor{keywordtype}{float}\ mProgress\{-\/1.0f\};\ \textcolor{comment}{//\ set\ this\ from\ 0\ to\ 1\ when\ running\ if\ you\ want\ the\ UI\ to\ show\ it}}
\DoxyCodeLine{00113\ \ \ \ \ \textcolor{keywordtype}{bool}\ mClearBoardBeforeRun\{\textcolor{keyword}{false}\};}
\DoxyCodeLine{00114\ \ \ \ \ SignalContext\ mSignals;}
\DoxyCodeLine{00115\ \ \ \ \ std::map<std::string,\ Parameter\ *>\ mParameters;}
\DoxyCodeLine{00116\ }
\DoxyCodeLine{00117\ \ \ \ \ \textcolor{keywordtype}{void}\ initParameters();}
\DoxyCodeLine{00118\ }
\DoxyCodeLine{00119\ \ \ \ \ PyObject\ *mPython\{0\};}
\DoxyCodeLine{00120\ \ \ \ \ PyObject\ *mMethodNamesPy[5]\{0,0,0,0,0\};}
\DoxyCodeLine{00121\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00122\ \ \ \ \ int64\_t\ mActionLimit\{std::numeric\_limits<int64\_t>::max()\};}
\DoxyCodeLine{00123\ \ \ \ \ int64\_t\ mNumActions\{0\};}
\DoxyCodeLine{00124\ \ \ \ \ int64\_t\ mActionsLeft\{std::numeric\_limits<int64\_t>::max()\};}
\DoxyCodeLine{00125\ \ \ \ \ uint64\_t\ mTimeoutUSecs\{0\};}
\DoxyCodeLine{00126\ \ \ \ \ std::chrono::time\_point<std::chrono::system\_clock>\ mTimerStartPoint;}
\DoxyCodeLine{00127\ \ \ \ \ std::chrono::time\_point<std::chrono::system\_clock>\ mTimeoutPoint;}
\DoxyCodeLine{00128\ \ \ \ \ \textcolor{keywordtype}{bool}\ mTraining\{\textcolor{keyword}{false}\};}
\DoxyCodeLine{00129\ \ \ \ \ \textcolor{keyword}{mutable}\ StepLock\ mStepLock;}
\DoxyCodeLine{00130\ \ \ \ \ \textcolor{keyword}{const}\ std::string\ mName;}
\DoxyCodeLine{00131\ }
\DoxyCodeLine{00132\ \ \ \ \ std::vector<float>\ pycall\_floatarray(uint\ index,\ PyObject\ *);}
\DoxyCodeLine{00133\ \};}
\DoxyCodeLine{00134\ }
\DoxyCodeLine{00135\ \textcolor{keyword}{inline}\ \textcolor{keywordtype}{void}\ Agent::setRewardFn(\mbox{\hyperlink{classRewardFunction}{RewardFunction}}\ *RF)}
\DoxyCodeLine{00136\ \{}
\DoxyCodeLine{00137\ \ \ \ \ \textcolor{keywordflow}{if}\ (RF\ \&\&\ mPCB)}
\DoxyCodeLine{00138\ \ \ \ \ \ \ \ \ RF-\/>setContext(*mPCB);}
\DoxyCodeLine{00139\ \ \ \ \ mRewardFn.reset(RF);}
\DoxyCodeLine{00140\ \}}
\DoxyCodeLine{00141\ }
\DoxyCodeLine{00142\ \textcolor{keyword}{inline}\ \textcolor{keywordtype}{void}\ Agent::setActionSpace(\textcolor{keyword}{const}\ \mbox{\hyperlink{classActionSpace}{ActionSpace}}\ \&A)}
\DoxyCodeLine{00143\ \{}
\DoxyCodeLine{00144\ \ \ \ \ mActionSpace\ =\ \&A;}
\DoxyCodeLine{00145\ \}}
\DoxyCodeLine{00146\ }
\DoxyCodeLine{00147\ \textcolor{keyword}{inline}\ \textcolor{keywordtype}{void}\ Agent::setClearBoardBeforeRun(\textcolor{keywordtype}{bool}\ b)}
\DoxyCodeLine{00148\ \{}
\DoxyCodeLine{00149\ \ \ \ \ mClearBoardBeforeRun\ =\ b;}
\DoxyCodeLine{00150\ \}}
\DoxyCodeLine{00151\ }
\DoxyCodeLine{00152\ \textcolor{keyword}{inline}\ \textcolor{keywordtype}{void}\ Agent::setTimeout(uint64\_t\ usec)}
\DoxyCodeLine{00153\ \{}
\DoxyCodeLine{00154\ \ \ \ \ mTimeoutUSecs\ =\ usec;}
\DoxyCodeLine{00155\ \}}
\DoxyCodeLine{00156\ \textcolor{keyword}{inline}\ uint64\_t\ Agent::usecsSinceStart()\textcolor{keyword}{\ const}}
\DoxyCodeLine{00157\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00158\ \ \ \ \ \textcolor{keyword}{const}\ \textcolor{keyword}{auto}\ now\ =\ std::chrono::system\_clock::now();}
\DoxyCodeLine{00159\ \ \ \ \ \textcolor{keywordflow}{return}}
\DoxyCodeLine{00160\ \ \ \ \ \ \ \ \ std::chrono::duration\_cast<std::chrono::microseconds>(now\ -\/\ mTimerStartPoint).count();}
\DoxyCodeLine{00161\ \}}
\DoxyCodeLine{00162\ \textcolor{keyword}{inline}\ \textcolor{keywordtype}{void}\ Agent::setTimeoutExpired()}
\DoxyCodeLine{00163\ \{}
\DoxyCodeLine{00164\ \ \ \ \ mTimeoutPoint\ =\ std::chrono::system\_clock::now();}
\DoxyCodeLine{00165\ \}}
\DoxyCodeLine{00166\ \textcolor{keyword}{inline}\ \textcolor{keywordtype}{void}\ Agent::startTimer()}
\DoxyCodeLine{00167\ \{}
\DoxyCodeLine{00168\ \ \ \ \ mTimerStartPoint\ =\ std::chrono::system\_clock::now();}
\DoxyCodeLine{00169\ \ \ \ \ \textcolor{keywordflow}{if}\ (mTimeoutUSecs)}
\DoxyCodeLine{00170\ \ \ \ \ \ \ \ \ mTimeoutPoint\ =\ mTimerStartPoint\ +\ std::chrono::microseconds(mTimeoutUSecs);}
\DoxyCodeLine{00171\ \ \ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{00172\ \ \ \ \ \ \ \ \ mTimeoutPoint\ =\ std::chrono::system\_clock::time\_point::max();}
\DoxyCodeLine{00173\ \}}
\DoxyCodeLine{00174\ \textcolor{keyword}{inline}\ \textcolor{keywordtype}{bool}\ Agent::hasTimerExpired()\textcolor{keyword}{\ const}}
\DoxyCodeLine{00175\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00176\ \ \ \ \ \textcolor{keywordflow}{return}\ std::chrono::system\_clock::now()\ >=\ mTimeoutPoint;}
\DoxyCodeLine{00177\ \}}
\DoxyCodeLine{00178\ }
\DoxyCodeLine{00179\ \textcolor{keyword}{inline}\ \textcolor{keywordtype}{void}\ Agent::setActionLimit(int64\_t\ n)}
\DoxyCodeLine{00180\ \{}
\DoxyCodeLine{00181\ \ \ \ \ mActionLimit\ =\ (n\ >\ 0)\ ?\ n\ :\ std::numeric\_limits<int64\_t>::max();}
\DoxyCodeLine{00182\ \}}
\DoxyCodeLine{00183\ \textcolor{keyword}{inline}\ \textcolor{keywordtype}{void}\ Agent::resetActionCount()}
\DoxyCodeLine{00184\ \{}
\DoxyCodeLine{00185\ \ \ \ \ mNumActions\ =\ 0;}
\DoxyCodeLine{00186\ \}}
\DoxyCodeLine{00187\ \textcolor{keyword}{inline}\ \textcolor{keywordtype}{void}\ Agent::resetActionLimit()}
\DoxyCodeLine{00188\ \{}
\DoxyCodeLine{00189\ \ \ \ \ mActionsLeft\ =\ mActionLimit;}
\DoxyCodeLine{00190\ \}}
\DoxyCodeLine{00191\ \textcolor{keyword}{inline}\ \textcolor{keywordtype}{void}\ Agent::countActions(\textcolor{keywordtype}{int}\ n)}
\DoxyCodeLine{00192\ \{}
\DoxyCodeLine{00193\ \ \ \ \ mNumActions\ +=\ n;}
\DoxyCodeLine{00194\ \ \ \ \ mActionsLeft\ -\/=\ n;}
\DoxyCodeLine{00195\ \ \ \ \ mStepLock.wait(10);}
\DoxyCodeLine{00196\ \}}
\DoxyCodeLine{00197\ \textcolor{keyword}{inline}\ \textcolor{keywordtype}{bool}\ Agent::actionLimitExceeded()\textcolor{keyword}{\ const}}
\DoxyCodeLine{00198\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00199\ \ \ \ \ \textcolor{keywordflow}{return}\ mActionsLeft\ <=\ 0;}
\DoxyCodeLine{00200\ \}}
\DoxyCodeLine{00201\ }
\DoxyCodeLine{00202\ \textcolor{keyword}{inline}\ \textcolor{keywordtype}{void}\ Agent::setTrainingMode(\textcolor{keywordtype}{bool}\ b)}
\DoxyCodeLine{00203\ \{}
\DoxyCodeLine{00204\ \ \ \ \ mTraining\ =\ b;}
\DoxyCodeLine{00205\ \}}
\DoxyCodeLine{00206\ }
\DoxyCodeLine{00207\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ GYM\_PCB\_RL\_AGENT\_H}}

\end{DoxyCode}
