MutualInformationController Class Reference

This is a controller who is passive at the moment, that means, he will not generate any motor values. More...

#include <mutualinformationcontroller.h>

Inherits AbstractController.

Inheritance diagram for MutualInformationController:

Inheritance graph
[legend]
Collaboration diagram for MutualInformationController:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 MutualInformationController (int sensorIntervalCount, double minSensorValue=-1, double maxSensorValue=1)
 Constructs the mutual information controller.
virtual ~MutualInformationController ()
virtual double & getMI (int index)
virtual double & getH_x (int index)
virtual double & getH_yx (int index)
virtual double & getH_Xsi (int index)
virtual void setAandCandCalcH_xsi (double ainit, double cinit)
 we like to calculate the entropy of the xsi, therefore we need for the (self calculated) update rule x_t+1=-a * tanh(c * x_t) the a and c, which should be set in the main.cpp.
virtual void init (int sensornumber, int motornumber, RandGen *randGen=0)
 initialisation of the controller with the given sensor/ motornumber Must NORMALLY be called before use.
virtual int getSensorNumber () const
virtual int getMotorNumber () const
virtual void step (const sensor *sensors, int sensornumber, motor *motors, int motornumber)
 performs one step (includes learning).
virtual void stepNoLearning (const sensor *sensors, int sensornumber, motor *motors, int motornumber)
 performs one step without learning.
virtual iparamkeylist getInternalParamNames () const
 The list of the names of all internal parameters given by getInternalParams().
virtual iparamvallist getInternalParams () const
virtual bool store (FILE *f) const
 stores the object to the given file stream (binary).
virtual bool restore (FILE *f)
 loads the object from the given file stream (binary).
Configurable::paramval getParam (const paramkey &key) const
bool setParam (const paramkey &key, paramval val)
Configurable::paramlist getParamList () const
 The list of all parameters with there value as allocated lists.

Protected Member Functions

virtual void calculateMIs (double *MI)
 Calculates the mutual information This is made by normal formula, which needs O(n^2) costs.
virtual void calculateH_x (double *H)
 Calculates the entropy of x This is made by normal formula, which needs O(n) costs.
virtual void calculateH_yx (double *H_yx)
 Calculates the conditional entropy of y|x This is made by normal formula, which needs O(n²) costs.
virtual void updateXsiFreqMatrixList (const sensor *sensors)
 Updates the xsi frequency matrix list.
virtual void calculateH_Xsi (double *H_Xsi)
 Calculates the entropy of H(Xsi) This is made by normal formula, which needs O(n) costs.
virtual void updateMIs (const sensor *sensors)
 Updates the mutual information This is made by a difference term, which is added to the old MI(t-1).
virtual int getState (double sensorValue)
 Returns the appropiate state which belongs to the given sensorValue.

Protected Attributes

paramval showF
paramval showP
bool initialized
bool useXsiCalculation
double minSensorValue
double maxSensorValue
int sensorIntervalCount
int sensorNumber
int motorNumber
std::list< matrix::Matrix * > freqMatrixList
std::list< matrix::Matrix * > probMatrixList
std::list< matrix::Matrix * > xsiFreqMatrixList
double * oldSensorStates
int t
double * MI
double * H_x
double * H_yx
double * H_Xsi
double ainit
double cinit

Detailed Description

This is a controller who is passive at the moment, that means, he will not generate any motor values.

This controller calculates the mutual information from one to the next time step. Note that many steps are neccessary for a good prediction of the mutual information.


Constructor & Destructor Documentation

MutualInformationController ( int  sensorIntervalCount,
double  minSensorValue = -1,
double  maxSensorValue = 1 
)

Constructs the mutual information controller.

At this time the controller is not yet initialized (this does the Agent).

Parameters:
minSensorValue is the minimum value the sensors can become
maxSensorValue is the maximum value the sensors can become
sensorIntervalCount is the number of the intervals used. This is important for generating the internal matrices.

virtual ~MutualInformationController (  )  [inline, virtual]


Member Function Documentation

void calculateH_x ( double *  H  )  [protected, virtual]

Calculates the entropy of x This is made by normal formula, which needs O(n) costs.

void calculateH_Xsi ( double *  H_Xsi  )  [protected, virtual]

Calculates the entropy of H(Xsi) This is made by normal formula, which needs O(n) costs.

void calculateH_yx ( double *  H_yx  )  [protected, virtual]

Calculates the conditional entropy of y|x This is made by normal formula, which needs O(n²) costs.

void calculateMIs ( double *  MI  )  [protected, virtual]

Calculates the mutual information This is made by normal formula, which needs O(n^2) costs.

virtual double& getH_x ( int  index  )  [inline, virtual]

virtual double& getH_Xsi ( int  index  )  [inline, virtual]

virtual double& getH_yx ( int  index  )  [inline, virtual]

std::list< Inspectable::iparamkey > getInternalParamNames (  )  const [virtual]

The list of the names of all internal parameters given by getInternalParams().

The naming convention is "v[i]" for vectors and "A[i][j]" for matrices, where i, j start at 0.

Returns:
: list of keys

Reimplemented from Inspectable.

std::list< Inspectable::iparamval > getInternalParams (  )  const [virtual]

Returns:
: list of values

Reimplemented from Inspectable.

virtual double& getMI ( int  index  )  [inline, virtual]

virtual int getMotorNumber (  )  const [inline, virtual]

Returns:
Number of motors the controller was initialised with or 0 if not initialised

Implements AbstractController.

Configurable::paramval getParam ( const paramkey key  )  const

Configurable::paramlist getParamList (  )  const [virtual]

The list of all parameters with there value as allocated lists.

Note that these are only parameters that are managed manually (with setParam, getParam)

See also:
getAllParamNames()
Returns:
list of key-value pairs

Reimplemented from Configurable.

virtual int getSensorNumber (  )  const [inline, virtual]

Returns:
Number of sensors the controller was initialised with or 0 if not initialised

Implements AbstractController.

int getState ( double  sensorValue  )  [protected, virtual]

Returns the appropiate state which belongs to the given sensorValue.

void init ( int  sensornumber,
int  motornumber,
RandGen randGen = 0 
) [virtual]

initialisation of the controller with the given sensor/ motornumber Must NORMALLY be called before use.

For all ControllerAdapters call first AbstractControllerAdapter::init(sensornumber,motornumber) if you overwrite this method

Implements AbstractController.

virtual bool restore ( FILE *  f  )  [inline, virtual]

loads the object from the given file stream (binary).

Implements Storeable.

void setAandCandCalcH_xsi ( double  ainit,
double  cinit 
) [virtual]

we like to calculate the entropy of the xsi, therefore we need for the (self calculated) update rule x_t+1=-a * tanh(c * x_t) the a and c, which should be set in the main.cpp.

bool setParam ( const paramkey key,
paramval  val 
)

void step ( const sensor sensors,
int  sensornumber,
motor motors,
int  motornumber 
) [virtual]

performs one step (includes learning).

Calculates motor commands from sensor inputs.

Parameters:
sensors sensors inputs scaled to [-1,1]
sensornumber length of the sensor array
motors motors outputs. MUST have enough space for motor values!
motornumber length of the provided motor array

Implements AbstractController.

void stepNoLearning ( const sensor sensors,
int  sensornumber,
motor motors,
int  motornumber 
) [virtual]

performs one step without learning.

See also:
step

Implements AbstractController.

virtual bool store ( FILE *  f  )  const [inline, virtual]

stores the object to the given file stream (binary).

Implements Storeable.

void updateMIs ( const sensor sensors  )  [protected, virtual]

Updates the mutual information This is made by a difference term, which is added to the old MI(t-1).

This function needs the OLD MI(t-1) AND the OLD F matrix, so update the MI with this function first before updating the F matrix! calculation costs: O(1)

void updateXsiFreqMatrixList ( const sensor sensors  )  [protected, virtual]

Updates the xsi frequency matrix list.


Member Data Documentation

double ainit [protected]

double cinit [protected]

std::list<matrix::Matrix*> freqMatrixList [protected]

double* H_x [protected]

double* H_Xsi [protected]

double* H_yx [protected]

bool initialized [protected]

double maxSensorValue [protected]

double* MI [protected]

double minSensorValue [protected]

int motorNumber [protected]

double* oldSensorStates [protected]

std::list<matrix::Matrix*> probMatrixList [protected]

int sensorIntervalCount [protected]

int sensorNumber [protected]

paramval showF [protected]

paramval showP [protected]

int t [protected]

bool useXsiCalculation [protected]

std::list<matrix::Matrix*> xsiFreqMatrixList [protected]


The documentation for this class was generated from the following files:
Generated on Fri Oct 30 16:29:02 2009 for Robot Simulator of the Robotics Group for Self-Organization of Control by  doxygen 1.4.7