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 _STATISTIC_MEASURE_H 00025 #define _STATISTIC_MEASURE_H 00026 00027 #include "abstractmeasure.h" 00028 #include "measuremodes.h" 00029 00030 /** 00031 * Class used by StatisticTools. 00032 * Provides 00033 */ 00034 class StatisticMeasure : public AbstractMeasure 00035 { 00036 00037 public: 00038 StatisticMeasure(double& observedValue, const char* measureName, MeasureMode mode, long stepSpan, double additionalParam); 00039 00040 virtual ~StatisticMeasure() {} 00041 00042 virtual void step(); 00043 00044 protected: 00045 double& observedValue; // the observed value from which the statistic is made 00046 MeasureMode mode; // the MeasureMode, e.g. ID, AVG, MED, PEAK, CONV,... 00047 long stepSpan; // determines the size of valueHistory 00048 double additionalParam; 00049 long oldestStepIndex; // indicates the index number in the valueHistory, which was the oldest step 00050 long newestStepIndex; // indicates the index number with the newest value, this is the oldestStepIndex one step before 00051 00052 double* valueHistory; 00053 00054 void internInit(); 00055 00056 00057 /**************************************************************************************************/ 00058 /* all the functions for calculating the values are below this line, add new variables if needed */ 00059 00060 virtual double calculateSumValue(); 00061 00062 virtual double calculateAverageValue(); 00063 00064 virtual double calculateMovingAverageValue(); 00065 00066 virtual double calculateStepDifference(); 00067 00068 virtual double calculateNormalizedStepDifference(); 00069 00070 /* BEGIN convergence SECTION */ 00071 virtual double testConvergence(); 00072 // stores how much steps the convergence is reached, 00073 // if stepsReached==stepSpan, convergence criteria is 1, otherwise 0 00074 long stepsReached; 00075 /* END convergence SECTION */ 00076 00077 00078 00079 00080 }; 00081 00082 #endif