GClasses

GClasses::GPolicyLearner Class Reference

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

#include <GPolicyLearner.h>

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

List of all members.

Public Member Functions

 GPolicyLearner (sp_relation &pRelation, 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.
 GPolicyLearner (GDomNode *pNode)
virtual ~GPolicyLearner ()
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.)
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.
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.

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.

Protected Attributes

sp_relation m_pRelation
int m_senseDims
int m_actionDims
bool m_teleported
bool m_explore

Detailed Description

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


Constructor & Destructor Documentation

GClasses::GPolicyLearner::GPolicyLearner ( sp_relation pRelation,
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 ( ) [inline, 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::GPeachAgent, and 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