statisticmeasure.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  *    frankguettler@gmx.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  *  DESCRIPTION                                                            *
00025  *                                                                         *
00026  *   $Log: statisticmeasure.h,v $
00027  *   Revision 1.7  2008/04/24 11:57:00  der
00028  *   added new measure types
00029  *
00030  *   Revision 1.6  2008/03/12 10:57:07  der
00031  *   added moving average MOVAVG
00032  *
00033  *   Revision 1.5  2008/01/17 09:59:27  der
00034  *   complexmeasure: preparations made for predictive information,
00035  *   fixed a minor bug
00036  *   statisticmeasure, statistictools: added support for adding
00037  *   std::list<AbstractMeasure*> to StatisticTools, some minor
00038  *   improvements
00039  *
00040  *   Revision 1.4  2007/12/06 10:18:10  der
00041  *   AbstractMeasure is now a abstract type for Measures,
00042  *   StatisticTools now supports AbstractMeasures,
00043  *   StatisticalMeasure, ComplexMeasure  now derived from
00044  *   AbstractMeasure,
00045  *   ComplexMeasure provides support for calculation e.g. entropy,
00046  *   uses Discretisizer,
00047  *   Discretisizer is a stand-alone class for support of discretisizing values
00048  *   TrackableMeasure derived from ComplexMeasure and provides support for calculating complex measures for Trackable objects
00049  *
00050  *   Revision 1.3  2007/09/28 08:48:21  robot3
00051  *   corrected some minor bugs, files are still in develop status
00052  *
00053  *   Revision 1.2  2007/09/27 10:49:39  robot3
00054  *   removed some minor bugs,
00055  *   added CONVergence test
00056  *   changed little things for support of the new WSM
00057  *
00058  *   Revision 1.1  2007/05/07 21:01:31  robot3
00059  *   statistictools is a class for easy visualization of measurements of observed values
00060  *   it is possible to add the observed value itself with mode ID
00061  *
00062  *                                                                         *
00063  ***************************************************************************/
00064 #ifndef _STATISTIC_MEASURE_H
00065 #define _STATISTIC_MEASURE_H
00066 
00067 #include "abstractmeasure.h"
00068 #include "measuremodes.h"
00069 
00070 class StatisticMeasure : public AbstractMeasure
00071 {
00072 
00073 public:
00074   StatisticMeasure(double& observedValue, const char* measureName, MeasureMode mode, long stepSpan, double additionalParam);
00075 
00076   virtual ~StatisticMeasure() {}
00077 
00078   virtual void step();
00079 
00080 protected:
00081   double& observedValue; // the observed value from which the statistic is made
00082   MeasureMode mode; // the MeasureMode, e.g. ID, AVG, MED, PEAK, CONV,...
00083   long stepSpan; // determines the size of valueHistory
00084   double additionalParam;
00085   long oldestStepIndex; // indicates the index number in the valueHistory, which was the oldest step
00086   long newestStepIndex; // indicates the index number with the newest value, this is the oldestStepIndex one step before
00087 
00088   double* valueHistory;
00089 
00090   void internInit();
00091 
00092 
00093   /**************************************************************************************************/
00094   /* all the functions for calculating the values are below this line, add new variables if needed  */
00095 
00096   virtual double calculateSumValue();
00097 
00098   virtual double calculateAverageValue();
00099   
00100   virtual double calculateMovingAverageValue();
00101   
00102   virtual double calculateStepDifference();
00103   
00104   virtual double calculateNormalizedStepDifference();
00105   
00106   /* BEGIN convergence SECTION */
00107   virtual double testConvergence();
00108   // stores how much steps the convergence is reached,
00109   // if stepsReached==stepSpan, convergence criteria is 1, otherwise 0
00110   long stepsReached;
00111   /* END convergence SECTION */
00112 
00113 
00114 
00115 
00116 };
00117 
00118 #endif

Generated on Tue Sep 16 22:00:22 2008 for Robotsystem of the Robot Group Leipzig by  doxygen 1.4.7