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

CParameters Class Reference

This class represents a parameterset. More...

#include <cparameters.h>

Inheritance diagram for CParameters:

CParameterObject CAbstractBetaCalculator CAbstractQETraces CAbstractVETraces CActionDistribution CAdaptiveEtaCalculator CAdaptiveParameterCalculator CAgentController CBatchDataGenerator CCAGradientPolicyInputDerivationCalculator CDataCollector CErrorListener CExtraRegressionForestTrainer CGradientCalculator CGradientFunctionUpdater CGradientLearner CGradientUpdateFunction CLearnDataObject CLeastSquaresLearner CMonteCarloError CPolicyEvaluation CPolicyIteration CReinforcementBaseLineCalculator CResidualGradientFunction CSemiMDPListener CSupervisedLearner CSupervisedQFunctionLearner CSupervisedQFunctionWeightedLearner CSupervisedWeightedLearner CTestSuite CTestSuiteEvaluator CTransitionFunction CTransitionFunctionInputDerivationCalculator CValueIteration CVFunctionInputDerivationCalculator List of all members.


Public Member Functions

  CParameters ()
  Create new parameter set.

  CParameters (CParameters &copy)
  Create new parameter set and copy the given reference.

virtual  ~CParameters ()
bool  containsParameters (CParameters *parameters)
void  loadParameters (FILE *stream)
void  saveParameters (FILE *stream)
void  loadParametersStream (istream *stream)
void  saveParametersStream (ostream *stream)
void  saveParametersXML (FILE *stream)
  save in XML-style

void  loadParametersXML (FILE *stream)
  load from XML-style stream

virtual void  addParameter (string name, double value)
  Add the paramter with the given name and set value as default.

virtual void  addParameters (CParameters *parameters)
  Add all paramters of the given parameter set to the current parameter set.

virtual void  removeParameter (string name)
  Remove parameter from set.

virtual double  getParameter (string name)
  returns the parameter value

virtual void  setParameter (string name, double value)
  Set the parameter to the given value.

virtual void  setParameters (CParameters *parameters)
  sets all parameters which are in both parameter set to the values of the given action set

double  getParameterFromIndex (unsigned int index)
  get parameter value from its index

string  getParameterName (unsigned int index)
  get parameter name from its index

void  setParameterWithIndex (unsigned int index, double value)
  set parameter value with its index

int  getParameterIndex (string name)
  get the index of the parameter

int  getNumParameters ()
void  setAsAdaptiveParameter (string parameter, bool adaptive)
bool  isAdaptiveParameter (string parameter)
virtual bool  operator== (CParameters &parameters)
  returns true if all parameters are the same

bool  operator< (CParameters &paramters)
  compares 2 parameter sets (needed for the parameter maps)



Protected Attributes

std::map< string, double > *  parameters
std::map< string, bool > *  isAdaptive

Detailed Description

This class represents a parameterset.

In the RL toolbox many objects, like learning algorithms have different parameters like the learning rate or the discount factor. The toolbox supports a general parameter handling for nearly all parameters of all the different classes. All these parameters can be set by a unified interface, which is supported by the class CParameters. Every parameter in the toolbox is represented by its parameter name as a string and its parameter value. The toolbox provides methods to:

  • set a Parameter value: In order to set a paramter just call the method setParameter(string parameterName, double value), with the name of the parameter and the value as argument. If you specify a parameter that doesn't exist you will get a warning message on the standard output,
  • get a Parameter value: Retrieve the value of a parameter with getParameter(string paramName). If you specify a name that doesn't exist you will get an assertation, so be careful when typing the names (or copy them).
  • add a Parameter: A parameter can be added to the parameterset by the function addParameter, where you define the parameters name and its default value. If the parameter has already be added to the parameterset nothing happens (the default value won't be set too). Before a paramter is added, his value can't be set or retrieved. Parameters are usually double values, but there are cases where integer or bool values are needed. If a parameter represents a integer value, it is rounded each time it is used. For boolean values, the >= 0.5 operator is used on the parameter value ( so 0.0 is false and 1.0 is true). If you want to know more about the parameters of an object please consult the class reference of the specific object. The parameters set of an object can also be printed to standard output by calling the method saveParameters(stdout), which is a good way to see which parameters an specific object has. The name and the value are stored in the parameters map of the CParameter object. The class also provides methods for saving and loading parameter sets. You have the possibility to read/write the parameterset from/to a FILE stream, or a stream object. There is also the possibility to save the parameterset in xml style (without header). For more details on parameter handling see the class reference of CParameterObject or the Manual.

Constructor & Destructor Documentation

CParameters::CParameters  ) 
 

Create new parameter set.

CParameters::CParameters CParameters copy  ) 
 

Create new parameter set and copy the given reference.

virtual CParameters::~CParameters  )  [virtual]
 

Member Function Documentation

virtual void CParameters::addParameter string  name,
double  value
[virtual]
 

Add the paramter with the given name and set value as default.

If the parameter is already in the parameter set, the default value is not set!

virtual void CParameters::addParameters CParameters parameters  )  [virtual]
 

Add all paramters of the given parameter set to the current parameter set.

bool CParameters::containsParameters CParameters parameters  ) 
 
int CParameters::getNumParameters  ) 
 
virtual double CParameters::getParameter string  name  )  [virtual]
 

returns the parameter value

Attention: throws an assertation if the parameter is unknown!!!

Reimplemented in CParameterObject.

double CParameters::getParameterFromIndex unsigned int  index  ) 
 

get parameter value from its index

int CParameters::getParameterIndex string  name  ) 
 

get the index of the parameter

string CParameters::getParameterName unsigned int  index  ) 
 

get parameter name from its index

bool CParameters::isAdaptiveParameter string  parameter  ) 
 
void CParameters::loadParameters FILE *  stream  ) 
 
void CParameters::loadParametersStream istream *  stream  ) 
 
void CParameters::loadParametersXML FILE *  stream  ) 
 

load from XML-style stream

bool CParameters::operator< CParameters paramters  ) 
 

compares 2 parameter sets (needed for the parameter maps)

virtual bool CParameters::operator== CParameters parameters  )  [virtual]
 

returns true if all parameters are the same

Reimplemented in CParameterObject.

virtual void CParameters::removeParameter string  name  )  [virtual]
 

Remove parameter from set.

void CParameters::saveParameters FILE *  stream  ) 
 
void CParameters::saveParametersStream ostream *  stream  ) 
 
void CParameters::saveParametersXML FILE *  stream  ) 
 

save in XML-style

This is just pseudo-xml, so ne formatting rules or header is written.

void CParameters::setAsAdaptiveParameter string  parameter,
bool  adaptive
 
virtual void CParameters::setParameter string  name,
double  value
[virtual]
 

Set the parameter to the given value.

Prints a warning if the parameter is unknown

Reimplemented in CParameterObject, and CPendulumModel.

virtual void CParameters::setParameters CParameters parameters  )  [virtual]
 

sets all parameters which are in both parameter set to the values of the given action set

Reimplemented in CParameterObject.

void CParameters::setParameterWithIndex unsigned int  index,
double  value
 

set parameter value with its index


Member Data Documentation

std::map<string, bool>* CParameters::isAdaptive [protected]
 
std::map<string, double>* CParameters::parameters [protected]
 

Reimplemented in CPolicyGradientWeightDecayListener.


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