19 #ifndef __CLASSICREINFORCE_H
20 #define __CLASSICREINFORCE_H
22 #include <selforg/abstractcontroller.h>
27 #include <selforg/matrix.h>
28 #include <selforg/noisegenerator.h>
29 #include <selforg/qlearning.h>
47 virtual void init(
int sensornumber,
int motornumber,
RandGen* randGen = 0);
77 virtual bool store(FILE* f)
const;
Matrix type.
Definition: matrix.h:65
static ClassicReinforceConf getDefaultConf()
Definition: classicreinforce.h:87
virtual int getMotorNumber() const
returns the mumber of motors the controller was initialised with or 0 if not initialised ...
Definition: classicreinforce.h:54
Abstract class for robot controller (with some basic functionality).
Definition: abstractcontroller.h:46
virtual void fillSensorBuffer(const sensor *x_, int number_sensors)
puts the sensors in the ringbuffer
Definition: classicreinforce.cpp:139
virtual double calcReinforcement()=0
returns the reinforcement (reward), to be overwritten
int reinforce_interval
time between consecutive reinforcement selections
Definition: classicreinforce.h:34
implements QLearning
Definition: qlearning.h:33
void setManualControl(bool mControl, int action_=0)
enables/disables manual control, action_ is the sat network number to be used if mControl is false...
Definition: classicreinforce.cpp:157
unsigned short buffersize
size of the ringbuffers for sensors, motors,...
Definition: classicreinforce.h:32
charArray paramkey
Definition: avrtypes.h:36
Definition: classicreinforce.h:31
virtual void management()
handles inhibition damping etc.
Definition: classicreinforce.cpp:166
bool manualControl
True if actions (sats) are selected manually.
Definition: classicreinforce.h:107
virtual std::list< iparamval > getInternalParams() const
Definition: classicreinforce.cpp:224
QLearning * qlearning
QLearning instance.
Definition: classicreinforce.h:36
virtual bool store(FILE *f) const
stores the controller values to a given file.
Definition: classicreinforce.cpp:183
double sensor
Definition: types.h:29
random generator with 48bit integer arithmentic
Definition: randomgenerator.h:34
virtual bool restore(FILE *f)
loads the controller values from a given file.
Definition: classicreinforce.cpp:192
virtual matrix::Matrix calcMotor(int action)=0
returns action Matrix from discrete actions, to be overwritten
int managementInterval
interval between subsequent management calls
Definition: classicreinforce.h:118
virtual std::list< IConnection > getStructuralConnections() const
Specifies which parameter matrix forms a connection between layers (in terms of a neural network) The...
Definition: classicreinforce.cpp:239
int numContext
number of context sensors (ignored)
Definition: classicreinforce.h:33
ClassicReinforceConf conf
Definition: classicreinforce.h:115
void putInBuffer(matrix::Matrix *buffer, const matrix::Matrix &vec, int delay=0)
Definition: classicreinforce.cpp:79
virtual void notifyOnChange(const paramkey &key)
Is called when a parameter was changes via setParam().
Definition: classicreinforce.cpp:170
virtual void fillMotorBuffer(const motor *y_, int number_motors)
puts the motors in the ringbuffer
Definition: classicreinforce.cpp:149
virtual void stepNoLearning(const sensor *, int number_sensors, motor *, int number_motors)
performs one step without learning. Calulates motor commands from sensor inputs.
Definition: classicreinforce.cpp:129
double sensor
Definition: abstractcontroller.h:48
int t
Definition: classicreinforce.h:117
double oldreward
old reward (nicer for plotting)
Definition: classicreinforce.h:113
unsigned short number_motors
Definition: classicreinforce.h:99
unsigned short buffersize
Definition: classicreinforce.h:102
virtual void step(const sensor *, int number_sensors, motor *, int number_motors)
performs one step (includes learning).
Definition: classicreinforce.cpp:85
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: classicreinforce.cpp:52
struct ClassicReinforceConf ClassicReinforceConf
ClassicReinforce(const ClassicReinforceConf &conf=getDefaultConf())
Definition: classicreinforce.cpp:28
int oldaction
old action
Definition: classicreinforce.h:110
double reward
current reward
Definition: classicreinforce.h:112
matrix::Matrix * x_buffer
Definition: classicreinforce.h:103
double motor
Definition: types.h:30
int action
action
Definition: classicreinforce.h:109
class for robot controller using Q-learning algorithm.
Definition: classicreinforce.h:43
virtual ~ClassicReinforce()
Definition: classicreinforce.cpp:41
double motor
Definition: abstractcontroller.h:49
virtual std::list< iparamkey > getInternalParamNames() const
The list of the names of all internal parameters given by getInternalParams().
Definition: classicreinforce.cpp:213
unsigned short number_sensors
Definition: classicreinforce.h:98
virtual int getStateNumber()=0
returns number of state, to be overwritten
virtual int calcState()=0
returns state, to be overwritten
virtual int getSensorNumber() const
returns the number of sensors the controller was initialised with or 0 if not initialised ...
Definition: classicreinforce.h:52
virtual int getActionNumber()=0
returns number of actions, to be overwritten
matrix::Matrix * y_buffer
Definition: classicreinforce.h:104
int c
Definition: hexapod.cpp:56
int state
current state
Definition: classicreinforce.h:111
bool initialised
Definition: classicreinforce.h:116
virtual std::list< ILayer > getStructuralLayers() const
Specifies which parameter vector forms a structural layer (in terms of a neural network) The ordering...
Definition: classicreinforce.cpp:234
matrix::Matrix * x_context_buffer
Definition: classicreinforce.h:105