#include <mutualinformationcontroller.h>
Inherits AbstractController.
Inheritance diagram for MutualInformationController:


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 |
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.
| 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).
| 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] |
| 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.
Reimplemented from Inspectable.
| std::list< Inspectable::iparamval > getInternalParams | ( | ) | const [virtual] |
| virtual double& getMI | ( | int | index | ) | [inline, virtual] |
| virtual int getMotorNumber | ( | ) | const [inline, virtual] |
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)
Reimplemented from Configurable.
| virtual int getSensorNumber | ( | ) | const [inline, virtual] |
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] |
| 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.
performs one step (includes learning).
Calculates motor commands from sensor inputs.
| 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.
| virtual bool store | ( | FILE * | f | ) | const [inline, virtual] |
| 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.
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] |
int t [protected] |
bool useXsiCalculation [protected] |
std::list<matrix::Matrix*> xsiFreqMatrixList [protected] |
1.4.7