20 #ifndef __HOMEOKINBASE_H
21 #define __HOMEOKINBASE_H
39 const std::string& name,
const std::string& revision)
79 int number_steps_of_delay_){
81 assert ((
unsigned)number_steps_of_delay_ <
buffersize);
82 return buffer[(
t - number_steps_of_delay_) %
buffersize];
87 int number_steps_for_averaging_){
89 assert ((
int)number_steps_for_averaging_ <=
buffersize);
92 for (
int k = 1; k < number_steps_for_averaging_; k++) {
93 result += buffer[(
t - k +
buffersize) % buffersize];
95 result *= 1/((double) (number_steps_for_averaging_));
101 double error_factor = 1;
103 error_factor= 1/(e.
multTM().
val(0,0)+0.000001)*0.01;
106 error_factor= 1/sqrt(e.
multTM().
val(0,0)+0.000001)*0.1;
113 static double g(
double z)
paramval squashSize
size of the box, where the parameter updates are clipped to
Definition: homeokinbase.h:65
Matrix type.
Definition: matrix.h:65
paramint s4avg
number of timesteps used for smoothing the controller output values
Definition: homeokinbase.h:60
paramint logaE
logarithmic error is used for learning 1: controller 2: model 3: both
Definition: homeokinbase.h:61
paramint s4delay
number of timesteps of delay in the SML
Definition: homeokinbase.h:59
Abstract class for robot controller (with some basic functionality).
Definition: abstractcontroller.h:46
virtual matrix::Matrix calculateSmoothValues(const matrix::Matrix *buffer, int number_steps_for_averaging_)
calculate time-smoothed values
Definition: homeokinbase.h:86
paramval epsA
learning rate factor for model learning
Definition: homeokinbase.h:57
D val(I i, I j) const
Definition: matrix.h:96
Abstract class (interface) for robot controller that use are based on the homeokinetic prinziple...
Definition: homeokinbase.h:36
static double g(double z)
neuron transfer function
Definition: homeokinbase.h:113
virtual matrix::Matrix calculateDelayedValues(const matrix::Matrix *buffer, int number_steps_of_delay_)
calculate delayed values
Definition: homeokinbase.h:78
unsigned short buffersize
Definition: homeokinbase.h:68
paramint rootE
root error is used for learning 1: controller 2: model 3: both
Definition: homeokinbase.h:62
void putInBuffer(matrix::Matrix *buffer, const matrix::Matrix &vec, int delay=0)
put new value in ring buffer
Definition: homeokinbase.h:73
bool initialised
Definition: homeokinbase.h:69
double paramval
Definition: configurable.h:88
Matrix multTM() const
optimised multiplication of transpsoed of Matrix with itself: M^T * M
Definition: matrix.cpp:654
virtual double calcErrorFactor(const matrix::Matrix &e, bool loga, bool root)
calculates the error_factor for either logarithmic (E=ln(e^T*e)) or square (E=sqrt(e^t*e)) error ...
Definition: homeokinbase.h:100
paramval epsC
learning rate factor for controller learning
Definition: homeokinbase.h:56
int paramint
Definition: configurable.h:98
virtual void addParameterDef(const paramkey &key, paramval *val, paramval def, paramval minBound, paramval maxBound, const paramdescr &descr=paramdescr())
This function is only provided for convenience.
Definition: configurable.h:220
paramval factorB
additional learning rate factor for model bias
Definition: homeokinbase.h:58
HomeokinBase(unsigned short buffersize, const std::string &name, const std::string &revision)
Definition: homeokinbase.h:38
int t
Definition: homeokinbase.h:67