22 #include <selforg/abstractcontroller.h>
23 #include <selforg/controller_misc.h>
28 #include <selforg/matrix.h>
29 #include <selforg/teachable.h>
30 #include <selforg/parametrizable.h>
63 Sox(
double init_feedback_strength,
bool useExtendedModel =
true,
64 bool useTeaching =
false );
66 virtual void init(
int sensornumber,
int motornumber,
RandGen* randGen = 0);
107 virtual bool store(FILE* f)
const;
126 virtual std::list<matrix::Matrix>
getParameters()
const override;
127 virtual int setParameters(
const std::list<matrix::Matrix>& params)
override;
173 virtual void learn();
176 static double g(
double z)
182 static double g_s(
double z)
189 static double clip(
double r,
double x){
Matrix type.
Definition: matrix.h:65
paramval sense
Definition: sox.h:158
matrix::Matrix y_teaching
Definition: sox.h:155
Interface for teachable controller.
Definition: teachable.h:32
virtual matrix::Matrix getLastMotorValues()
returns the last motor values (useful for cross motor coupling)
Definition: sox.cpp:345
virtual matrix::Matrix geth()
Definition: sox.cpp:154
Abstract class for robot controller (with some basic functionality).
Definition: abstractcontroller.h:46
int t
Definition: sox.h:148
paramval gamma
Definition: sox.h:165
virtual void setSensorTeaching(const matrix::Matrix &teaching)
The given sensor teaching signal (distal learning) is used for this timestep.
Definition: sox.cpp:337
static double clip(double r, double x)
function that clips the second argument to the interval [-first,first]
Definition: sox.h:189
static const unsigned short buffersize
Definition: sox.h:132
matrix::Matrix R
Definition: sox.h:140
virtual void motorBabblingStep(const sensor *, int number_sensors, const motor *, int number_motors)
called during babbling phase
Definition: sox.cpp:210
Sox(const SoxConf &conf=getDefaultConf())
constructor
Definition: sox.cpp:24
matrix::Matrix x
Definition: sox.h:146
paramval creativity
Definition: sox.h:157
static double g_s(double z)
derivative of g
Definition: sox.h:182
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: sox.cpp:96
unsigned short number_motors
Definition: sox.h:131
bool intern_isTeaching
Definition: sox.h:154
double factorh
factor for learning rate of h
Definition: sox.h:48
virtual std::list< matrix::Matrix > getParameters() const override
Returns a list of matrices that parametrize the controller.
Definition: sox.cpp:353
double sensor
Definition: types.h:29
unsigned short number_sensors
Definition: sox.h:130
virtual matrix::Matrix getC()
Definition: sox.cpp:145
static SoxConf getDefaultConf()
Definition: sox.h:70
random generator with 48bit integer arithmentic
Definition: randomgenerator.h:34
int steps4Averaging
of steps the sensors are averaged (1 means no averaging)
Definition: sox.h:40
matrix::Matrix v_avg
Definition: sox.h:145
matrix::Matrix S
Definition: sox.h:136
static double one_over(double x)
calculates the inverse the argument (useful for Matrix::map)
Definition: sox.h:193
SoxConf conf
configuration objects
Definition: sox.h:152
double factorb
factor for learning rate of b
Definition: sox.h:47
matrix::Matrix x_buffer[buffersize]
Definition: sox.h:144
virtual void step(const sensor *, int number_sensors, motor *, int number_motors)
performs one step (includes learning).
Definition: sox.cpp:164
paramint pseudo
Definition: sox.h:161
paramval epsC
Definition: sox.h:162
This controller implements the standard algorihm described the the Chapter 5 (Homeokinesis) with exte...
Definition: sox.h:56
double paramval
Definition: configurable.h:88
bool someInternalParams
if true only some internal parameters are exported
Definition: sox.h:43
virtual void setA(const matrix::Matrix &A)
Definition: sox.cpp:140
virtual matrix::Matrix getLastSensorValues()
returns the last sensor values (useful for cross sensor coupling)
Definition: sox.cpp:349
virtual void learn()
learn values model and controller (A,b,C,h)
Definition: sox.cpp:258
bool onlyMainParameters
if true only some configurable parameters are exported
Definition: sox.h:44
matrix::Matrix b
Definition: sox.h:138
virtual bool store(FILE *f) const
stores the controller values to a given file.
Definition: sox.cpp:374
virtual void seth(const matrix::Matrix &h)
Definition: sox.cpp:158
double max(const matrix::Matrix &v)
returns the largest element
Definition: controller_misc.cpp:318
matrix::Matrix A
Definition: sox.h:134
bool loga
Definition: sox.h:150
bool useExtendedModel
if true, the extended model (S matrix) is used
Definition: sox.h:36
void constructor()
Definition: sox.cpp:42
int steps4Delay
of steps the motor values are delayed (1 means no delay)
Definition: sox.h:42
virtual void setMotorTeaching(const matrix::Matrix &teaching)
The given motor teaching signal is used for this timestep.
Definition: sox.cpp:328
virtual bool restore(FILE *f)
loads the controller values from a given file.
Definition: sox.cpp:386
int paramint
Definition: configurable.h:98
virtual void stepNoLearning(const sensor *, int number_sensors, motor *, int number_motors)
performs one step without learning. Calulates motor commands from sensor inputs.
Definition: sox.cpp:180
double motor
Definition: types.h:30
using ParameterList = std::list<matrix::Matrix>;
Definition: parametrizable.h:39
matrix::Matrix C
Definition: sox.h:135
matrix::Matrix h
Definition: sox.h:137
paramval harmony
Definition: sox.h:159
double initFeedbackStrength
initial strength of sensor to motor connection
Definition: sox.h:35
virtual int getSensorNumber() const
returns the number of sensors the controller was initialised with or 0 if not initialised ...
Definition: sox.h:88
paramval epsA
Definition: sox.h:163
paramval causeaware
Definition: sox.h:160
virtual void setC(const matrix::Matrix &C)
Definition: sox.cpp:149
double min(const matrix::Matrix &v)
returns the smallest element
Definition: controller_misc.cpp:307
virtual int getMotorNumber() const
returns the mumber of motors the controller was initialised with or 0 if not initialised ...
Definition: sox.h:90
paramval damping
Definition: sox.h:164
matrix::Matrix pseudoInvL(const matrix::Matrix &L, const matrix::Matrix &A, const matrix::Matrix &C)
Definition: sox.cpp:246
double factorS
factor for learning rate of S
Definition: sox.h:46
configuration object for Sox controller. Use Sox::getDefaultConf().
Definition: sox.h:34
virtual int setParameters(const std::list< matrix::Matrix > ¶ms) override
sets the parameters.
Definition: sox.cpp:357
virtual matrix::Matrix getA()
Definition: sox.cpp:136
virtual ~Sox()
Definition: sox.cpp:92
static double g(double z)
neuron transfer function
Definition: sox.h:176
matrix::Matrix x_smooth
Definition: sox.h:147
matrix::Matrix L
Definition: sox.h:139
matrix::Matrix y_buffer[buffersize]
Definition: sox.h:143
bool useTeaching
if true the controller can be taught see teachable interface
Definition: sox.h:38
matrix::Matrix A_native
Definition: sox.h:142
matrix::Matrix C_native
Definition: sox.h:141