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.
List of all members.
Public Member Functions |
| MutualInformationController (int sensorIntervalCount, double minSensorValue=-1, double maxSensorValue=1, bool showF=false, bool showP=false, bool showXsiF=false) |
| 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 bool | store (FILE *f) const |
| The list of the names of all internal parameters given by getInternalParams().
|
virtual bool | restore (FILE *f) |
| loads the object from the given file stream (binary).
|
Static Public Attributes |
static const int | numberSensorsPreInitialized = 10 |
static const int | numberMotorsPreInitialized = 2 |
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.
|
virtual void | internalInit (int sensornumber, int motornumber, RandGen *randGen=0) |
| Does the pre-initialization functionality.
|
Protected Attributes |
parambool | showF |
parambool | showP |
parambool | showXsiF |
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 necessary for a good prediction of the mutual information.
Constructor & Destructor Documentation
MutualInformationController |
( |
int |
sensorIntervalCount, |
|
|
double |
minSensorValue = -1 , |
|
|
double |
maxSensorValue = 1 , |
|
|
bool |
showF = false , |
|
|
bool |
showP = false , |
|
|
bool |
showXsiF = false | |
|
) |
| | |
Constructs the mutual information controller.
At this time the controller is not yet initialized (this does the Agent).
- Parameters:
-
| sensorIntervalCount | is the number of the intervals used. This is important for generating the internal matrices. |
| minSensorValue | is the minimum value the sensors can become |
| maxSensorValue | is the maximum value the sensors can become |
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] |
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.
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.
void internalInit |
( |
int |
sensornumber, |
|
|
int |
motornumber, |
|
|
RandGen * |
randGen = 0 | |
|
) |
| | [protected, virtual] |
Does the pre-initialization functionality.
- Parameters:
-
| sensornumber | |
| motornumber | |
| randGen | |
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.
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] |
virtual bool store |
( |
FILE * |
f |
) |
const [inline, 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
-
: list of values 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* H_Xsi [protected] |
The documentation for this class was generated from the following files: