OMNeT++ API 6.1
Discrete Event Simulation Library
cPrecollectionBasedDensityEst Class Referenceabstract

Description

Base class for histogram-like density estimation classes.

DEPRECATED CLASS, do not use for new classes.

For the histogram classes, you need to specify the number of bins and the range. Range can either be set explicitly or you can choose automatic range determination.

Automatic range estimation works in the following way:

  1. The first numPrecollect observations are stored.
  2. After having collected a given number of observations, the actual histogram is set up. The range (min, max) of the initial values is expanded rangeExtensionFactoror times, and the result will become the histogram's range (rangeMin, rangeMax). Based on the range, the bins are layed out.
  3. Then the initial values that have been stored up to this point will be transferred into the new histogram structure and their store is deleted – this is done by the setUpBins() function.

You may also explicitly specify the lower or upper limit and have the other end of the range estimated automatically. The setRange...() member functions of cPrecollectionBasedDensityEst deal with setting up the histogram range. It also provides pure virtual functions setUpBins() etc.

Subsequent observations are placed in the histogram structure. If an observation falls out of the histogram range, the underflow or overflow counter is incremented.

Inheritance diagram for cPrecollectionBasedDensityEst:
[legend]

Public Types

enum  RangeMode
 Constants for histogram range_mode. More...
 

Public Member Functions

Constructors, destructor, assignment.
 cPrecollectionBasedDensityEst (const cPrecollectionBasedDensityEst &other)
 
 cPrecollectionBasedDensityEst (const char *name=nullptr, bool weighted=false)
 
virtual ~cPrecollectionBasedDensityEst ()
 
cPrecollectionBasedDensityEstoperator= (const cPrecollectionBasedDensityEst &res)
 
Redefined cObject member functions.
virtual void parsimPack (cCommBuffer *buffer) const override
 
virtual void parsimUnpack (cCommBuffer *buffer) override
 
Redefined cStatistic member functions.
virtual void collect (double value) override
 
virtual void collectWeighted (double value, double weight) override
 
virtual void merge (const cStatistic *other) override
 
virtual void clear () override
 
virtual void saveToFile (FILE *) const override
 
virtual void loadFromFile (FILE *) override
 
virtual void collect (double value)=0
 
virtual void collect (SimTime value)
 
virtual void collectWeighted (double value, double weight)
 
virtual void collectWeighted (SimTime value, double weight)
 
virtual void collectWeighted (double value, SimTime weight)
 
virtual void collectWeighted (SimTime value, SimTime weight)
 
Redefined methods
virtual bool binsAlreadySetUp () const override
 
virtual int64_t getNumUnderflows () const override
 
virtual int64_t getNumOverflows () const override
 
virtual double getUnderflowSumWeights () const override
 
virtual double getOverflowSumWeights () const override
 
virtual int64_t getNumNegInfs () const override
 
virtual int64_t getNumPosInfs () const override
 
virtual double getNegInfSumWeights () const override
 
virtual double getPosInfSumWeights () const override
 
- Public Member Functions inherited from cAbstractHistogram
 cAbstractHistogram (const cAbstractHistogram &other)=default
 
 cAbstractHistogram (const char *name=nullptr, bool weighted=false)
 
virtual ~cAbstractHistogram ()
 
cAbstractHistogramoperator= (const cAbstractHistogram &res)
 
virtual cAbstractHistogramdup () const override
 
virtual void setUpBins ()=0
 
virtual std::vector< double > getBinEdges () const
 
virtual std::vector< double > getBinValues () const
 
virtual int getNumBins () const =0
 
virtual double getBinEdge (int k) const =0
 
virtual double getBinValue (int k) const =0
 
virtual double getBinPDF (int k) const
 
virtual Bin getBinInfo (int k) const
 
virtual double getPDF (double x) const
 
virtual double getCDF (double x) const
 
virtual double draw () const override
 
- Public Member Functions inherited from cStdDev
 cStdDev (const cStdDev &r)
 
 cStdDev (const char *name=nullptr, bool weighted=false)
 
virtual ~cStdDev ()
 
cStdDevoperator= (const cStdDev &res)
 
virtual std::string str () const override
 
virtual bool isWeighted () const override
 
virtual int64_t getCount () const override
 
virtual double getSum () const override
 
