Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::DistributionStat Class Referenceabstract

#include <stats.h>

Inheritance diagram for operations_research::DistributionStat:
operations_research::Stat operations_research::DoubleDistribution operations_research::IntegerDistribution operations_research::RatioDistribution operations_research::TimeDistribution

Public Member Functions

 DistributionStat (absl::string_view name)
 
 DistributionStat ()
 
 DistributionStat (absl::string_view name, StatsGroup *group)
 
 ~DistributionStat () override
 
void Reset () override
 Reset this statistic to the same state as if it was newly created.
 
bool WorthPrinting () const override
 Is this stat worth printing? Usually false if nothing was measured.
 
std::string ValueAsString () const override=0
 Implemented by the subclasses.
 
double Sum () const override
 Trivial statistics on all the values added so far.
 
double Max () const
 
double Min () const
 
int64_t Num () const
 
double Average () const
 Get the average of the distribution or 0.0 if empty.
 
double StdDeviation () const
 
- Public Member Functions inherited from operations_research::Stat
 Stat (absl::string_view name)
 
 Stat (absl::string_view name, StatsGroup *group)
 Also add this stat to the given group.
 
virtual ~Stat ()
 
std::string Name () const
 Only used for display purposes.
 
std::string StatString () const
 
virtual int Priority () const
 

Protected Member Functions

void AddToDistribution (double value)
 Adds a value to this sequence and updates the stats.
 

Protected Attributes

double sum_
 
double average_
 
double sum_squares_from_average_
 
double min_
 
double max_
 
int64_t num_
 

Detailed Description

Base class to track and compute statistics about the distribution of a sequence of double. We provide a few sub-classes below that differ in the way the values are added to the sequence and in the way the stats are printed.

Definition at line 174 of file stats.h.

Constructor & Destructor Documentation

◆ DistributionStat() [1/3]

operations_research::DistributionStat::DistributionStat ( absl::string_view name)
explicit

Definition at line 129 of file stats.cc.

◆ DistributionStat() [2/3]

operations_research::DistributionStat::DistributionStat ( )
inline

Definition at line 177 of file stats.h.

◆ DistributionStat() [3/3]

operations_research::DistributionStat::DistributionStat ( absl::string_view name,
StatsGroup * group )

Definition at line 138 of file stats.cc.

◆ ~DistributionStat()

operations_research::DistributionStat::~DistributionStat ( )
inlineoverride

Definition at line 179 of file stats.h.

Member Function Documentation

◆ AddToDistribution()

void operations_research::DistributionStat::AddToDistribution ( double value)
protected

Adds a value to this sequence and updates the stats.

Definition at line 156 of file stats.cc.

◆ Average()

double operations_research::DistributionStat::Average ( ) const

Get the average of the distribution or 0.0 if empty.

Definition at line 174 of file stats.cc.

◆ Max()

double operations_research::DistributionStat::Max ( ) const
inline

Definition at line 188 of file stats.h.

◆ Min()

double operations_research::DistributionStat::Min ( ) const
inline

Definition at line 189 of file stats.h.

◆ Num()

int64_t operations_research::DistributionStat::Num ( ) const
inline

Definition at line 190 of file stats.h.

◆ Reset()

void operations_research::DistributionStat::Reset ( )
overridevirtual

Reset this statistic to the same state as if it was newly created.

Implements operations_research::Stat.

Definition at line 147 of file stats.cc.

◆ StdDeviation()

double operations_research::DistributionStat::StdDeviation ( ) const

Get the standard deviation of the distribution or 0.0 if empty. We use the on-line algorithm of Welford described at http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance

Todo
(user): We could also use on top the Kahan summation algorithm to be even more precise but a bit slower too.

Definition at line 176 of file stats.cc.

◆ Sum()

double operations_research::DistributionStat::Sum ( ) const
inlineoverridevirtual

Trivial statistics on all the values added so far.

Reimplemented from operations_research::Stat.

Definition at line 187 of file stats.h.

◆ ValueAsString()

std::string operations_research::DistributionStat::ValueAsString ( ) const
overridepure virtual

◆ WorthPrinting()

bool operations_research::DistributionStat::WorthPrinting ( ) const
inlineoverridevirtual

Is this stat worth printing? Usually false if nothing was measured.

Implements operations_research::Stat.

Definition at line 181 of file stats.h.

Member Data Documentation

◆ average_

double operations_research::DistributionStat::average_
protected

Definition at line 206 of file stats.h.

◆ max_

double operations_research::DistributionStat::max_
protected

Definition at line 209 of file stats.h.

◆ min_

double operations_research::DistributionStat::min_
protected

Definition at line 208 of file stats.h.

◆ num_

int64_t operations_research::DistributionStat::num_
protected

Definition at line 210 of file stats.h.

◆ sum_

double operations_research::DistributionStat::sum_
protected

Definition at line 205 of file stats.h.

◆ sum_squares_from_average_

double operations_research::DistributionStat::sum_squares_from_average_
protected

Definition at line 207 of file stats.h.


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