Robotsystem of the Robot Group Leipzig: discretisizer.h Source File

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages
- Examples

- Search for |

- File List
- File Members

# discretisizer.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: discretisizer.h,v $
    00027  *   Revision 1.1  2007/12/06 10:18:10  der
    00028  *   AbstractMeasure is now a abstract type for Measures,
    00029  *   StatisticTools now supports AbstractMeasures,
    00030  *   StatisticalMeasure, ComplexMeasure  now derived from
    00031  *   AbstractMeasure,
    00032  *   ComplexMeasure provides support for calculation e.g. entropy,
    00033  *   uses Discretisizer,
    00034  *   Discretisizer is a stand-alone class for support of discretisizing values
    00035  *   TrackableMeasure derived from ComplexMeasure and provides support for calculating complex measures for Trackable objects
    00036  *
    00037  *
    00038  *                                                                 *
    00039  ***************************************************************************/
    00040 #ifndef DISCRETISIZER_H
    00041 #define DISCRETISIZER_H
    00042
    00043 /**
    00044 Use this class to get discrete values.
    00045
    00046 If no intervalCount is set, the count=1.
    00047 If no intervalRange is set, the range is automatically adjusted.
    00048
    00049 There are three possibilities:
    00050 1. automaticRange=true
    00051  --> mapping is always disabled
    00052 2. automaticRange=false, mapToInterval=true
    00053  --> real (found) range is mapped to specified range
    00054 3. automaticRange=false, mapToInterval=false
    00055  --> no mapping, no range adjustment, values outside the specified
    00056      range are set to minRange respectively maxRange
    00057
    00058 */
    00059 class Discretisizer {
    00060 public:
    00061
    00062
    00063     /**
    00064     * call this constructor if you don't like to decide which range for
    00065     * the values are used, therefore the range ist found automatically.
    00066     *
    00067     *
    00068     * Note: The adjustment of the range is enabled, if this method is called.
    00069     *
    00070     * @param numberBins the number of bins "created"
    00071     */
    00072     Discretisizer(int numberBins);
    00073
    00074     /**
    00075     * call this constructor if you like to decide yourself which range for
    00076     * the values are used.
    00077     *
    00078     * The third parameter decides if the originally range should be completely
    00079     * mapped to the given interval range. If not, the values outside the given
    00080     * interval range are set to minRange respectively maxRange.
    00081     *
    00082     * Note: The adjustment of the range is disabled, if this method is called.
    00083     *
    00084     * @param numberBins the number of bins "created"
    00085     * @param minRange the minimum of the interval
    00086     * @param maxRange the maximum of the interval
    00087     * @param mapToInterval decides if all values are mapped to the given
    00088     */
    00089   Discretisizer(int numberBins, double minRange, double maxRange, bool mapToInterval);
    00090
    00091     virtual ~Discretisizer();
    00092
    00093     /**
    00094       returns the given value as an discretisized integer.
    00095       this method returns a value between 0...numberbins-1.
    00096       @param value the value to discretisize
    00097       @return the bin number
    00098     */
    00099     virtual int getBinNumber(double value);
    00100
    00101     /**
    00102       returns the given value as an discretisized double.
    00103       this method returns returns a value between minRange and maxRange
    00104       @param value the value to discretisize
    00105       @return discretisized value between minRange and maxRange
    00106     */
    00107     virtual double get
    00108         (double value);
    00109
    00110     virtual double getMinRange();
    00111
    00112     virtual double getMaxRange();
    00113
    00114
    00115
    00116 protected:
    00117     int numberBins;
    00118     bool automaticRange;
    00119     double minRange;
    00120     double maxRange;
    00121     double minValue;
    00122     double maxValue;
    00123     bool mapToInterval;
    00124     bool firstStep;
    00125
    00126
    00127     /**
    00128     is used for automaticRange, sets min and max range.
    00129     */
    00130     virtual void findMinAndMaxRange(double value);
    00131
    00132     /**
    00133     is used for mapToInterval, sets min and max values.
    00134     */
    00135     virtual void findMinAndMaxValues(double value);
    00136
    00137     /**
    00138     is used for discretisizing values
    00139     */
    00140     virtual int discretisizeValue(double valueToDiscretisize);
    00141
    00142     virtual int roundValue(double valueToRound);
    00143 };
    00144
    00145 #endif