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

# abstractmodel.h

Go to the documentation of this file.

    00001 /***************************************************************************
    00002  *   Copyright (C) 2005-2011 LpzRobots development team                    *
    00003  *    Georg Martius  <georg dot martius at web dot de>                     *
    00004  *    Frank Guettler <guettler at informatik dot uni-leipzig dot de        *
    00005  *    Frank Hesse    <frank at nld dot ds dot mpg dot de>                  *
    00006  *    Ralf Der       <ralfder at mis dot mpg dot de>                       *
    00007  *                                                                         *
    00008  *   This program is free software; you can redistribute it and/or modify  *
    00009  *   it under the terms of the GNU General Public License as published by  *
    00010  *   the Free Software Foundation; either version 2 of the License, or     *
    00011  *   (at your option) any later version.                                   *
    00012  *                                                                         *
    00013  *   This program is distributed in the hope that it will be useful,       *
    00014  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
    00015  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
    00016  *   GNU General Public License for more details.                          *
    00017  *                                                                         *
    00018  *   You should have received a copy of the GNU General Public License     *
    00019  *   along with this program; if not, write to the                         *
    00020  *   Free Software Foundation, Inc.,                                       *
    00021  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
    00022  *                                                                         *
    00023  ***************************************************************************/
    00024 #ifndef __ABSTRACTMODEL_H
    00025 #define __ABSTRACTMODEL_H
    00026
    00027 #include "matrix.h"
    00028 #include "configurable.h"
    00029 #include "storeable.h"
    00030 #include "inspectable.h"
    00031 #include "randomgenerator.h"
    00032
    00033 /// abstract class (interface) for a model that can be used by a controller
    00034 class AbstractModel : public Configurable, public Storeable, public Inspectable {
    00035  public:
    00036   // 20110317, guettler: disabled default constructor since it is not needed and would cause difficulties
    00037   //AbstractModel() {};
    00038   AbstractModel(const std::string& name, const std::string& revision)
    00039     : Configurable(name, revision), Inspectable(name) {}
    00040   virtual ~AbstractModel(){};
    00041
    00042   /** initialisation of the network with the given number of input and output units
    00043       @param inputDim length of input vector
    00044       @param outputDim length of output vector
    00045       @param unit_map if 0 the parametes are choosen randomly.
    00046              Otherwise the model is initialised to represent a unit_map
    00047              with the given response strength.
    00048       @param randGen pointer to random generator, if 0 an new one is used
    00049    */
    00050   virtual void init(unsigned int inputDim, unsigned  int outputDim,
    00051                     double unit_map = 0.0, RandGen* randGen = 0) = 0;
    00052
    00053   /** passive processing of the input
    00054      (this function is not constant since a recurrent network
    00055      for example might change internal states
    00056   */
    00057   virtual const matrix::Matrix process (const matrix::Matrix& input) = 0;
    00058
    00059   /* performs learning and returns the network output before learning.
    00060      Neural networks process the input before. (no need to call process before)
    00061      \param learnRateFactor can be given to modify eps for this learning step.
    00062   */
    00063   virtual const matrix::Matrix learn (const matrix::Matrix& input,
    00064                                       const matrix::Matrix& nom_output,
    00065                                       double learnRateFactor = 1) = 0;
    00066
    00067   /// damps the weights and the biases by multiplying (1-damping)
    00068   virtual void damp(double damping) = 0;
    00069
    00070   /// returns the number of input neurons
    00071   virtual unsigned int getInputDim() const = 0;
    00072   /// returns the number of output neurons
    00073   virtual unsigned int getOutputDim() const = 0;
    00074
    00075 };
    00076
    00077
    00078 #endif