OMNeT++ Simulation Library
5.6.1
|
#include <cvarhist.h>
Variable bin size histogram.
One may add bin (bin) boundaries manually, or let the object create bins with approximately equal number of observations in them.
The histogram range (rangemin, rangemax) is chosen after precollection of the initial observations has finished. It is not possible to add bins after the histogram has already been set up.
Public Types | |
enum | TransformType { HIST_TR_NO_TRANSFORM, HIST_TR_AUTO_EPC_DBL, HIST_TR_AUTO_EPC_INT } |
Public Types inherited from cPrecollectionBasedDensityEst | |
enum | RangeMode |
Constants for histogram range_mode. More... | |
Public Member Functions | |
Constructors, destructor, assignment. | |
cVarHistogram (const cVarHistogram &r) | |
cVarHistogram (const char *name=nullptr, int numcells=11, TransformType transformtype=HIST_TR_AUTO_EPC_DBL) | |
virtual | ~cVarHistogram () |
cVarHistogram & | operator= (const cVarHistogram &res) |
Redefined cObject member functions. | |
virtual cVarHistogram * | dup () const override |
virtual void | parsimPack (cCommBuffer *buffer) const override |
virtual void | parsimUnpack (cCommBuffer *buffer) override |
Redefined member functions from cStatistic and its subclasses. | |
virtual void | clear () override |
virtual void | setUpBins () override |
virtual void | collectIntoHistogram (double value) override |
virtual void | collectWeightedIntoHistogram (double value, double weight) override |
virtual double | draw () const override |
virtual double | getPDF (double x) const override |
virtual double | getCDF (double x) const override |
virtual double | getBinEdge (int k) const override |
virtual double | getBinValue (int k) const override |
virtual void | saveToFile (FILE *) const override |
virtual void | loadFromFile (FILE *) override |
Setting up the histogram. | |
virtual void | addBinBound (double x) |
Public Member Functions inherited from cLegacyHistogramBase | |
cLegacyHistogramBase (const cLegacyHistogramBase &r) | |
cLegacyHistogramBase (const char *name, int numcells, bool weighted=false) | |
virtual | ~cLegacyHistogramBase () |
cLegacyHistogramBase & | operator= (const cLegacyHistogramBase &res) |
virtual int | getNumBins () const override |
virtual void | setNumCells (int numcells) |
Public Member Functions inherited from cPrecollectionBasedDensityEst | |
cPrecollectionBasedDensityEst (const cPrecollectionBasedDensityEst &other) | |
cPrecollectionBasedDensityEst (const char *name=nullptr, bool weighted=false) | |
virtual | ~cPrecollectionBasedDensityEst () |
cPrecollectionBasedDensityEst & | operator= (const cPrecollectionBasedDensityEst &res) |
virtual void | collect (double value) override |
virtual void | collectWeighted (double value, double weight) override |
virtual void | merge (const cStatistic *other) override |
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 |
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) | |
cAbstractHistogram (const char *name=nullptr, bool weighted=false) | |
virtual | ~cAbstractHistogram () |
cAbstractHistogram & | operator= (const cAbstractHistogram &res) |
virtual double | getBinPDF (int k) const |
virtual Bin | getBinInfo (int k) const |
virtual _OPPDEPRECATED bool | isTransformed () const final |
virtual _OPPDEPRECATED void | transform () final |
virtual _OPPDEPRECATED int | getNumCells () const final |
virtual _OPPDEPRECATED double | getBasepoint (int k) const final |
virtual _OPPDEPRECATED double | getCellValue (int k) const final |
virtual _OPPDEPRECATED double | getCellPDF (int k) const final |
virtual _OPPDEPRECATED int64_t | getUnderflowCell () const final |
virtual _OPPDEPRECATED int64_t | getOverflowCell () const final |
virtual _OPPDEPRECATED Bin | getCellInfo (int k) const final |
Public Member Functions inherited from cStdDev | |
cStdDev (const cStdDev &r) | |
cStdDev (const char *name=nullptr, bool weighted=false) | |
virtual | ~cStdDev () |
cStdDev & | operator= (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 |
Public Member Functions inherited from cStatistic | |
cStatistic (const cStatistic &r) | |
cStatistic (const char *name=nullptr) | |
virtual | ~cStatistic () |
cStatistic & | operator= (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) |
virtual _OPPDEPRECATED double | getWeights () const final |
virtual _OPPDEPRECATED void | collect2 (double value, double weight) final |
virtual _OPPDEPRECATED void | collect2 (SimTime value, double weight) final |
virtual _OPPDEPRECATED void | collect2 (double value, SimTime weight) final |
virtual _OPPDEPRECATED void | collect2 (SimTime value, SimTime weight) final |
virtual _OPPDEPRECATED double | random () const final |
virtual _OPPDEPRECATED void | clearResult () final |
Public Member Functions inherited from cRandom | |
cRandom (cRNG *rng) | |
cRandom (const char *name=nullptr, cRNG *rng=nullptr) | |
virtual | ~cRandom () |
virtual void | setRNG (cRNG *rng) |
cRNG * | getRNG () const |
Public Member Functions inherited from cOwnedObject | |
cOwnedObject () | |
cOwnedObject (const char *name, bool namepooling=true) | |
cOwnedObject (const cOwnedObject &obj) | |
virtual | ~cOwnedObject () |
cOwnedObject & | operator= (const cOwnedObject &o) |
virtual cObject * | getOwner () const override |
virtual bool | isOwnedObject () const override |
virtual bool | isSoftOwner () const |
Public Member Functions inherited from cNamedObject | |
cNamedObject () | |
cNamedObject (const char *name, bool namepooling=true) | |
cNamedObject (const cNamedObject &obj) | |
virtual | ~cNamedObject () |
cNamedObject & | operator= (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) | |
virtual | ~cObject () |
virtual const char * | getClassName () const |
bool | isName (const char *s) const |
virtual const char * | getFullName () const |
virtual std::string | getFullPath () const |
const cObject * | getThisPtr () const |
virtual _OPPDEPRECATED std::string | info () const |
virtual _OPPDEPRECATED std::string | detailedInfo () const |
virtual void | forEachChild (cVisitor *v) |
cObject * | findObject (const char *name, bool deep=true) |
void | copyNotSupported () const |
Protected Member Functions | |
void | createEquiprobableCells () |
Protected Member Functions inherited from cPrecollectionBasedDensityEst | |
virtual void | setupRange () |
Protected Member Functions inherited from cObject | |
virtual void | take (cOwnedObject *obj) |
virtual void | drop (cOwnedObject *obj) |
void | dropAndDelete (cOwnedObject *obj) |
Additional Inherited Members | |
Static Public Member Functions inherited from cOwnedObject | |
static long | getTotalObjectCount () |
static long | getLiveObjectCount () |
static void | resetObjectCounters () |
static cDefaultList * | getDefaultOwner () |
enum TransformType |
Controls the way histogram bins are set up at the end of the precollection period.
Enumerator | |
---|---|
HIST_TR_NO_TRANSFORM | no transformation; uses bin boundaries previously defined by addBinBound()/appendBinBound() |
HIST_TR_AUTO_EPC_DBL | automatically creates equi-probable bins |
HIST_TR_AUTO_EPC_INT | a variation of HIST_TR_AUTO_EPC_DBL |
|
inline |
Copy constructor.
|
explicit |
Constructor. The third argument can be one of HIST_TR_NO_TRANSFORM, HIST_TR_AUTO_EPC_DBL, HIST_TR_AUTO_EPC_INT. With HIST_TR_NO_TRANSFORM, you can set up bins manually (see addBinBound()), in the other two cases it tries to create equiprobably bins.
|
virtual |
Destructor.
|
protected |
Used internally to create equiprobable bins from the precollected observations. This cannot be mixed with manually adding bin boundaries – if there are already some, an error is raised.
cVarHistogram& operator= | ( | const cVarHistogram & | res | ) |
Assignment operator. The name member is not copied; see cNamedObject's operator=() for more details.
|
inlineoverridevirtual |
Creates and returns an exact copy of this object. See cObject for more details.
Reimplemented from cAbstractHistogram.
|
overridevirtual |
Serializes the object into an MPI send buffer. Used by the simulation kernel for parallel execution. See cObject for more details.
Reimplemented from cLegacyHistogramBase.
|
overridevirtual |
Deserializes the object from an MPI receive buffer Used by the simulation kernel for parallel execution. See cObject for more details.
Reimplemented from cLegacyHistogramBase.
|
overridevirtual |
Clears the results collected so far.
Reimplemented from cLegacyHistogramBase.
|
overridevirtual |
Sets up the bins using the precollected observations.
Reimplemented from cLegacyHistogramBase.
|
overridevirtual |
Called internally by collect(), this method collects a value after the histogram bins have been set up.
Implements cPrecollectionBasedDensityEst.
|
overridevirtual |
Called internally by collect(), this method collects a value after the histogram bins have been set up.
Implements cPrecollectionBasedDensityEst.
|
overridevirtual |
Generates a random number based on the collected data.
Reimplemented from cAbstractHistogram.
|
overridevirtual |
Returns the value of the Probability Density Function at a given x.
Reimplemented from cAbstractHistogram.
|
overridevirtual |
Returns the value of the Cumulated Density Function at a given x.
Reimplemented from cAbstractHistogram.
|
overridevirtual |
Returns the kth bin boundary.
Implements cAbstractHistogram.
|
overridevirtual |
Returns the number of observations that fell into the kth histogram bin.
Implements cAbstractHistogram.
|
overridevirtual |
Writes the contents of the object into a text file.
Reimplemented from cLegacyHistogramBase.
|
overridevirtual |
Reads the object data from a file, in the format written out by saveToFile().
Reimplemented from cLegacyHistogramBase.
|
virtual |
Adds a new bin (bin) boundary. This method can only be called if HIST_TR_NO_TRANSFORM was specified in the constructor call, and only when the object is still in the initial data collection phase (that is, setUpBins() has been invoked yet).