20 #ifndef __INVERTMOTORNSTEP_H
21 #define __INVERTMOTORNSTEP_H
29 #include <selforg/matrix.h>
30 #include <selforg/noisegenerator.h>
60 virtual void init(
int sensornumber,
int motornumber,
RandGen* randGen = 0);
79 virtual bool store(FILE* f)
const;
227 virtual void calcXsi(
int delay);
282 static double clip095(
double x);
paramval squashSize
size of the box, where the parameter updates are clipped to
Definition: homeokinbase.h:65
Matrix type.
Definition: matrix.h:65
virtual int getMotorNumber() const
returns the mumber of motors the controller was initialised with or 0 if not initialised ...
Definition: invertmotornstep.h:67
InvertMotorNStep(const InvertMotorNStepConf &conf=getDefaultConf())
Definition: invertmotornstep.cpp:26
matrix::Matrix initialC
initial controller matrix C (if not given then randomly chosen, see cInit, cNonDiag...)
Definition: invertmotornstep.h:34
double getE() const
Definition: invertmotornstep.h:158
void kwtaInhibition(matrix::Matrix &weightmatrix, unsigned int k, double damping)
k-winner take all inhibition for synapses.
Definition: invertmotornstep.cpp:605
Interface for teachable controller.
Definition: teachable.h:32
virtual void setMotorTeachingSignal(const motor *teaching, int len)
The given motor teaching signal is used for this timestep.
Definition: invertmotornstep.cpp:692
double reinforcement
reinforcement value (set via setReinforcement())
Definition: invertmotornstep.h:190
bool someInternalParams
someInternalParams if true only some internal parameters are exported, all otherwise ...
Definition: invertmotornstep.h:45
matrix::Matrix S
additional Model Matrix (sensors to sensors)
Definition: invertmotornstep.h:166
double E_val
value of Error function
Definition: invertmotornstep.h:178
virtual matrix::Matrix getLastMotorValues()
returns the last motor values (useful for cross motor coupling)
Definition: invertmotornstep.cpp:730
InvertMotorNStepConf conf
Definition: invertmotornstep.h:214
virtual matrix::Matrix getLastSensorValues()
returns the last sensor values (useful for cross sensor coupling)
Definition: invertmotornstep.cpp:734
matrix::Matrix getSensorWeights() const
Definition: invertmotornstep.h:154
matrix::Matrix R
C*A.
Definition: invertmotornstep.h:174
virtual void setSensorTeaching(const matrix::Matrix &teaching)
The given sensor teaching signal (distal learning) is used for this timestep.
Definition: invertmotornstep.cpp:723
bool useSD
useSD decides whether to use the SD matrix in addition to the A matrix (sees first and second derivat...
Definition: invertmotornstep.h:41
virtual ~InvertMotorNStep()
Definition: invertmotornstep.cpp:81
matrix::Matrix * y_buffer
Definition: invertmotornstep.h:183
D val(I i, I j) const
Definition: matrix.h:96
double sensor
Definition: types.h:29
virtual void setReinforcement(double reinforcement)
set the reinforcement signal for this timestep.
Definition: invertmotornstep.cpp:739
random generator with 48bit integer arithmentic
Definition: randomgenerator.h:34
int buffersize
buffersize size of the time-buffer for x,y,eta
Definition: invertmotornstep.h:33
virtual matrix::Matrix calculateControllerValues(const matrix::Matrix &x_smooth)
returns controller output for given sensor values
Definition: invertmotornstep.cpp:545
int numberContext
number of context sensors(considered at the end of the sensor vector.
Definition: invertmotornstep.h:44
paramval inhibition
inhibition strength for sparce kwta strategy (is scaled with epsC)
Definition: invertmotornstep.h:201
matrix::Matrix * eta_buffer
Definition: invertmotornstep.h:184
virtual void calcEtaAndBufferIt(int delay)
calculates the first shift into the motor space useing delayed motor values.
Definition: invertmotornstep.cpp:255
virtual std::list< ILayer > getStructuralLayers() const
Specifies which parameter vector forms a structural layer (in terms of a neural network) The ordering...
Definition: invertmotornstep.cpp:669
virtual void learnModel(int delay)
learn A, (and S) using motors y and corresponding sensors x
Definition: invertmotornstep.cpp:490
virtual void management()
handles inhibition damping etc.
Definition: invertmotornstep.cpp:583
matrix::Matrix x_smooth
Definition: invertmotornstep.h:186
matrix::Matrix SmallID
small identity matrix in the dimension of R
Definition: invertmotornstep.h:175
Definition: invertmotornstep.h:32
void calcCandHUpdatesTeaching(matrix::Matrix &C_update, matrix::Matrix &H_update, int y_delay)
calculates the Update for C and H using the teaching signal
Definition: invertmotornstep.cpp:455
matrix::Matrix zero_eta
Definition: invertmotornstep.h:185
double sensor
Definition: abstractcontroller.h:48
virtual void learnController(int delay)
learn H,C with motors y and corresponding sensors x
Definition: invertmotornstep.cpp:318
matrix::Matrix sensorweights
sensor channel weight (each channel gets a certain importance)
Definition: invertmotornstep.h:194
unsigned short number_motors
Definition: invertmotornstep.h:162
double paramval
Definition: configurable.h:88
Extended HomeokinBase class (still abstract) for robot controller work in motorspace and use possibly...
Definition: invertmotorcontroller.h:36
void getLastMotors(motor *motors, int len)
Definition: invertmotornstep.cpp:550
static double regularizedInverse(double v)
Definition: invertmotornstep.cpp:248
double xsi_norm
norm of matrix
Definition: invertmotornstep.h:179
virtual void step(const sensor *, int number_sensors, motor *, int number_motors)
performs one step (includes learning).
Definition: invertmotornstep.cpp:163
double cNonDiagAbs
cNonDiag is the value of the nondiagonal elements
Definition: invertmotornstep.h:37
virtual void calcXsi(int delay)
calculates xsi for the current time step using the delayed y values
Definition: invertmotornstep.cpp:287
double pain
if the modelling error (xsi) is too high we have a pain signal
Definition: invertmotornstep.h:181
paramval kwta
(int) number of synapses that get strengthend
Definition: invertmotornstep.h:202
double cInit
cInit size of the C matrix to initialised with.
Definition: invertmotornstep.h:35
virtual void fillBuffersAndControl(const sensor *x_, int number_sensors, motor *y_, int number_motors)
puts the sensors in the ringbuffer, generate controller values and put them in the ...
Definition: invertmotornstep.cpp:208
virtual void stepNoLearning(const sensor *, int number_sensors, motor *, int number_motors)
performs one step without learning. Calulates motor commands from sensor inputs.
Definition: invertmotornstep.cpp:200
static double clip095(double x)
Definition: invertmotornstep.cpp:687
virtual matrix::Matrix model(const matrix::Matrix *x_buffer, int delay, const matrix::Matrix &y)
calculates the predicted sensor values
Definition: invertmotornstep.cpp:299
NoiseGenerator * BNoiseGen
Noisegenerator for noisy bias.
Definition: invertmotornstep.h:172
virtual bool restore(FILE *f)
loads the controller values from a given file.
Definition: invertmotornstep.cpp:655
matrix::Matrix SD
additional Model Matrix (sensors derivatives to sensors)
Definition: invertmotornstep.h:167
paramval cfactor
Definition: invertmotornstep.h:207
struct InvertMotorNStepConf InvertMotorNStepConf
Matrix multTM() const
optimised multiplication of transpsoed of Matrix with itself: M^T * M
Definition: matrix.cpp:654
double cNonDiag
cNonDiag is the size of the nondiagonal elements in respect to the diagonal (cInit) ones ...
Definition: invertmotornstep.h:36
void limitC(matrix::Matrix &weightmatrix, unsigned int rfSize)
sets all connections to zero which are further away then rfSize from the diagonal.
Definition: invertmotornstep.cpp:628
void setSensorWeights(const matrix::Matrix &weights)
sets the sensor channel weights (matrix should be (getSensorNumber() x 1)
Definition: invertmotornstep.cpp:563
static InvertMotorNStepConf getDefaultConf()
Definition: invertmotornstep.h:139
matrix::Matrix calcDerivatives(const matrix::Matrix *buffer, int delay)
Calculates first and second derivative and returns both in on matrix (above).
Definition: invertmotornstep.cpp:575
int managementInterval
interval between subsequent management function calls
Definition: invertmotornstep.h:200
double reinforcefactor
reinforcement factor (set to 1 every step after learning)
Definition: invertmotornstep.h:191
double xsi_norm_avg
average norm of xsi (used to define whether Modell learns)
Definition: invertmotornstep.h:180
bool useTeaching
flag whether there is an actual teachning signal or not
Definition: invertmotornstep.h:189
matrix::Matrix A
Model Matrix (motors to sensors)
Definition: invertmotornstep.h:165
paramval dampS
damping of S matrix
Definition: invertmotornstep.h:204
matrix::Matrix v
current reconstructed error
Definition: invertmotornstep.h:177
double motor
Definition: types.h:30
class for robot controller that uses the georg's matrixlib for direct matrix inversion for n channels...
Definition: invertmotornstep.h:55
paramval cnondiagabs
Definition: invertmotornstep.h:208
paramval activeExplore
decides whether and how strong the backpropagated error is used as a control signal ...
Definition: invertmotornstep.h:206
virtual void init(int sensornumber, int motornumber, RandGen *randGen=0)
initialisation of the controller with the given sensor/ motornumber Must be called before use...
Definition: invertmotornstep.cpp:94
matrix::Matrix B
Model Bias.
Definition: invertmotornstep.h:170
virtual void setMotorTeaching(const matrix::Matrix &teaching)
The given motor teaching signal is used for this timestep.
Definition: invertmotornstep.cpp:714
bool useS
useS decides whether to use the S matrix in addition to the A matrix (sees sensors) ...
Definition: invertmotornstep.h:38
virtual void setSensorTeachingSignal(const sensor *teaching, int len)
The given sensor teaching signal (distal learning) is used for this timestep.
Definition: invertmotornstep.cpp:700
double modelCompliant
learning factor for model (or sensor) compliant learning
Definition: invertmotornstep.h:199
matrix::Matrix H
Controller Bias.
Definition: invertmotornstep.h:169
paramval dampC
damping of C matrix
Definition: invertmotornstep.h:205
virtual bool store(FILE *f) const
stores the controller values to a given file.
Definition: invertmotornstep.cpp:642
matrix::Matrix * x_buffer
Definition: invertmotornstep.h:182
unsigned short number_sensors
Definition: invertmotornstep.h:161
paramval limitRF
(int) receptive field of motor neurons (number of offcenter sensors) if null then no limitation...
Definition: invertmotornstep.h:203
matrix::Matrix C
Controller Matrix.
Definition: invertmotornstep.h:168
virtual void calcCandHUpdates(matrix::Matrix &C_update, matrix::Matrix &H_update, int delay)
calculates the Update for C and H
Definition: invertmotornstep.cpp:341
double motor
Definition: abstractcontroller.h:49
virtual std::list< IConnection > getStructuralConnections() const
Specifies which parameter matrix forms a connection between layers (in terms of a neural network) The...
Definition: invertmotornstep.cpp:678
matrix::Matrix xsi
current output error
Definition: invertmotornstep.h:176
virtual int getSensorNumber() const
returns the number of sensors the controller was initialised with or 0 if not initialised ...
Definition: invertmotornstep.h:65
paramval cdiagabs
Definition: invertmotornstep.h:209
virtual void updateCandH(const matrix::Matrix &C_update, const matrix::Matrix &H_update, double squashSize)
updates the matrix C and H
Definition: invertmotornstep.cpp:481
double continuity
factor to teach for continuity: subsequent motor commands should not differ too much ...
Definition: invertmotornstep.h:198
paramval noiseY
noise strength for y
Definition: invertmotornstep.h:212
int t_rand
initial random time to avoid syncronous management of all controllers
Definition: invertmotornstep.h:192
int c
Definition: hexapod.cpp:56
void getLastSensors(sensor *sensors, int len)
Definition: invertmotornstep.cpp:556
matrix::Matrix y_teaching
teaching motor signal
Definition: invertmotornstep.h:188
Interface and basic class for noise generator.
Definition: noisegenerator.h:37
matrix::Matrix & getC()
reference to C-matrix
Definition: invertmotornstep.h:156
NoiseGenerator * YNoiseGen
Noisegenerator for noisy motor output.
Definition: invertmotornstep.h:173