Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
|
#include <running_stat.h>
Public Member Functions | |
RunningAverage (int window_size=1) | |
################## Implementations below ##################### | |
RunningAverage (const RunningAverage &)=delete | |
This type is neither copyable nor movable. | |
RunningAverage & | operator= (const RunningAverage &)=delete |
void | Reset (int window_size) |
void | Add (int value) |
Adds the next integer of the stream. | |
double | GlobalAverage () const |
double | WindowAverage () const |
bool | IsWindowFull () const |
void | ClearWindow () |
Clears the current window. | |
Simple class to compute the average over a fixed size window of an integer stream.
Definition at line 27 of file running_stat.h.
|
inlineexplicit |
################## Implementations below #####################
Initialize the class with the maximum window size. It must be positive (this is CHECKed).
Definition at line 101 of file running_stat.h.
|
delete |
This type is neither copyable nor movable.
|
inline |
Adds the next integer of the stream.
Definition at line 116 of file running_stat.h.
|
inline |
Clears the current window.
Definition at line 136 of file running_stat.h.
|
inline |
Returns the average of all the values added so far or zero if no values where added.
Definition at line 127 of file running_stat.h.
|
inline |
Returns true iff the current window size is equal to the one specified in the constructor.
Definition at line 141 of file running_stat.h.
|
delete |
|
inline |
Resets the class to the exact same state as if it was just constructed with the given window size.
Definition at line 109 of file running_stat.h.
|
inline |
Returns the average of the values in the current window or zero if the current window is empty.
Definition at line 131 of file running_stat.h.