virtual double getSqrSum () const override
 
virtual double getMin () const override
 
virtual double getMax () const override
 
virtual double getMean () const override
 
virtual double getStddev () const override
 
virtual double getVariance () const override
 
virtual double getSumWeights () const override
 
virtual double getWeightedSum () const override
 
virtual double getSqrSumWeights () const override
 
virtual double getWeightedSqrSum () const override
 
virtual void collect (double value)=0
 
virtual void collect (SimTime value)
 
virtual void collectWeighted (double value, double weight)
 
virtual void collectWeighted (SimTime value, double weight)
 
virtual void collectWeighted (double value, SimTime weight)
 
virtual void collectWeighted (SimTime value, SimTime weight)
 
- Public Member Functions inherited from cStatistic
 cStatistic (const cStatistic &r)
 
 cStatistic (const char *name=nullptr)
 
virtual ~cStatistic ()
 
cStatisticoperator= (const cStatistic &res)
 
virtual void collect (SimTime value)
 
virtual void collectWeighted (SimTime value, double weight)
 
virtual void collectWeighted (double value, SimTime weight)
 
virtual void collectWeighted (SimTime value, SimTime weight)
 
virtual void record ()
 
virtual void recordWithUnit (const char *unit)
 
virtual void recordAs (const char *name, const char *unit=nullptr)
 
- Public Member Functions inherited from cRandom
 cRandom (cRNG *rng)
 
 cRandom (const char *name=nullptr, cRNG *rng=nullptr)
 
virtual ~cRandom ()
 
virtual void setRNG (cRNG *rng)
 
cRNGgetRNG () const
 
- Public Member Functions inherited from cOwnedObject
 cOwnedObject ()
 
 cOwnedObject (const char *name, bool namepooling=true)
 
 cOwnedObject (const cOwnedObject &obj)
 
virtual ~cOwnedObject ()
 
cOwnedObjectoperator= (const cOwnedObject &o)
 
virtual cObjectgetOwner () const override
 
virtual bool isOwnedObject () const override
 
- Public Member Functions inherited from cNamedObject
 cNamedObject ()
 
 cNamedObject (const char *name, bool namepooling=true)
 
 cNamedObject (const cNamedObject &obj)
 
virtual ~cNamedObject ()
 
cNamedObjectoperator= (const cNamedObject &o)
 
virtual void setName (const char *s)
 
virtual const char * getName () const override
 
virtual void setNamePooling (bool b)
 
virtual bool getNamePooling ()
 
- Public Member Functions inherited from cObject
 cObject ()
 
 cObject (const cObject &other)=default
 
virtual ~cObject ()
 
virtual const char * getClassName () const
 
bool isName (const char *s) const
 
virtual const char * getFullName () const
 
virtual std::string getFullPath () const
 
virtual std::string getClassAndFullName () const
 
virtual std::string getClassAndFullPath () const
 
const cObjectgetThisPtr () const
 
virtual std::ostream & printOn (std::ostream &os) const
 
virtual bool isSoftOwner () const
 
virtual void forEachChild (cVisitor *v)
 
cObjectfindObject (const char *name, bool deep=true)
 
virtual cClassDescriptorgetDescriptor () const
 
void copyNotSupported () const
 

Selecting the method of setting up the histogram range.

virtual void setupRange ()
 
virtual void collectIntoHistogram (double value)=0
 
virtual void collectWeightedIntoHistogram (double value, double weight)=0
 
virtual void setRange (double lower, double upper)
 
virtual void setRangeAuto (int numPrecollect=100, double rangeExtensionFactor=2.0)
 
virtual void setRangeAutoLower (double upper, int numPrecollect=100, double rangeExtensionFactor=2.0)
 
virtual void setRangeAutoUpper (double lower, int numPrecollect=100, double rangeExtensionFactor=2.0)
 
virtual void setNumPrecollectedValues (int numPrecollect)
 
virtual int getNumPrecollectedValues () const
 
virtual double getRangeExtensionFactor () const
 

Additional Inherited Members

- Static Public Member Functions inherited from cOwnedObject
static long getTotalObjectCount ()
 
static long getLiveObjectCount ()
 
static void resetObjectCounters ()
 
static cSoftOwnergetOwningContext ()
 
- Protected Member Functions inherited from cObject
virtual void take (cOwnedObject *obj)
 
virtual void drop (cOwnedObject *obj)
 
void dropAndDelete (cOwnedObject *obj)
 

Member Enumeration Documentation

◆ RangeMode

enum RangeMode

Constants for histogram range_mode.

Constructor & Destructor Documentation

◆ cPrecollectionBasedDensityEst() [1/2]

Copy constructor.

◆ cPrecollectionBasedDensityEst() [2/2]

cPrecollectionBasedDensityEst ( const char *  name = nullptr,
bool  weighted = false 
)
explicit

Constructor.

◆ ~cPrecollectionBasedDensityEst()

virtual ~cPrecollectionBasedDensityEst ( )
virtual

Destructor.

Member Function Documentation

◆ operator=()

Assignment operator. The name member is not copied; see cNamedObject::operator=() for details.

◆ parsimPack()

virtual void parsimPack ( cCommBuffer buffer) const
overridevirtual

Serializes the object into an MPI send buffer. Used by the simulation kernel for parallel execution. See cObject for more details.

Reimplemented from cStdDev.

Reimplemented in cKSplit.

◆ parsimUnpack()

virtual void parsimUnpack ( cCommBuffer buffer)
overridevirtual

Deserializes the object from an MPI receive buffer Used by the simulation kernel for parallel execution. See cObject for more details.

Reimplemented from cStdDev.

Reimplemented in cKSplit.

◆ collect() [1/3]

virtual void collect ( double  value)
overridevirtual

Collects one value. In the precollection phase, this method simply adds the value to the table of pre-collected values. When the number of pre-collected observations reaches a limit, the setUpBins() method is called. After transformation, it calls collectIntoHistogram() to update the stored statistics with this value.

Reimplemented from cStdDev.

◆ collectWeighted() [1/5]

virtual void collectWeighted ( double  value,
double  weight 
)
overridevirtual

Collects one observation with a given weight. The weight must not be negative. (Zero-weight observations are allowed, but will not affect mean and stddev.)

Reimplemented from cStdDev.

◆ merge()

virtual void merge ( const cStatistic other)
overridevirtual

Updates this object with data coming from another statistics object – as if this object had collected observations fed into the other object as well. Throws an error if the other object is not a cPrecollectionBasedDensityEst.

Reimplemented from cStdDev.

Reimplemented in cKSplit.

◆ clear()

virtual void clear ( )
overridevirtual

Clears the results collected so far.

Reimplemented from cStdDev.

Reimplemented in cKSplit.

◆ saveToFile()

virtual void saveToFile ( FILE *  ) const
overridevirtual

Writes the contents of the object into a text file.

Reimplemented from cStdDev.

Reimplemented in cKSplit.

◆ loadFromFile()

virtual void loadFromFile ( FILE *  )
overridevirtual

Reads the object data from a file, in the format written out by saveToFile().

Reimplemented from cStdDev.

Reimplemented in cKSplit.

◆ setRange()

virtual void setRange ( double  lower,
double  upper 
)
virtual

Sets the histogram range explicitly to [lower, upper]. When this method is used, setNumPrecollectedValues() is not needed.

◆ setRangeAuto()

virtual void setRangeAuto ( int  numPrecollect = 100,
double  rangeExtensionFactor = 2.0 
)
virtual

Selects a histogram range setup method where the range will be determined entirely from a set of pre-collected values.

When called, the histogram range will be determined from the first numPrecollect values, extending their range symmetrically by rangeExtensionFactor. For example, after a call to setRangeAuto(100, 1.3), the histogram will be set up after pre-collecting 100 values, the range being the range of the 100 pre-collected values extended 1.3 times symmetrically.

◆ setRangeAutoLower()

virtual void setRangeAutoLower ( double  upper,
int  numPrecollect = 100,
double  rangeExtensionFactor = 2.0 
)
virtual

Selects a histogram range setup method where the upper bound of the range is fixed and the lower bound is determined from a set of pre-collected values.

The lower bound is calculated by extending the range (minimum of observations, upper) rangeExtensionFactor times.

◆ setRangeAutoUpper()

virtual void setRangeAutoUpper ( double  lower,
int  numPrecollect = 100,
double  rangeExtensionFactor = 2.0 
)
virtual

