#include <ffnncontroller.h>
Inherits AbstractController.
Inheritance diagram for FFNNController:
Public Member Functions | |
FFNNController (const std::string &networkfilename, int history, bool input_only_x, unsigned int init_wait=0) | |
FFNNController (MultiLayerFFNN *net, int history, bool input_only_x, unsigned int init_wait=0) | |
virtual void | init (int sensornumber, int motornumber, RandGen *randGen=0) |
initialisation of the controller with the given sensor/ motornumber Must be called before use. | |
virtual | ~FFNNController () |
virtual int | getSensorNumber () const |
returns the number of sensors the controller was initialised with or 0 if not initialised | |
virtual int | getMotorNumber () const |
returns the mumber of motors the controller was initialised with or 0 if not initialised | |
virtual void | step (const sensor *, int number_sensors, motor *, int number_motors) |
performs one step (includes learning). | |
virtual void | stepNoLearning (const sensor *, int number_sensors, motor *, int number_motors) |
performs one step without learning. | |
virtual bool | store (FILE *f) const |
stores the controller values to a given file (binary). | |
virtual bool | restore (FILE *f) |
loads the controller values from a given file (binary). | |
virtual std::list< iparamkey > | getInternalParamNames () const |
The list of the names of all internal parameters given by getInternalParams(). | |
virtual std::list< iparamval > | getInternalParams () const |
virtual paramval | getParam (const paramkey &key) const |
virtual bool | setParam (const paramkey &key, paramval val) |
virtual paramlist | getParamList () const |
The list of all parameters with there value as allocated lists. | |
Protected Member Functions | |
void | putInBuffer (matrix::Matrix *buffer, const matrix::Matrix &vec, int delay=0) |
matrix::Matrix | calculateSmoothValues (const matrix::Matrix *buffer, int number_steps_for_averaging_) const |
calculate time-smoothed values | |
virtual matrix::Matrix | assembleNetworkInputXY (matrix::Matrix *xbuffer, matrix::Matrix *ybuffer) const |
virtual matrix::Matrix | assembleNetworkInputX (matrix::Matrix *xbuffer, matrix::Matrix *ybuffer) const |
virtual matrix::Matrix | assembleNetworkOutput (const matrix::Matrix &output) const |
Protected Attributes | |
unsigned short | number_motors |
unsigned short | number_sensors |
unsigned short | history |
unsigned short | buffersize |
bool | input_only_x |
unsigned short | s4avg |
unsigned int | t |
unsigned int | init_wait |
matrix::Matrix * | x_buffer |
matrix::Matrix * | y_buffer |
matrix::Matrix | x_smooth |
MultiLayerFFNN * | net |
bool | initialised |
FFNNController | ( | const std::string & | networkfilename, | |
int | history, | |||
bool | input_only_x, | |||
unsigned int | init_wait = 0 | |||
) |
networkfilename | file to load the network | |
history | number of time steps the network gets input (in sense of dimension of input) | |
input_only_x | if true then the input vector is
if false then also the y values are used:
| |
init_wait | number of timesteps to wait before controlling |
FFNNController | ( | MultiLayerFFNN * | net, | |
int | history, | |||
bool | input_only_x, | |||
unsigned int | init_wait = 0 | |||
) |
net | pointer to network (it must have the right dimensions) | |
history | number of time steps the network gets input (in sense of dimension of input) | |
input_only_x | if true then the input vector is
if false then also the y values are used:
| |
init_wait | number of timesteps to wait before controlling |
~FFNNController | ( | ) | [virtual] |
matrix::Matrix assembleNetworkInputX | ( | matrix::Matrix * | xbuffer, | |
matrix::Matrix * | ybuffer | |||
) | const [protected, virtual] |
matrix::Matrix assembleNetworkInputXY | ( | matrix::Matrix * | xbuffer, | |
matrix::Matrix * | ybuffer | |||
) | const [protected, virtual] |
matrix::Matrix assembleNetworkOutput | ( | const matrix::Matrix & | output | ) | const [protected, virtual] |
matrix::Matrix calculateSmoothValues | ( | const matrix::Matrix * | buffer, | |
int | number_steps_for_averaging_ | |||
) | const [protected] |
calculate time-smoothed values
virtual std::list<iparamkey> getInternalParamNames | ( | ) | const [inline, virtual] |
The list of the names of all internal parameters given by getInternalParams().
The naming convention is "v[i]" for vectors and "A[i][j]" for matrices, where i, j start at 0.
Reimplemented from Inspectable.
virtual std::list<iparamval> getInternalParams | ( | ) | const [inline, virtual] |
virtual int getMotorNumber | ( | ) | const [inline, virtual] |
returns the mumber of motors the controller was initialised with or 0 if not initialised
Implements AbstractController.
Configurable::paramval getParam | ( | const paramkey & | key | ) | const [virtual] |
Configurable::paramlist getParamList | ( | ) | const [virtual] |
The list of all parameters with there value as allocated lists.
Note that these are only parameters that are managed manually (with setParam, getParam)
Reimplemented from Configurable.
virtual int getSensorNumber | ( | ) | const [inline, virtual] |
returns the number of sensors the controller was initialised with or 0 if not initialised
Implements AbstractController.
void init | ( | int | sensornumber, | |
int | motornumber, | |||
RandGen * | randGen = 0 | |||
) | [virtual] |
initialisation of the controller with the given sensor/ motornumber Must be called before use.
The random generator is optional.
Implements AbstractController.
void putInBuffer | ( | matrix::Matrix * | buffer, | |
const matrix::Matrix & | vec, | |||
int | delay = 0 | |||
) | [protected] |
bool restore | ( | FILE * | f | ) | [virtual] |
performs one step (includes learning).
Calculates motor commands from sensor inputs.
sensors | sensors inputs scaled to [-1,1] | |
sensornumber | length of the sensor array | |
motors | motors outputs. MUST have enough space for motor values! | |
motornumber | length of the provided motor array |
Implements AbstractController.
bool store | ( | FILE * | f | ) | const [virtual] |
unsigned short buffersize [protected] |
unsigned short history [protected] |
unsigned int init_wait [protected] |
bool initialised [protected] |
bool input_only_x [protected] |
MultiLayerFFNN* net [protected] |
unsigned short number_motors [protected] |
unsigned short number_sensors [protected] |
unsigned short s4avg [protected] |
unsigned int t [protected] |
matrix::Matrix* x_buffer [protected] |
matrix::Matrix x_smooth [protected] |
matrix::Matrix* y_buffer [protected] |