Robot Simulator of the Robotics Group for Self-Organization of Control  0.8.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
abstractmodel.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005-2011 LpzRobots development team *
3  * Georg Martius <georg dot martius at web dot de> *
4  * Frank Guettler <guettler at informatik dot uni-leipzig dot de *
5  * Frank Hesse <frank at nld dot ds dot mpg dot de> *
6  * Ralf Der <ralfder at mis dot mpg dot de> *
7  * *
8  * This program is free software; you can redistribute it and/or modify *
9  * it under the terms of the GNU General Public License as published by *
10  * the Free Software Foundation; either version 2 of the License, or *
11  * (at your option) any later version. *
12  * *
13  * This program is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16  * GNU General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU General Public License *
19  * along with this program; if not, write to the *
20  * Free Software Foundation, Inc., *
21  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
22  * *
23  ***************************************************************************/
24 #ifndef __ABSTRACTMODEL_H
25 #define __ABSTRACTMODEL_H
26 
27 #include "matrix.h"
28 #include "configurable.h"
29 #include "storeable.h"
30 #include "inspectable.h"
31 #include "randomgenerator.h"
32 
33 /// abstract class (interface) for a model that can be used by a controller
34 class AbstractModel : public Configurable, public Storeable, public Inspectable {
35  public:
36  // 20110317, guettler: disabled default constructor since it is not needed and would cause difficulties
37  //AbstractModel() {};
38  AbstractModel(const std::string& name, const std::string& revision)
39  : Configurable(name, revision), Inspectable(name) {}
40  virtual ~AbstractModel(){};
41 
42  /** initialisation of the network with the given number of input and output units
43  @param inputDim length of input vector
44  @param outputDim length of output vector
45  @param unit_map if 0 the parametes are choosen randomly.
46  Otherwise the model is initialised to represent a unit_map
47  with the given response strength.
48  @param randGen pointer to random generator, if 0 an new one is used
49  */
50  virtual void init(unsigned int inputDim, unsigned int outputDim,
51  double unit_map = 0.0, RandGen* randGen = 0) = 0;
52 
53  /** passive processing of the input
54  (this function is not constant since a recurrent network
55  for example might change internal states
56  */
57  virtual const matrix::Matrix process (const matrix::Matrix& input) = 0;
58 
59  /* performs learning and returns the network output before learning.
60  Neural networks process the input before. (no need to call process before)
61  \param learnRateFactor can be given to modify eps for this learning step.
62  */
63  virtual const matrix::Matrix learn (const matrix::Matrix& input,
64  const matrix::Matrix& nom_output,
65  double learnRateFactor = 1) = 0;
66 
67  /// damps the weights and the biases by multiplying (1-damping)
68  virtual void damp(double damping) = 0;
69 
70  /// returns the number of input neurons
71  virtual unsigned int getInputDim() const = 0;
72  /// returns the number of output neurons
73  virtual unsigned int getOutputDim() const = 0;
74 
75 };
76 
77 
78 #endif
Matrix type.
Definition: matrix.h:65
Interface for objects, that can be stored and restored to/from a file stream (binary).
Definition: storeable.h:33
virtual unsigned int getInputDim() const =0
returns the number of input neurons
AbstractModel(const std::string &name, const std::string &revision)
Definition: abstractmodel.h:38
virtual const matrix::Matrix process(const matrix::Matrix &input)=0
passive processing of the input (this function is not constant since a recurrent network for example ...
virtual unsigned int getOutputDim() const =0
returns the number of output neurons
virtual void damp(double damping)=0
damps the weights and the biases by multiplying (1-damping)
random generator with 48bit integer arithmentic
Definition: randomgenerator.h:34
virtual const matrix::Matrix learn(const matrix::Matrix &input, const matrix::Matrix &nom_output, double learnRateFactor=1)=0
virtual void init(unsigned int inputDim, unsigned int outputDim, double unit_map=0.0, RandGen *randGen=0)=0
initialisation of the network with the given number of input and output units
Interface for inspectable objects.
Definition: inspectable.h:48
Abstact class for configurable objects.
Definition: configurable.h:81
abstract class (interface) for a model that can be used by a controller
Definition: abstractmodel.h:34
virtual ~AbstractModel()
Definition: abstractmodel.h:40