invertmotorspace.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __INVERTMOTORSPACE_H
00020 #define __INVERTMOTORSPACE_H
00021
00022 #include "invertmotorcontroller.h"
00023 #include <assert.h>
00024 #include <cmath>
00025
00026 #include <selforg/matrix.h>
00027 #include <selforg/noisegenerator.h>
00028
00029
00030
00031
00032
00033
00034
00035
00036 class InvertMotorSpace : public InvertMotorController {
00037
00038 public:
00039 InvertMotorSpace(int buffersize, double cInit = 0.1 , bool someInternalParams = true);
00040 virtual void init(int sensornumber, int motornumber, RandGen* randGen = 0);
00041
00042 virtual ~InvertMotorSpace();
00043
00044
00045 virtual int getSensorNumber() const { return number_sensors; }
00046
00047 virtual int getMotorNumber() const { return number_motors; }
00048
00049
00050
00051 virtual void step(const sensor* , int number_sensors, motor* , int number_motors);
00052
00053
00054 virtual void stepNoLearning(const sensor* , int number_sensors,
00055 motor* , int number_motors);
00056
00057
00058
00059 virtual bool store(FILE* f) const;
00060
00061 virtual bool restore(FILE* f);
00062
00063
00064 virtual std::list<ILayer> getStructuralLayers() const;
00065 virtual std::list<IConnection> getStructuralConnections() const;
00066
00067
00068 protected:
00069 unsigned short number_sensors;
00070 unsigned short number_motors;
00071
00072 matrix::Matrix A;
00073 matrix::Matrix C;
00074 matrix::Matrix R;
00075 matrix::Matrix H;
00076 matrix::Matrix B;
00077 NoiseGenerator* BNoiseGen;
00078 matrix::Matrix* x_buffer;
00079 matrix::Matrix* y_buffer;
00080 matrix::Matrix x_smooth;
00081
00082 bool someInternalParams;
00083 double cInit;
00084
00085
00086
00087 void fillBuffersAndControl(const sensor* x_, int number_sensors,
00088 motor* y_, int number_motors);
00089
00090
00091 virtual void learnController(const matrix::Matrix& x, const matrix::Matrix& x_smooth, int delay);
00092
00093
00094 virtual void learnModel( const matrix::Matrix& x, const matrix::Matrix& y);
00095
00096
00097 virtual matrix::Matrix calculateControllerValues(const matrix::Matrix& x_smooth);
00098
00099 };
00100
00101 #endif