The classes
MedianStatistic
or
StdMedianStatistic
serve to register
single measured values (e.g., run times) of the type
double
with the help of
the method
update(double)
.
The following functions are available for evaluation:
If the parameter
maxBufferSize is set to zero, all samples will be
stored internally and the median will be calculated at the end of the
simulation. Since this is very memory consuming,
maxBufferSize can be
set to a number > 0, which determines the maximum number of samples the
statistic should hold in memory. The median is then calculated at the end of
the simulation as an approximation that is based on all samples.
For printing the results it defines the following keywords:
-
median
-
Median value of all measured values in reference to all batches
-
cintm
-
confidence interval to median value
-
max
-
maximum sample of all batches
-
min
-
minimum sample of all batches
-
bmedian
-
number of samples in actual Batch
The calculation of the median usually needs to buffer all measured values. In
order to save memory an approximation algorithm is served by the median
statistic class:
-
all values are saved in a list of value pairs of one double (value) and one
integer value (weight)
-
the weight is set to 1 for every new value added to the list
-
when the list size exceeds the maximum buffer size, all entries are sorted by
the value and grouped to pairs by adding their weight and calculating like
this:
value = value1 · weight1 + value2 · weight2
-
When the method
getMedian()
is called the list is sorted again by
value. Then the list is iterated from beginning until the sum of the
weight-values is larger than the half of the total sum of weights. After this
the found item and the previous item are selected and an linear approximation
between the two value pairs is done.