Selects a histogram range setup method where the lower bound of the range is fixed and the upper bound is determined from a set of pre-collected values.

The upper bound is calculated by extending the range (lower, maximum of observations) rangeExtensionFactor times.

◆ setNumPrecollectedValues()

virtual void setNumPrecollectedValues ( int  numPrecollect)
virtual

Sets the number of values to be pre-collected before transformation takes place. See setUpBins().

◆ getNumPrecollectedValues()

virtual int getNumPrecollectedValues ( ) const
inlinevirtual

Returns the number of values to be pre-collected before transformation takes place. See setUpBins().

◆ getRangeExtensionFactor()

virtual double getRangeExtensionFactor ( ) const
inlinevirtual

Returns the range extension factor, used with histogram range setup. See setRangeAuto() and setUpBins().

◆ setupRange()

virtual void setupRange ( )
protectedvirtual

Called internally by setUpBins(), this method should determine and set up the histogram range, based on the pre-collected data and the range setup method selected by calls to the setRange(), setRangeAuto(), setRangeAutoLower(), setRangeAutoUpper() methods.

◆ collectIntoHistogram()

virtual void collectIntoHistogram ( double  value)
protectedpure virtual

Called internally by collect(), this method collects a value after the histogram bins have been set up. Updating the underflow/overflow bins must be handled within this function. This is a pure virtual function; it must be redefined in subclasses.

Implemented in cKSplit.

◆ collectWeightedIntoHistogram()

virtual void collectWeightedIntoHistogram ( double  value,
double  weight 
)
protectedpure virtual

Called internally by collect(), this method collects a value after the histogram bin have been set up. Updating the underflow/overflow bins must be handled within this function. This is a pure virtual function; it must be redefined in subclasses.

Implemented in cKSplit.

◆ binsAlreadySetUp()

virtual bool binsAlreadySetUp ( ) const
inlineoverridevirtual

Returns true if the histogram bins have already been set up. See setUpBins().

Implements cAbstractHistogram.

◆ getNumUnderflows()

virtual int64_t getNumUnderflows ( ) const
inlineoverridevirtual

Returns number of observations that were below the histogram range, independent of their weights.

Implements cAbstractHistogram.

◆ getNumOverflows()

virtual int64_t getNumOverflows ( ) const
inlineoverridevirtual

Returns number of observations that were above the histogram range, independent of their weights.

Implements cAbstractHistogram.

◆ getUnderflowSumWeights()

virtual double getUnderflowSumWeights ( ) const
inlineoverridevirtual

Returns the total weight of the observations that were below the histogram range.

Implements cAbstractHistogram.

◆ getOverflowSumWeights()

virtual double getOverflowSumWeights ( ) const
inlineoverridevirtual

Returns the total weight of the observations that were above the histogram range.

Implements cAbstractHistogram.

◆ getNumNegInfs()

virtual int64_t getNumNegInfs ( ) const
inlineoverridevirtual

Returns number of observations that were negative infinity, independent of their weights.

Implements cAbstractHistogram.

◆ getNumPosInfs()

virtual int64_t getNumPosInfs ( ) const
inlineoverridevirtual

Returns number of observations that were positive infinity, independent of their weights.

Implements cAbstractHistogram.

◆ getNegInfSumWeights()

virtual double getNegInfSumWeights ( ) const
inlineoverridevirtual

Returns the total weight of the observations that were negative infinity.

Implements cAbstractHistogram.

◆ getPosInfSumWeights()

virtual double getPosInfSumWeights ( ) const
inlineoverridevirtual

Returns the total weight of the observations that were positive infinity.

Implements cAbstractHistogram.

◆ collect() [2/3]

virtual void collect

Collects one value.

◆ collect() [3/3]

virtual void collect
inline

Convenience method, delegates to collect(double).

◆ collectWeighted() [2/5]

virtual void collectWeighted

Collects one value with a given weight.

◆ collectWeighted() [3/5]

virtual void collectWeighted
inline

Convenience method, delegates to collectWeighted(double, double).

◆ collectWeighted() [4/5]

virtual void collectWeighted
inline

Convenience method, delegates to collectWeighted(double, double).

◆ collectWeighted() [5/5]

virtual void collectWeighted
inline

Convenience method, delegates to collectWeighted(double, double).


The documentation for this class was generated from the following file: