Reinforcement Learning Toolbox 2.0
last updated:
General
Documentation
Manual
Tutorial
Class Reference
Master Thesis
Examples
Related Papers
Downloads
Links
News
mailto:webmaster
Main Page     Class Hierarchy   Compound List   File List   Compound Members   File Members

CAgent Class Reference

The class represents the main acting Object of the Learning System, the agent. More...

#include <cagent.h>

Inheritance diagram for CAgent:

CSemiMarkovDecisionProcess CStateModifiersObject CDeterministicController CSemiMDPSender CStateObject CAgentController CSemiMDPListener CActionObject CParameterObject CParameterObject CParameters CParameters CHiearchicalAgent List of all members.


Public Member Functions

  CAgent (CEnvironmentModel *model)
  ~CAgent ()
virtual void  doAction (CAction *action)
  Execute the action and send the State-Action-State tuple.

virtual void  addStateModifier (CStateModifier *modifier)
  Add a state Modifier to the StateCollections.

virtual void  removeStateModifier (CStateModifier *modifier)
  remove a state Modifier from the StateCollections

int  doControllerEpisode (int maxEpisodes=1, int maxSteps=5000)
void  setParameters (int maxEpisodes, int maxSteps)
  Set the Training Parameters, called by doControllerEpisode.

int  doResume ()
virtual void  startNewEpisode ()
  Tells all Listeners that a new Episode has occured and resets the model.

void  doControllerStep ()
  Gets action from the controller and executes it.

void  setKeyboardBreak (bool keyboardBreak)
  Sets wether the training can be paused by a keystroke.

bool  getKeyboardBreak ()
virtual void  addAction (CPrimitiveAction *action)
  add an primitiv action to the agent's actionlist. The agent can only choose from this actions.

virtual void  setLogEpisode (bool bLogEpisode)
  Sets wether the currentEpisode should be logged or not.

virtual CEpisode getCurrentEpisode ()
  Returns the currentEpisode Object (only valid if bLogEpisode = true).

virtual CStateCollection getCurrentState ()
CEnvironmentModel getEnvironmentModel ()


Protected Member Functions

int  doRun (bool bContinue)


Protected Attributes

CStateCollectionImpl currentState
CStateCollectionImpl lastState
int  maxEpisodes
int  maxSteps
bool  keyboardBreaks
CEnvironmentModel model
bool  bLogEpisode
CEpisode currentEpisode

Detailed Description

The class represents the main acting Object of the Learning System, the agent.

The agent is the object which acts within its environment an sends every step to its SemiMDPListener, its the only "acting" object so it's the most important part of the toolbox. The Agent follows the Policy set by setController(CAgentController *). It saves the currentState, then tells the model which action to execute and then saves the new state. Having done that the agent is able to send the State-Action-State tuple to all its Listeners.

The agent's actionset can only maintain PrimitiveActions. The agent has an agent controller which can choose from the actions in the agent's actoinset. It is not allowed that an controller returns an action which isn't in the agent's action set. ExtendedActions can only be added to the CHierarchicalSemiMarkovDecisionProcess class.
Another important functionality of the agent are the StateModifiers which can be added to the agent. The stateModifier is than added to the stateCollections (currentState, lastState) of the agent. If you add a StateModifier to the agent, the modified state is calculated by the state modifier after the modelstate has changed and added to the state collection. The modified State, which can be a discrete, a feature or any other State calculated from the original model state is now available to all Listeners, and it only gets calculated once. So the Listeners have access to several different kind of states.
For the execution of actions you have several possibilities, the agent can execute:
  • a given action (doAction),
  • a single action from the controller (doControllerStep)
  • or one or more Episodes following the Policy from the Controller (doControllerEpisode). You can specify how much steps each episode should have at maximum. The agent also loggs the current episode. You need the current Episode for the hierarchical SMDPs, they need an instance of the Episode to reconstruct the intermediate steps. This feature can be turned off by setLoggegEpisode(bool) for performance reasons if it isn't needed.
See also:
CSemiMDPListener

CHierarchicalSemiMarkovDecisionProcess

CSemiMarkovDecisionProcess


Constructor & Destructor Documentation

CAgent::CAgent CEnvironmentModel model  ) 
 
CAgent::~CAgent  ) 
 

Member Function Documentation

virtual void CAgent::addAction CPrimitiveAction action  )  [virtual]
 

add an primitiv action to the agent's actionlist. The agent can only choose from this actions.

virtual void CAgent::addStateModifier CStateModifier modifier  )  [virtual]
 

Add a state Modifier to the StateCollections.

Reimplemented from CStateModifiersObject.

virtual void CAgent::doAction CAction action  )  [virtual]
 

Execute the action and send the State-Action-State tuple.

Reimplemented in CHiearchicalAgent.

int CAgent::doControllerEpisode int  maxEpisodes = 1,
int  maxSteps = 5000
 

Executes maxEpisodes, if an epsiode reaches maxsteps, a new episode is startet automatically Returns -1 if training has been paused by a keystroke. Call doResume() to continue training.

void CAgent::doControllerStep  ) 
 

Gets action from the controller and executes it.

Be aware that you will get an assertation if the agent controller isn't set probably!

int CAgent::doResume  ) 
 

Resume the Training if it was paused (e.g. by a keystroke) Returns -1 if training has been paused by a keystroke. Call doResume() to continue training.

int CAgent::doRun bool  bContinue  )  [protected]
 
virtual CEpisode* CAgent::getCurrentEpisode  )  [virtual]
 

Returns the currentEpisode Object (only valid if bLogEpisode = true).

virtual CStateCollection* CAgent::getCurrentState  )  [virtual]
 
CEnvironmentModel* CAgent::getEnvironmentModel  ) 
 
bool CAgent::getKeyboardBreak  ) 
 
virtual void CAgent::removeStateModifier CStateModifier modifier  )  [virtual]
 

remove a state Modifier from the StateCollections

Reimplemented from CStateModifiersObject.

void CAgent::setKeyboardBreak bool  keyboardBreak  ) 
 

Sets wether the training can be paused by a keystroke.

virtual void CAgent::setLogEpisode bool  bLogEpisode  )  [virtual]
 

Sets wether the currentEpisode should be logged or not.

void CAgent::setParameters int  maxEpisodes,
int  maxSteps
 

Set the Training Parameters, called by doControllerEpisode.

virtual void CAgent::startNewEpisode  )  [virtual]
 

Tells all Listeners that a new Episode has occured and resets the model.

Reimplemented from CSemiMarkovDecisionProcess.

Reimplemented in CHiearchicalAgent.


Member Data Documentation

bool CAgent::bLogEpisode [protected]
 
CEpisode* CAgent::currentEpisode [protected]
 
CStateCollectionImpl* CAgent::currentState [protected]
 
bool CAgent::keyboardBreaks [protected]
 
CStateCollectionImpl* CAgent::lastState [protected]
 
int CAgent::maxEpisodes [protected]
 
int CAgent::maxSteps [protected]
 
CEnvironmentModel* CAgent::model [protected]
 

The documentation for this class was generated from the following file: