Documentation of 'umontreal.iro.lecuyer.simevents.Accumulate' Java class
Accumulate
umontreal.iro.lecuyer.simevents

Class Accumulate

  • All Implemented Interfaces:
    java.lang.Cloneable


    public class Accumulate
    extends StatProbe
    implements java.lang.Cloneable
    A subclass of 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 must be called to inform the probe of the new value. The probe can be reinitialized by init.
    • Constructor Summary

      Constructors 
      Constructor and Description
      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(Simulator inSim, java.lang.String name)
      Construct and initializes a new Accumulate statistical probe with name name and initial time 0.
      Accumulate(java.lang.String name)
      Construct and initializes a new Accumulate statistical probe with name name and initial time 0, using the default simulator.
    • Constructor Detail

      • Accumulate

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

        public Accumulate(Simulator inSim)
        Constructs a new Accumulate statistical probe linked to the given simulator, and initializes it by invoking init().
        Parameters:
        inSim - the simulator of the current variable
      • Accumulate

        public Accumulate(java.lang.String name)
        Construct and initializes a new Accumulate statistical probe with name name and initial time 0, using the default simulator.
      • Accumulate

        public Accumulate(Simulator inSim,
                          java.lang.String name)
        Construct and initializes a new Accumulate statistical probe with name name and initial time 0.
        Parameters:
        name - descriptive name for the probe
        inSim - the simulator of the current variable
    • Method Detail

      • init

        public void init()
        Initializes the statistical collector and puts the current value of the corresponding variable to 0. A call to init should normally be followed immediately by a call to update to give the value of the variable at the initialization time.
        Specified by:
        init in class StatProbe
      • init

        public void init(double x)
        Same as init followed by update(x).
        Parameters:
        x - initial value of the probe
      • update

        public void update()
        Updates the accumulator using the last value passed to update.
      • update

        public void 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.
        Parameters:
        x - new observation given to the probe
      • sum

        public double sum()
        Description copied from class: StatProbe
        Returns the sum cumulated so far for this probe. The meaning of this sum depends on the subclass (e.g., Tally or Accumulate). This returns 0 if the probe was not updated since the last initialization.
        Overrides:
        sum in class StatProbe
        Returns:
        the sum for this probe
      • average

        public double average()
        Returns the time-average since the last initialization to the last call to update.
        Specified by:
        average in class StatProbe
        Returns:
        the average value of the collected observations
      • shortReportHeader

        public java.lang.String shortReportHeader()
        Description copied from class: StatProbe
        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.
        Specified by:
        shortReportHeader in class StatProbe
        Returns:
        the header string for the short reports.
      • shortReport

        public java.lang.String shortReport()
        Description copied from class: StatProbe
        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.
        Specified by:
        shortReport in class StatProbe
        Returns:
        the short report for the probe.
      • report

        public java.lang.String report()
        Description copied from class: StatProbe
        Returns a string containing a report for this statistical collector. The contents of this report depends on the statistical probe as well as on the parameters set by the user through probe-specific methods.
        Specified by:
        report in class StatProbe
        Returns:
        a report for this probe, represented as a string
      • getInitTime

        public double 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
      • getLastTime

        public double 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
      • getLastValue

        public 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).
        Returns:
        the last update value for this object
      • simulator

        public Simulator simulator()
        Returns the simulator associated with this statistical probe.
        Returns:
        the associated simulator.
      • setSimulator

        public void 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:
        sim - the simulator of this probe

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.