ContactCenters
V. 0.9.9.

umontreal.iro.lecuyer.stat
Class TallyWithMovingWindow

java.lang.Object
  extended by umontreal.iro.lecuyer.stat.StatProbe
      extended by umontreal.iro.lecuyer.stat.Tally
          extended by umontreal.iro.lecuyer.stat.TallyWithMovingWindow
All Implemented Interfaces:
Cloneable

public class TallyWithMovingWindow
extends Tally

Represents a tally with a moving window of fixed length. Usually, a tally counts the observations from the time it is initialized to the current time. This tally can be used to collect observations during a moving time window divided in P successive intervals of fixed duration d. This tally defines P internal tallies collecting period-specific observations. When an observation is given to this tally, it is added into the current tally which is changed by a simulation event happening every d time units. After the Pth period, the first tally becomes the current tally again, and its observations are lost.

This tally can be used as a usual tally, except start() must be called at the simulation time corresponding to the beginning of the first collecting period.


Field Summary
 
Fields inherited from class umontreal.iro.lecuyer.stat.Tally
confidenceInterval, digits, level
 
Fields inherited from class umontreal.iro.lecuyer.stat.StatProbe
broadcast, collect, maxValue, minValue, name, showNobs, sumValue
 
Constructor Summary
TallyWithMovingWindow(boolean keepObs, int numCollectingPeriods, double collectingPeriodDuration, double endingTime)
          Constructs a new tally with moving window using numCollectingPeriods of duration collectingPeriodDuration, and with simulation ending at endingTime.
TallyWithMovingWindow(String name, boolean keepObs, int numCollectingPeriods, double collectingPeriodDuration, double endingTime)
          Constructs a new tally with moving window with name name, using numCollectingPeriods of duration collectingPeriodDuration, and with simulation ending at endingTime.
 
Method Summary
 void add(double x)
           
 double average()
           
 TallyWithMovingWindow clone()
          Clones this tally as well as the internal tallies.
 double getCollectingPeriodDuration()
          Returns the duration of the collecting periods.
 int getNumCollectingPeriods()
          Returns the number of collecting periods.
 Tally getTally(int i)
          Returns the ith internal tally.
 void init()
          Initializes this tally as well as all internal tallies.
 double max()
           
 double min()
           
 int numberObs()
           
 void start()
          Starts this tally with moving window by scheduling the first period-changing event.
 void stop()
          Stops this tally with moving average by cancelling the currently scheduled period-changing event.
 double variance()
          Computes and returns the sample variance of the observations in the moving window.
 
Methods inherited from class umontreal.iro.lecuyer.stat.Tally
confidenceIntervalNormal, confidenceIntervalStudent, confidenceIntervalVarianceChi2, formatCINormal, formatCINormal, formatCIStudent, formatCIStudent, formatCIVarianceChi2, getConfidenceLevel, report, report, reportAndCIStudent, reportAndCIStudent, setConfidenceIntervalNone, setConfidenceIntervalNormal, setConfidenceIntervalStudent, setConfidenceLevel, setShowNumberObs, shortReport, shortReportHeader, standardDeviation
 
Methods inherited from class umontreal.iro.lecuyer.stat.StatProbe
addObservationListener, clearObservationListeners, getName, isBroadcasting, isCollecting, notifyListeners, removeObservationListener, report, report, setBroadcasting, setCollecting, setName, sum
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TallyWithMovingWindow

public TallyWithMovingWindow(boolean keepObs,
                             int numCollectingPeriods,
                             double collectingPeriodDuration,
                             double endingTime)
Constructs a new tally with moving window using numCollectingPeriods of duration collectingPeriodDuration, and with simulation ending at endingTime.

Parameters:
keepObs - determines if the internal tallies can keep observations.
numCollectingPeriods - the number of collecting periods.
collectingPeriodDuration - the duration of a collecting period.
endingTime - the ending time of the simulation.

TallyWithMovingWindow

public TallyWithMovingWindow(String name,
                             boolean keepObs,
                             int numCollectingPeriods,
                             double collectingPeriodDuration,
                             double endingTime)
Constructs a new tally with moving window with name name, using numCollectingPeriods of duration collectingPeriodDuration, and with simulation ending at endingTime.

Parameters:
name - the name of the tally.
keepObs - determines if the internal tallies can keep observations.
numCollectingPeriods - the number of collecting periods.
collectingPeriodDuration - the duration of a collecting period.
endingTime - the ending time of the simulation.
Method Detail

getTally

public Tally getTally(int i)
Returns the ith internal tally.

Parameters:
i - the index of the internal tally.
Returns:
the internal tally.

getNumCollectingPeriods

public int getNumCollectingPeriods()
Returns the number of collecting periods.

Returns:
the number of collecting periods.

getCollectingPeriodDuration

public double getCollectingPeriodDuration()
Returns the duration of the collecting periods.

Returns:
the duration of the collecting periods.

init

public void init()
Initializes this tally as well as all internal tallies.

Overrides:
init in class Tally

start

public void start()
Starts this tally with moving window by scheduling the first period-changing event. This method should be called at the simulation time corresponding to the first period.


stop

public void stop()
Stops this tally with moving average by cancelling the currently scheduled period-changing event.


add

public void add(double x)
Overrides:
add in class Tally

average

public double average()
Overrides:
average in class Tally

clone

public TallyWithMovingWindow clone()
Clones this tally as well as the internal tallies.

Overrides:
clone in class Tally

numberObs

public int numberObs()
Overrides:
numberObs in class Tally

variance

public double variance()
Computes and returns the sample variance of the observations in the moving window. This method can be used only if the internal tallies can store observations.

Overrides:
variance in class Tally

max

public double max()
Overrides:
max in class StatProbe

min

public double min()
Overrides:
min in class StatProbe

ContactCenters
V. 0.9.9.

To submit a bug or ask questions, send an e-mail to Richard Simard.