GClasses
GClasses::GPolicyLearner Class Referenceabstract

Detailed Description

This is the base class for algorithms that learn a policy.

#include <GPolicyLearner.h>

Inheritance diagram for GClasses::GPolicyLearner:
GClasses::GQLearner GClasses::GIncrementalLearnerQAgent

Public Member Functions

 GPolicyLearner (const GRelation &relation, int actionDims)
 actionDims specifies how many dimensions are in the action vector. (For example, if your agent has a discrete set of ten possible actions, then actionDims should be 1, because it only takes one value to represent one of ten discrete actions. If your agent has four legs that can move independently to continuous locations relative to the position of the agent in 3D space, then actionDims should be 12, because it takes three values to represent the force or offset vector for each leg.) The number of sense dimensions is the number of attributes in pRelation minus actionDims. pRelation specifies the type of each element in the sense and action vectors (whether they are continuous or discrete). The first attributes refer to the senses, and the last actionDims attributes refer to the actions. More...
 
 GPolicyLearner (GDomNode *pNode)
 
virtual ~GPolicyLearner ()
 
void onTeleport ()
 If an external force changes the state of pSenses, you should call this method to inform the agent that the change is not a consequence of its most recent action. The agent should refrain from "learning" when refinePolicyAndChooseNextAction is next called. More...
 
virtual void refinePolicyAndChooseNextAction (const double *pSenses, double *pOutActions)=0
 This method tells the agent to learn from the current senses, and select a new action vector. (This method should also set m_teleported to false.) More...
 
void setExplore (bool b)
 If b is false, then the agent will only exploit (and no learning will occur). If b is true, (which is the default) then the agent will seek some balance between exploration and exploitation. More...
 

Protected Member Functions

GDomNodebaseDomNode (GDom *pDoc)
 If a child class has a serialize method, it should use this method to serialize the base-class stuff. More...
 

Protected Attributes

int m_actionDims
 
bool m_explore
 
GRelationm_pRelation
 
int m_senseDims
 
bool m_teleported
 

Constructor & Destructor Documentation

GClasses::GPolicyLearner::GPolicyLearner ( const GRelation relation,
int  actionDims 
)

actionDims specifies how many dimensions are in the action vector. (For example, if your agent has a discrete set of ten possible actions, then actionDims should be 1, because it only takes one value to represent one of ten discrete actions. If your agent has four legs that can move independently to continuous locations relative to the position of the agent in 3D space, then actionDims should be 12, because it takes three values to represent the force or offset vector for each leg.) The number of sense dimensions is the number of attributes in pRelation minus actionDims. pRelation specifies the type of each element in the sense and action vectors (whether they are continuous or discrete). The first attributes refer to the senses, and the last actionDims attributes refer to the actions.

GClasses::GPolicyLearner::GPolicyLearner ( GDomNode pNode)
virtual GClasses::GPolicyLearner::~GPolicyLearner ( )
virtual

Member Function Documentation

GDomNode* GClasses::GPolicyLearner::baseDomNode ( GDom pDoc)
protected

If a child class has a serialize method, it should use this method to serialize the base-class stuff.

void GClasses::GPolicyLearner::onTeleport ( )
inline

If an external force changes the state of pSenses, you should call this method to inform the agent that the change is not a consequence of its most recent action. The agent should refrain from "learning" when refinePolicyAndChooseNextAction is next called.

virtual void GClasses::GPolicyLearner::refinePolicyAndChooseNextAction ( const double *  pSenses,
double *  pOutActions 
)
pure virtual

This method tells the agent to learn from the current senses, and select a new action vector. (This method should also set m_teleported to false.)

Implemented in GClasses::GQLearner.

void GClasses::GPolicyLearner::setExplore ( bool  b)
inline

If b is false, then the agent will only exploit (and no learning will occur). If b is true, (which is the default) then the agent will seek some balance between exploration and exploitation.

Member Data Documentation

int GClasses::GPolicyLearner::m_actionDims
protected
bool GClasses::GPolicyLearner::m_explore
protected
GRelation* GClasses::GPolicyLearner::m_pRelation
protected
int GClasses::GPolicyLearner::m_senseDims
protected
bool GClasses::GPolicyLearner::m_teleported
protected