SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
umontreal.ssj.simevents.Accumulate Class Reference

A subclass of umontreal.ssj.stat.StatProbe, for collecting statistics on a variable that evolves in simulation time, with a piecewise-constant trajectory. More...

Inheritance diagram for umontreal.ssj.simevents.Accumulate:
umontreal.ssj.stat.StatProbe

Public Member Functions

 Accumulate ()
 Constructs a new Accumulate statistical probe using the default simulator and initializes it by invoking init().
 Accumulate (Simulator inSim)
 Constructs a new Accumulate statistical probe linked to the given simulator, and initializes it by invoking init().
 Accumulate (String name)
 Constructs and initializes a new Accumulate statistical probe with name name and initial time 0, using the default simulator.
 Accumulate (Simulator inSim, String name)
 Constructs-initializes a new Accumulate statistical probe with name name and initial time 0.
void init ()
 Initializes the statistical collector and puts the current value of the corresponding variable to 0.
void init (double x)
 Same as init followed by update(x).
void update ()
 Updates the accumulator using the last value passed to update(double).
void update (double x)
 Gives a new observation x to the statistical collector.
double sum ()
 Returns the sum cumulated so far for this probe.
double average ()
 Returns the time-average since the last initialization to the last call to update.
String shortReportHeader ()
 Returns a string containing the name of the values returned in the report strings.
String shortReport ()
 Formats and returns a short, one-line report about this statistical probe.
String report ()
 Returns a string containing a report on this collector since its last initialization.
double getInitTime ()
 Returns the initialization time for this object.
double getLastTime ()
 Returns the last update time for this object.
double getLastValue ()
 Returns the value passed to this probe by the last call to its update method (or the initial value if update was never called after init ).
Simulator simulator ()
 Returns the simulator associated with this statistical probe.
void setSimulator (Simulator sim)
 Sets the simulator associated with this probe to sim.
Accumulate clone ()
 Clone this object.
Public Member Functions inherited from umontreal.ssj.stat.StatProbe
void setName (String name)
 Sets the name of this statistical collector to name.
String getName ()
 Returns the name associated with this probe, or null if no name was specified upon construction.
double min ()
 Returns the smallest value taken by the variable since the last initialization of this probe.
double max ()
 Returns the largest value taken by the variable since the last initialization of this probe.
boolean isBroadcasting ()
 Determines if this statistical probe is broadcasting observations to registered observers.
void setBroadcasting (boolean b)
 Instructs the probe to turn its broadcasting ON or OFF.
boolean isCollecting ()
 Determines if this statistical probe is collecting values.
void setCollecting (boolean b)
 Turns ON or OFF the collection of statistical observations.
void addObservationListener (ObservationListener l)
 Adds the observation listener l to the list of observers of this statistical probe.
void removeObservationListener (ObservationListener l)
 Removes the observation listener l from the list of observers of this statistical probe.
void clearObservationListeners ()
 Removes all observation listeners from the list of observers of this statistical probe.
void notifyListeners (double x)
 Notifies the observation x to all registered observers if broadcasting is ON.

Additional Inherited Members

Static Public Member Functions inherited from umontreal.ssj.stat.StatProbe
static String report (String globalName, StatProbe[] probes)
 Formats short reports for each statistical probe in the array probes while aligning the probes’ names.
static String report (String globalName, Iterable<? extends StatProbe > probes)
 Equivalent to report(String,StatProbe[]), except that probes is an Iterable object instead of an array.

Detailed Description

A subclass of umontreal.ssj.stat.StatProbe, for collecting statistics on a variable that evolves in simulation time, with a piecewise-constant trajectory.

Each time the variable changes its value, the method update(double) must be called to inform the probe of the new value. The probe can be reinitialized by init.

Definition at line 44 of file Accumulate.java.

Constructor & Destructor Documentation

◆ Accumulate() [1/4]

umontreal.ssj.simevents.Accumulate.Accumulate ( )

Constructs a new Accumulate statistical probe using the default simulator and initializes it by invoking init().

Definition at line 55 of file Accumulate.java.

◆ Accumulate() [2/4]

umontreal.ssj.simevents.Accumulate.Accumulate ( Simulator inSim)

Constructs a new Accumulate statistical probe linked to the given simulator, and initializes it by invoking init().

Parameters
inSimthe simulator of the current variable

Definition at line 67 of file Accumulate.java.

◆ Accumulate() [3/4]

umontreal.ssj.simevents.Accumulate.Accumulate ( String name)

Constructs and initializes a new Accumulate statistical probe with name name and initial time 0, using the default simulator.

Definition at line 79 of file Accumulate.java.

◆ Accumulate() [4/4]

umontreal.ssj.simevents.Accumulate.Accumulate ( Simulator inSim,
String name )

Constructs-initializes a new Accumulate statistical probe with name name and initial time 0.

Parameters
namedescriptive name for the probe
inSimthe simulator of the current variable

