Robot Simulator of the Robotics Group for Self-Organization of Control  0.8.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
statisticmeasure.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005-2011 LpzRobots development team *
3  * Georg Martius <georg dot martius at web dot de> *
4  * Frank Guettler <guettler at informatik dot uni-leipzig dot de *
5  * Frank Hesse <frank at nld dot ds dot mpg dot de> *
6  * Ralf Der <ralfder at mis dot mpg dot de> *
7  * *
8  * This program is free software; you can redistribute it and/or modify *
9  * it under the terms of the GNU General Public License as published by *
10  * the Free Software Foundation; either version 2 of the License, or *
11  * (at your option) any later version. *
12  * *
13  * This program is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16  * GNU General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU General Public License *
19  * along with this program; if not, write to the *
20  * Free Software Foundation, Inc., *
21  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
22  * *
23  ***************************************************************************/
24 #ifndef _STATISTIC_MEASURE_H
25 #define _STATISTIC_MEASURE_H
26 
27 #include "abstractmeasure.h"
28 #include "measuremodes.h"
29 
30 /**
31  * Class used by StatisticTools.
32  * Provides
33  */
35 {
36 
37 public:
38  StatisticMeasure(double& observedValue, const char* measureName, MeasureMode mode, long stepSpan, double additionalParam);
39 
40  virtual ~StatisticMeasure() {}
41 
42  virtual void step();
43 
44 protected:
45  double& observedValue; // the observed value from which the statistic is made
46  MeasureMode mode; // the MeasureMode, e.g. ID, AVG, MED, PEAK, CONV,...
47  long stepSpan; // determines the size of valueHistory
49  long oldestStepIndex; // indicates the index number in the valueHistory, which was the oldest step
50  long newestStepIndex; // indicates the index number with the newest value, this is the oldestStepIndex one step before
51 
52  double* valueHistory;
53 
54  void internInit();
55 
56 
57  /**************************************************************************************************/
58  /* all the functions for calculating the values are below this line, add new variables if needed */
59 
60  virtual double calculateSumValue();
61 
62  virtual double calculateAverageValue();
63 
64  virtual double calculateMovingAverageValue();
65 
66  virtual double calculateStepDifference();
67 
68  virtual double calculateNormalizedStepDifference();
69 
70  /* BEGIN convergence SECTION */
71  virtual double testConvergence();
72  // stores how much steps the convergence is reached,
73  // if stepsReached==stepSpan, convergence criteria is 1, otherwise 0
75  /* END convergence SECTION */
76 
77 
78 
79 
80 };
81 
82 #endif
MeasureMode
usage of the statistictools with different measure modes (examples):
Definition: measuremodes.h:53
double * valueHistory
Definition: statisticmeasure.h:52
virtual ~StatisticMeasure()
Definition: statisticmeasure.h:40
long oldestStepIndex
Definition: statisticmeasure.h:49
virtual double testConvergence()
Definition: statisticmeasure.cpp:123
double & observedValue
Definition: statisticmeasure.h:45
Class used by StatisticTools.
Definition: statisticmeasure.h:34
long stepsReached
Definition: statisticmeasure.h:74
long stepSpan
Definition: statisticmeasure.h:47
MeasureMode mode
Definition: statisticmeasure.h:46
long newestStepIndex
Definition: statisticmeasure.h:50
virtual double calculateAverageValue()
Definition: statisticmeasure.cpp:155
StatisticMeasure(double &observedValue, const char *measureName, MeasureMode mode, long stepSpan, double additionalParam)
Definition: statisticmeasure.cpp:32
virtual void step()
Definition: statisticmeasure.cpp:67
virtual double calculateNormalizedStepDifference()
Definition: statisticmeasure.cpp:192
virtual double calculateStepDifference()
Definition: statisticmeasure.cpp:184
virtual double calculateSumValue()
Definition: statisticmeasure.cpp:137
virtual double calculateMovingAverageValue()
Definition: statisticmeasure.cpp:171
double additionalParam
Definition: statisticmeasure.h:48
Class used by StatisticTools.
Definition: abstractmeasure.h:38
void internInit()
Definition: statisticmeasure.cpp:53