OMNeT++/OMNEST Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000769OMNeT++simulation kernelpublic2014-07-31 12:102014-11-30 12:12
Reporterpaolinux 
Assigned Toandras 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version4.5 
Target VersionFixed in Version4.6 
Summary0000769: cVarHistogram produces wrong results with custom (ie manually specified) cells
DescriptionHi there,

I've tried to use cVarHistogram with custom cells as described in Section 7.8.2 "Histogram with Custom Cells" of the manual(http://www.omnetpp.org/doc/omnetpp/manual/usman.html#sec288 [^]). However, when I look at the scalar file, all samples are binned in the same cell, regardless of their value.

I've attached the .cc file to reproduce this behaviour.

Looking at the code of cvarhist.cc, it seems that the problem is that the variable rangemax does not get updated when using custom cells and it has always set to zero. Therefore, when the collectTransformed() method is called, all values ended up being counted as cell_over.

oid cVarHistogram::collectTransformed(double val)
{
    if (val < rangemin) // rangemin == bin_bounds[0]
    {
       cell_under++;
    }
    else if (val >= rangemax) // rangemax == bin_bounds[num_cells]
    {
       cell_over++;
    }
    else // sample falls in the range of ordinary cells/bins
    {
            // ....
    }


I believe the solution is to update rangemax in the addBinBound method.

Let me know if you need any more information,

Thanks,
Paolo


TagsNo tags attached.
Attached Files? file icon HistogramDemo.cc [^] (938 bytes) 2014-07-31 12:10

- Relationships

-  Notes
(0000953)
andras (administrator)
2014-11-28 14:50

The problem is that rangemin/rangemax is not up to date at the time of collect().

> I believe the solution is to update rangemax in the addBinBound method.

The problem with this is that in auto-bins mode, cVarHistogram::transform() uses previously computed rangemin/rangemax variables while creating cells via addBinBound() -- so addBinBound() automatically updating rangemin/rangemax would cause problem/confusion here.

2 better solutions:
  a) let transform() do setting up rangemin/rangemax, and transform() should automatically be invoked on the first collect() call when in manual bins mode. (and further addBinBound() calls after transform() should be prohibited.)

  b) rename existing addBinBound() to doAddBinBound(), and add a new public addBinBound() that calls doAddBinBound() and additionally adjusts rangemin/max too.

Probably (a) is better.
(0000956)
andras (administrator)
2014-11-30 09:37

To complicate matters, the user may also manually specify rangemin, rangemax, or both (see range_mode and RANGE_AUTOUPPER,RANGE_AUTOLOWER,RANGE_FIXED constants), and they may conflict with manually added bin bounds. These cases should be reported as errors.

- Issue History
Date Modified Username Field Change
2014-07-31 12:10 paolinux New Issue
2014-07-31 12:10 paolinux File Added: HistogramDemo.cc
2014-11-28 14:50 andras Note Added: 0000953
2014-11-30 09:37 andras Note Added: 0000956
2014-11-30 12:12 andras Status new => resolved
2014-11-30 12:12 andras Fixed in Version => 4.6
2014-11-30 12:12 andras Resolution open => fixed
2014-11-30 12:12 andras Assigned To => andras
2015-10-12 09:28 ammmar1988 Issue cloned: 0000873


Copyright © 2000 - 2019 MantisBT Team
Powered by Mantis Bugtracker