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

CStateList Class Reference

Class for logging a list of States. More...

#include <cstate.h>

Inheritance diagram for CStateList:

CStateObject List of all members.


Public Member Functions

  CStateList (CStateProperties *properties)
  Creates a state list.

virtual  ~CStateList ()
void  addState (CState *state)
  add a state to the state list

void  getState (unsigned int num, CState *state)
  Get a state from the state list.

void  removeLastState ()
void  removeFirstState ()
virtual void  loadBIN (FILE *stream)
  load a statelist from a binary file

virtual void  saveBIN (FILE *stream)
  save the statelist to a binary file

virtual void  loadASCII (FILE *stream)
  load a statelist from a text file

virtual void  saveASCII (FILE *stream)
  save the statelist to a text file

unsigned int  getNumStates ()
  get the number of states in the list

void  clear ()


Protected Attributes

std::vector< std::vector<

double > * > * 
continuousStates
  vectors for the continuous state variables

std::vector< std::vector<

int > * > * 
discreteStates
  vectors for the discrete state variables

std::vector< bool > *  resetStates
int  numStates
  number of states saved


Detailed Description

Class for logging a list of States.

The class maintains a list of double and a list of integer vectors. For each state variable defined in its state properties there is an own vector. So only states with the same properties as the state list can be added. When a state is added with addState(...) the state gets decomposed in its state variables, and each value of the state variable is added to its vector. So the CStateList class doesn't save the State object itself, it only saves the state variables. This is done due to performance reasons because by saving the state object a new CState object would have to be instantiated each time.

To Retrieve a state from the List you have to call the function getState(int num, CState *state). The values of the num th state are then filled in the specified state object.


Constructor & Destructor Documentation

CStateList::CStateList CStateProperties properties  ) 
 

Creates a state list.

The number of vectors for the discrete and continuous state variables are taken from the properties object

virtual CStateList::~CStateList  )  [virtual]
 

Member Function Documentation

void CStateList::addState CState state  ) 
 

add a state to the state list

The state must have the same properties as the state list object. The state gets then decomposed in its state-variables and the state variables are stored.

void CStateList::clear  ) 
 
unsigned int CStateList::getNumStates  ) 
 

get the number of states in the list

void CStateList::getState unsigned int  num,
CState state
 

Get a state from the state list.

The state must have the same properties as the state list object. The state variables of the num th state are retrieved from the vectors and set in the state object.

Parameters:
num  Number of the state to retrieve
state  The state object in which the retrieved state variables are filled in
virtual void CStateList::loadASCII FILE *  stream  )  [virtual]
 

load a statelist from a text file

The saved statelist must have had the same properties as the state list (at least same number of discrete and continuous states).

virtual void CStateList::loadBIN FILE *  stream  )  [virtual]
 

load a statelist from a binary file

The saved statelist must have had the same properties as the state list (at least same number of discrete and continuous states).

void CStateList::removeFirstState  ) 
 
void CStateList::removeLastState  ) 
 
virtual void CStateList::saveASCII FILE *  stream  )  [virtual]
 

save the statelist to a text file

virtual void CStateList::saveBIN FILE *  stream  )  [virtual]
 

save the statelist to a binary file


Member Data Documentation

std::vector<std::vector<double> *>* CStateList::continuousStates [protected]
 

vectors for the continuous state variables

std::vector<std::vector<int> *>* CStateList::discreteStates [protected]
 

vectors for the discrete state variables

int CStateList::numStates [protected]
 

number of states saved

std::vector<bool>* CStateList::resetStates [protected]
 

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