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