Robot Simulator of the Robotics Group for Self-Organization of Control: abstractmodel.h Source File

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages
- Examples

- Search for |

- File List
- File Members

# abstractmodel.h

Go to the documentation of this file.

    00001 /***************************************************************************
    00002  *   Copyright (C) 2005 by Robot Group Leipzig                             *
    00003  *    martius@informatik.uni-leipzig.de                                    *
    00004  *    fhesse@informatik.uni-leipzig.de                                     *
    00005  *    der@informatik.uni-leipzig.de                                        *
    00006  *                                                                         *
    00007  *   This program is free software; you can redistribute it and/or modify  *
    00008  *   it under the terms of the GNU General Public License as published by  *
    00009  *   the Free Software Foundation; either version 2 of the License, or     *
    00010  *   (at your option) any later version.                                   *
    00011  *                                                                         *
    00012  *   This program is distributed in the hope that it will be useful,       *
    00013  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
    00014  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
    00015  *   GNU General Public License for more details.                          *
    00016  *                                                                         *
    00017  *   You should have received a copy of the GNU General Public License     *
    00018  *   along with this program; if not, write to the                         *
    00019  *   Free Software Foundation, Inc.,                                       *
    00020  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
    00021  ***************************************************************************
    00022  *                                                                         *
    00023  *  DESCRIPTION                                                            *
    00024  *                                                                         *
    00025  *   $Log: abstractmodel.h,v $
    00026  *   Revision 1.6  2008/05/30 11:57:12  martius
    00027  *   do processing of inputs in learning function if network is not
    00028  *    activated with this input before (was a very probable mistake)
    00029  *
    00030  *   Revision 1.5  2008/04/17 14:54:44  martius
    00031  *   randomGen added, which is a random generator with long period and an
    00032  *    internal state. Each Agent has an instance and passed it to the controller
    00033  *    and the wiring. This is good for
    00034  *   a) repeatability on agent basis,
    00035  *   b) parallel execution as done in ode_robots
    00036  *
    00037  *   Revision 1.4  2008/02/08 13:38:05  der
    00038  *   abstract model is inspectable
    00039  *
    00040  *   Revision 1.3  2007/02/20 15:41:05  martius
    00041  *   big model stuff, elman and co
    00042  *
    00043  *   Revision 1.2  2006/07/27 15:27:20  martius
    00044  *   processing should be called before learning
    00045  *
    00046  *   Revision 1.1  2006/07/20 17:14:34  martius
    00047  *   removed std namespace from matrix.h
    00048  *   storable interface
    00049  *   abstract model and invertablemodel as superclasses for networks
    00050  *
    00051  *
    00052  *                                                                 *
    00053  ***************************************************************************/
    00054 #ifndef __ABSTRACTMODEL_H
    00055 #define __ABSTRACTMODEL_H
    00056
    00057 #include "matrix.h"
    00058 #include "configurable.h"
    00059 #include "storeable.h"
    00060 #include "inspectable.h"
    00061 #include "randomgenerator.h"
    00062
    00063 /// abstract class (interface) for a model that can be used by a controller
    00064 class AbstractModel : public Configurable, public Storeable, public Inspectable {
    00065  public:
    00066   AbstractModel() {};
    00067   AbstractModel(const std::string& name, const std::string& revision)
    00068     : Configurable(name, revision) {}
    00069   virtual ~AbstractModel(){};
    00070
    00071   /** initialisation of the network with the given number of input and output units
    00072       @param inputDim length of input vector
    00073       @param outputDim length of output vector
    00074       @param unit_map if 0 the parametes are choosen randomly.
    00075              Otherwise the model is initialised to represent a unit_map
    00076              with the given response strength.
    00077       @param randGen pointer to random generator, if 0 an new one is used
    00078    */
    00079   virtual void init(unsigned int inputDim, unsigned  int outputDim,
    00080                     double unit_map = 0.0, RandGen* randGen = 0) = 0;
    00081
    00082   /** passive processing of the input
    00083      (this function is not constant since a recurrent network
    00084      for example might change internal states
    00085   */
    00086   virtual const matrix::Matrix process (const matrix::Matrix& input) = 0;
    00087
    00088   /* performs learning and returns the network output before learning.
    00089      Neural networks process the input before. (no need to call process before)
    00090      \param learnRateFactor can be given to modify eps for this learning step.
    00091   */
    00092   virtual const matrix::Matrix learn (const matrix::Matrix& input,
    00093                                       const matrix::Matrix& nom_output,
    00094                                       double learnRateFactor = 1) = 0;
    00095
    00096   /// damps the weights and the biases by multiplying (1-damping)
    00097   virtual void damp(double damping) = 0;
    00098
    00099   /// returns the number of input neurons
    00100   virtual unsigned int getInputDim() const = 0;
    00101   /// returns the number of output neurons
    00102   virtual unsigned int getOutputDim() const = 0;
    00103
    00104 };
    00105
    00106
    00107 #endif