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

CState Class Reference

Represents a single state. More...

#include <cstate.h>

Inheritance diagram for CState:

CStateObject CStateCollection List of all members.


Public Member Functions

  CState (CStateProperties *properties)
  Creates a new State with the specified properties.

  CState (CEnvironmentModel *model)
  Creates a new State with the properties of the model.

  CState (CState *copy)
  Copies the given state.

  CState (CStateProperties *properties, FILE *stream, bool binary=true)
  Loads a state from file.

void  setState (CState *copy)
  Sets all the values according to.

void  resetState ()
  Resets the state.

virtual  ~CState ()
virtual CState getState (CStateProperties *properties)
  Implements the CStateCollection interface.

virtual CState getState ()
  Implements the CStateCollection interface.

virtual bool  isMember (CStateProperties *stateModifier)
unsigned int  getNumActiveDiscreteStates ()
  returns the number of continuous state-variables used for the actual state

unsigned int  getNumActiveContinuousStates ()
  returns the number of discrete state-variables used for the actual state

void  setNumActiveDiscreteStates (int numActiveStates)
  sets the number of continuous state-variables used for the actual state

void  setNumActiveContinuousStates (int numActiveStates)
  sets the number of discrete state-variables used for the actual state

void  saveBinary (FILE *stream)
  Save as a binary.

void  loadBinary (FILE *stream)
  Load from a binary.

void  saveASCII (FILE *stream)
  Save as text.

void  loadASCII (FILE *stream)
  Load from a text.

virtual CState clone ()
  Clones the actual state.

virtual double  getContinuousState (unsigned int dim)
  returns the dim th continuous state

virtual double  getNormalizedContinuousState (unsigned int dim)
  returns the dim th normalized continuous state

virtual int  getDiscreteState (unsigned int dim)
  returns the dim th discrete state

virtual int  getDiscreteStateNumber ()
virtual void  setContinuousState (unsigned int dim, double val)
  sets the dim th continuous state

virtual void  setDiscreteState (unsigned int dim, int val)
  sets the dim th discrete state

virtual bool  equals (CState *state)
  Compares the two states by comparing all state variables. As soon as one variable differs it returns false.

virtual double  getDistance (ColumnVector *vector)
double  getSingleStateDifference (int dim, double value)


Protected Attributes

int *  discreteState
  array for the discrete states

unsigned int  numActiveContinuousStates
  number of active continuous state-variables used by the actual state

unsigned int  numActiveDiscreteStates
  number of active discrete state-variables used by the actual state


Detailed Description

Represents a single state.

The CState object saves the values of state-variables. There are discrete and continuous state variables. The number of discrete and continuous state variables are taken from the CStateProperties object. These values stand for the maximum number of continuous resp. discrete states, the arrays are created with this size. The attributes numActiveContinuousStates resp numActiveDiscreteStates stand for the used state variables by the actual state, these values can differ from the maximum values especially with feature states. These values are used to gain performance when updtating the Q-Function, so you only have to look at the first, active state variables. States can be of type DISCRETESTATE, FEATURESTATE or a normal state. The type is specified in the state properties.

CState implents the CStateCollection interface, the class can be seen as state collection only containing the CState object itself. This implentation was choosen in order to provide more generality for many functions which take only a state collection.

See also:
CStateProperties

Constructor & Destructor Documentation

CState::CState CStateProperties properties  ) 
 

Creates a new State with the specified properties.

CState::CState CEnvironmentModel model  ) 
 

Creates a new State with the properties of the model.

CState::CState CState copy  ) 
 

Copies the given state.

CState::CState CStateProperties properties,
FILE *  stream,
bool  binary = true
 

Loads a state from file.

The file stream has to stand on the right position, and the properties have to be the same (the same values in the properties) as the properties from the saved State.

Parameters:
properties  Properties of the state
stream  Stream from where to load the state
binary  whether to load the state from a binary or a txt file.
virtual CState::~CState  )  [virtual]
 

Member Function Documentation

virtual CState* CState::clone  )  [virtual]
 

Clones the actual state.

virtual bool CState::equals CState state  )  [virtual]
 

Compares the two states by comparing all state variables. As soon as one variable differs it returns false.

virtual double CState::getContinuousState unsigned int  dim  )  [virtual]
 

returns the dim th continuous state

virtual int CState::getDiscreteState unsigned int  dim  )  [virtual]
 

returns the dim th discrete state

virtual int CState::getDiscreteStateNumber  )  [virtual]
 
virtual double CState::getDistance ColumnVector *  vector  )  [virtual]
 
virtual double CState::getNormalizedContinuousState unsigned int  dim  )  [virtual]
 

returns the dim th normalized continuous state

The continuous state gets transformed in the intervall [0,1] according to its given min and max values.

unsigned int CState::getNumActiveContinuousStates  ) 
 

returns the number of discrete state-variables used for the actual state

unsigned int CState::getNumActiveDiscreteStates  ) 
 

returns the number of continuous state-variables used for the actual state

double CState::getSingleStateDifference int  dim,
double  value
 
virtual CState* CState::getState  )  [virtual]
 

Implements the CStateCollection interface.

A lways returns the state itself, so it is the "general" state of its own state collection.

Implements CStateCollection.

virtual CState* CState::getState CStateProperties properties  )  [virtual]
 

Implements the CStateCollection interface.

Always returns the state itself. So the returned state doesn't have to have the specified properties!

Implements CStateCollection.

virtual bool CState::isMember CStateProperties stateModifier  )  [virtual]
 

Checks wether there exists a state with the specified state properties in the collection Actually since there is just one state in the "state collection" it just returns if the properties pointer of the state is the same as "stateModifier"

Implements CStateCollection.

void CState::loadASCII FILE *  stream  ) 
 

Load from a text.

void CState::loadBinary FILE *  stream  ) 
 

Load from a binary.

void CState::resetState  ) 
 

Resets the state.

Sets all state-variables to 0, sets numActiveContinuousStates and numActiveDiscreteStates to the values given by the properties, so that all the state-variables are used.

void CState::saveASCII FILE *  stream  ) 
 

Save as text.

void CState::saveBinary FILE *  stream  ) 
 

Save as a binary.

virtual void CState::setContinuousState unsigned int  dim,
double  val
[virtual]
 

sets the dim th continuous state

virtual void CState::setDiscreteState unsigned int  dim,
int  val
[virtual]
 

sets the dim th discrete state

void CState::setNumActiveContinuousStates int  numActiveStates  ) 
 

sets the number of discrete state-variables used for the actual state

void CState::setNumActiveDiscreteStates int  numActiveStates  ) 
 

sets the number of continuous state-variables used for the actual state

void CState::setState CState copy  ) 
 

Sets all the values according to.

Parameters:
copy  . The properties have to be the same.

Member Data Documentation

int* CState::discreteState [protected]
 

array for the discrete states

unsigned int CState::numActiveContinuousStates [protected]
 

number of active continuous state-variables used by the actual state

unsigned int CState::numActiveDiscreteStates [protected]
 

number of active discrete state-variables used by the actual state


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