Definition at line 93 of file Accumulate.java.

Member Function Documentation

◆ average()

double umontreal.ssj.simevents.Accumulate.average ( )

Returns the time-average since the last initialization to the last call to update.

Reimplemented from umontreal.ssj.stat.StatProbe.

Definition at line 169 of file Accumulate.java.

◆ clone()

Accumulate umontreal.ssj.simevents.Accumulate.clone ( )

Clone this object.

Reimplemented from umontreal.ssj.stat.StatProbe.

Definition at line 273 of file Accumulate.java.

◆ getInitTime()

double umontreal.ssj.simevents.Accumulate.getInitTime ( )

Returns the initialization time for this object.

This is the simulation time when init was called for the last time.

Returns
the initialization time for this object

Definition at line 224 of file Accumulate.java.

◆ getLastTime()

double umontreal.ssj.simevents.Accumulate.getLastTime ( )

Returns the last update time for this object.

This is the simulation time of the last call to update or the initialization time if update was never called after init.

Returns
the last update time of this object

Definition at line 235 of file Accumulate.java.

◆ getLastValue()

double umontreal.ssj.simevents.Accumulate.getLastValue ( )

Returns the value passed to this probe by the last call to its update method (or the initial value if update was never called after init ).

Returns
the last update value for this object

Definition at line 245 of file Accumulate.java.

◆ init() [1/2]

void umontreal.ssj.simevents.Accumulate.init ( )

Initializes the statistical collector and puts the current value of the corresponding variable to 0.

Note: the initialization time, the last update time and the simulation time are not reset to 0 by this method. For this, Sim.init() must be used.

Reimplemented from umontreal.ssj.stat.StatProbe.

Definition at line 108 of file Accumulate.java.

◆ init() [2/2]

void umontreal.ssj.simevents.Accumulate.init ( double x)

Same as init followed by update(x).

Parameters
xinitial value of the probe

Definition at line 123 of file Accumulate.java.

◆ report()

String umontreal.ssj.simevents.Accumulate.report ( )

Returns a string containing a report on this collector since its last initialization.

Reimplemented from umontreal.ssj.stat.StatProbe.

Definition at line 203 of file Accumulate.java.

◆ setSimulator()

void umontreal.ssj.simevents.Accumulate.setSimulator ( Simulator sim)

Sets the simulator associated with this probe to sim.

One should call init after this method to reset the statistical probe.

Parameters
simthe simulator of this probe

Definition at line 264 of file Accumulate.java.

◆ shortReport()

String umontreal.ssj.simevents.Accumulate.shortReport ( )

Formats and returns a short, one-line report about this statistical probe.

This line is composed of whitespace-separated fields which must correspond to the column names given by shortReportHeader(). This report should not contain any end-of-line character, and does not include the name of the probe. Its contents depends on the statistical probe as well as on the parameters set by the user through probe-specific methods.

Returns
the short report for the probe.

Reimplemented from umontreal.ssj.stat.StatProbe.

Definition at line 188 of file Accumulate.java.

◆ shortReportHeader()

String umontreal.ssj.simevents.Accumulate.shortReportHeader ( )

Returns a string containing the name of the values returned in the report strings.

The returned string must depend on the type of probe and on the reporting options only. It must not depend on the observations received by the probe. This can be used as header when printing several reports. For example,

         System.out.println (probe1.shortReportHeader());
         System.out.println (probe1.getName() + " " + probe1.shortReport());
         System.out.println (probe2.getName() + " " + probe2.shortReport());
         ...

Alternatively, one can use report(String,StatProbe[]) to get a report with aligned probe names.

Returns
the header string for the short reports.

Reimplemented from umontreal.ssj.stat.StatProbe.

Definition at line 178 of file Accumulate.java.

◆ simulator()

Simulator umontreal.ssj.simevents.Accumulate.simulator ( )

Returns the simulator associated with this statistical probe.

Returns
the associated simulator.

Definition at line 254 of file Accumulate.java.

◆ sum()

double umontreal.ssj.simevents.Accumulate.sum ( )

Returns the sum cumulated so far for this probe.

The meaning of this sum depends on the subclass (e.g., Tally or

umontreal.ssj.simevents.Accumulate ). This returns 0 if the probe was not updated since the last initialization.

Returns
the sum for this probe

Reimplemented from umontreal.ssj.stat.StatProbe.

Definition at line 160 of file Accumulate.java.

◆ update() [1/2]

void umontreal.ssj.simevents.Accumulate.update ( )

Updates the accumulator using the last value passed to update(double).

Definition at line 131 of file Accumulate.java.

◆ update() [2/2]

void umontreal.ssj.simevents.Accumulate.update ( double x)

Gives a new observation x to the statistical collector.

If broadcasting to observers is activated for this object, this method will also transmit the new information to the registered observers by invoking the methods notifyListeners(double).

Parameters
xnew observation given to the probe

Definition at line 143 of file Accumulate.java.


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