ContactCenters
V. 0.9.9.

umontreal.iro.lecuyer.contactcenters
Class RepSimCC

java.lang.Object
  extended by umontreal.iro.lecuyer.simexp.SimExp
      extended by umontreal.iro.lecuyer.simexp.RepSim
          extended by umontreal.iro.lecuyer.contactcenters.RepSimCC

public abstract class RepSimCC
extends RepSim

Extends RepSim to use measure matrices as counters, to compute observations. This class defines a list matrices of measures that can be added to. At the beginning of each replication, the matrices are initialized, and the program updates them. Each column of such matrices usually corresponds to a period as defined by a period-change event. At the end of the replication, in the RepSim.addReplicationObs(int) method, values are extracted from the matrices before they are added to matrices of tallies.


Field Summary
 
Fields inherited from class umontreal.iro.lecuyer.simexp.SimExp
sim, simulating
 
Constructor Summary
RepSimCC(int minReps)
          Calls super (minReps).
RepSimCC(int minReps, int maxReps)
          Calls super (minReps, maxReps).
RepSimCC(Simulator sim, int minReps)
          Calls RepSim.RepSim(Simulator,int).
RepSimCC(Simulator sim, int minReps, int maxReps)
          Calls RepSim.RepSim(Simulator,int,int).
 
Method Summary
 List<MeasureMatrix> getMeasureMatrices()
          Returns the matrices of measures registered to this object.
static DoubleMatrix2D getReplicationValues(MeasureMatrix mat)
          Constructs a matrix m with as many rows as the number of measures in mat and as many columns as the number of periods, calls getReplicationValues (mat, m) to fill the matrix, and returns it.
static DoubleMatrix2D getReplicationValues(MeasureMatrix mat, boolean preliminary, boolean wrapup)
          Equivalent to getReplicationValues (mat, preliminary, wrapup, null).
static DoubleMatrix2D getReplicationValues(MeasureMatrix mat, boolean preliminary, boolean wrapup, boolean[] mainPeriods)
          Computes the matrix of observations for the measure matrix mat, and returns the result in a matrix.
static DoubleMatrix2D getReplicationValues(MeasureMatrix mat, DoubleMatrix2D m)
          Computes the matrix of observations from the matrix of measures mat, and stores the result in m.
static DoubleMatrix2D getReplicationValues(MeasureMatrix mat, DoubleMatrix2D m, boolean preliminary, boolean wrapup)
          Equivalent to getReplicationValues (mat, m, preliminary, wrapup, null).
static DoubleMatrix2D getReplicationValues(MeasureMatrix mat, DoubleMatrix2D m, boolean preliminary, boolean wrapup, boolean[] mainPeriods)
          Computes the matrix of observations for the measure matrix mat and stores the result in m.
 void performReplication(int r)
          This method is overridden to initialize the matrices of measures after the simulator is initialized.
static DoubleMatrix2D timeNormalize(PeriodChangeEvent pce, DoubleMatrix2D m, boolean preliminary, boolean wrapup)
          Equivalent to timeNormalize (pce, m, preliminary, wrapup, null).
static DoubleMatrix2D timeNormalize(PeriodChangeEvent pce, DoubleMatrix2D m, boolean preliminary, boolean wrapup, boolean[] mainPeriods)
          Equivalent to timeNormalize(PeriodChangeEvent,DoubleMatrix2D,double) with automatic computation of total simulation time.
static DoubleMatrix2D timeNormalize(PeriodChangeEvent pce, DoubleMatrix2D m, double totalTime)
          Normalizes the matrix m using simulation time.
 
Methods inherited from class umontreal.iro.lecuyer.simexp.RepSim
addReplicationObs, adjustTargetReplications, getCompletedReplications, getMaxReplications, getMinReplications, getRequiredNewReplications, getTargetReplications, init, initReplication, initReplicationProbes, replicationDone, setMaxReplications, setMinReplications, setTargetReplications, simulate, toString
 
Methods inherited from class umontreal.iro.lecuyer.simexp.SimExp
getRequiredNewObservations, getRequiredNewObservations, getRequiredNewObservations, getRequiredNewObservations, getRequiredNewObservationsTally, getRequiredNewObservationsTally, isSimulating, setSimulator, simulator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RepSimCC

public RepSimCC(int minReps)
Calls super (minReps).


RepSimCC

public RepSimCC(Simulator sim,
                int minReps)
Calls RepSim.RepSim(Simulator,int).


RepSimCC

public RepSimCC(int minReps,
                int maxReps)
Calls super (minReps, maxReps).


RepSimCC

public RepSimCC(Simulator sim,
                int minReps,
                int maxReps)
Calls RepSim.RepSim(Simulator,int,int).

Method Detail

getMeasureMatrices

public List<MeasureMatrix> getMeasureMatrices()
Returns the matrices of measures registered to this object. These matrices must be capable of supporting multiple periods. The returned list should contain non-null instances of MeasureMatrix only.

Returns:
the list of measure matrices.

performReplication

public void performReplication(int r)
This method is overridden to initialize the matrices of measures after the simulator is initialized.

Overrides:
performReplication in class RepSim

getReplicationValues

public static DoubleMatrix2D getReplicationValues(MeasureMatrix mat,
                                                  DoubleMatrix2D m)
Computes the matrix of observations from the matrix of measures mat, and stores the result in m. The returned matrix has the same number of rows as the number of measures and the same number of columns as the number of periods. Element (r, c) of the matrix is given by mat.getMeasure (r, c).

Parameters:
mat - the matrix of measures for which observations are queried.
m - the matrix of double's filled with the result.
Returns:
the given matrix m.
Throws:
IllegalArgumentException - if the dimensions of the matrix are invalid.
NullPointerException - if mat or m are null.

getReplicationValues

public static DoubleMatrix2D getReplicationValues(MeasureMatrix mat)
Constructs a matrix m with as many rows as the number of measures in mat and as many columns as the number of periods, calls getReplicationValues (mat, m) to fill the matrix, and returns it.

Parameters:
mat - the measure matrix for which observations are queried.
Returns:
the matrix filled with the result.
Throws:
NullPointerException - if mat is null.

getReplicationValues

public static DoubleMatrix2D getReplicationValues(MeasureMatrix mat,
                                                  DoubleMatrix2D m,
                                                  boolean preliminary,
                                                  boolean wrapup,
                                                  boolean[] mainPeriods)
Computes the matrix of observations for the measure matrix mat and stores the result in m. It is assumed that the matrix contains observations for np periods, including a preliminary and a wrap-up periods. The matrix m must contain observations for main periods only as well as the time-aggregate observations. If preliminary is set to true, the observations of the preliminary period will be included in the time-aggregate count. If wrapup is true, the observations in the wrap-up period will be included. If mainPeriods is null, all main periods will be included in the aggregate values. Otherwise, the value for (main) period p will be included in the aggregated sum if and only if mainPeriods[p - 1] is true.

Each column of the matrix corresponds to one period and the last column contains the values for the whole replication. Each row corresponds to one type of measure.

Parameters:
mat - the measure matrix for which observations are queried.
m - the matrix filled with the result.
preliminary - if the preliminary period is included in the last column of the matrix.
wrapup - if the wrap-up period is included in the last column of the matrix.
mainPeriods - indicates which main periods are included in the aggregate measure.
Returns:
the given matrix m.
Throws:
IllegalArgumentException - if the dimensions of the matrix are invalid, or if mainPeriods is non-null and has an invalid length.
NullPointerException - if mat or m are null.

getReplicationValues

public static DoubleMatrix2D getReplicationValues(MeasureMatrix mat,
                                                  DoubleMatrix2D m,
                                                  boolean preliminary,
                                                  boolean wrapup)
Equivalent to getReplicationValues (mat, m, preliminary, wrapup, null).

Parameters:
mat - the measure matrix for which observations are queried.
m - the matrix filled with the result.
preliminary - if the preliminary period is included in the last column of the matrix.
wrapup - if the wrap-up period is included in the last column of the matrix.
Returns:
the given matrix m.
Throws:
IllegalArgumentException - if the dimensions of the matrix are invalid.
NullPointerException - if mat or m are null.

getReplicationValues

public static DoubleMatrix2D getReplicationValues(MeasureMatrix mat,
                                                  boolean preliminary,
                                                  boolean wrapup,
                                                  boolean[] mainPeriods)
Computes the matrix of observations for the measure matrix mat, and returns the result in a matrix. This method uses getReplicationValues for the computation.

Parameters:
mat - the measure matrix for which observations are queried.
preliminary - if the preliminary period is included in the last column of the matrix.
wrapup - if the wrap-up period is included in the last column of the matrix.
mainPeriods - indicates which main periods are included in the aggregated measure.
Returns:
the matrix filled with the result.
Throws:
NullPointerException - if mat or m are null.
IllegalArgumentException - if mainPeriods is not null and has an invalid length.

getReplicationValues

public static DoubleMatrix2D getReplicationValues(MeasureMatrix mat,
                                                  boolean preliminary,
                                                  boolean wrapup)
Equivalent to getReplicationValues (mat, preliminary, wrapup, null).

Parameters:
mat - the measure matrix for which observations are queried.
preliminary - if the preliminary period is included in the last column of the matrix.
wrapup - if the wrap-up period is included in the last column of the matrix.
Returns:
the matrix filled with the result.
Throws:
NullPointerException - if mat or m are null.

timeNormalize

public static DoubleMatrix2D timeNormalize(PeriodChangeEvent pce,
                                           DoubleMatrix2D m,
                                           double totalTime)
Normalizes the matrix m using simulation time. Usually, this method receives a matrix produced by getReplicationValues(umontreal.iro.lecuyer.stat.mperiods.MeasureMatrix, cern.colt.matrix.DoubleMatrix2D). It assumes that each row corresponds to a count or an integral and one column corresponds to a main period. If there is one more column than the number of main periods, the last column corresponds to values for the whole replication. Each element of the matrix is divided by a simulation time determined by the period-change event pce. For each column c corresponding to one main period, each row is divided by the period duration obtained using PeriodChangeEvent.getPeriodDuration (c + 1). For the column corresponding to the whole replication, the rows are divided by the total simulation time totalTime.

Parameters:
pce - the period-change event defining the periods.
m - the matrix being normalized.
totalTime - the supplied total simulation time.
Returns:
the given matrix m.
Throws:
IllegalArgumentException - if the number of columns of m is incorrect.

timeNormalize

public static DoubleMatrix2D timeNormalize(PeriodChangeEvent pce,
                                           DoubleMatrix2D m,
                                           boolean preliminary,
                                           boolean wrapup,
                                           boolean[] mainPeriods)
Equivalent to timeNormalize(PeriodChangeEvent,DoubleMatrix2D,double) with automatic computation of total simulation time. The total time is computed by summing the duration of the periods defined by pce. The parameters preliminary, wrapup and mainPeriods play the same role as with getReplicationValues(umontreal.iro.lecuyer.stat.mperiods.MeasureMatrix, cern.colt.matrix.DoubleMatrix2D).

Parameters:
pce - the period-change event defining the periods.
m - the matrix being normalized.
preliminary - determines if the preliminary period is included in the time-aggregate values.
wrapup - determines if the wrap-up period is included in the time-aggregate values.
mainPeriods - indicates which main periods are included in the aggregated measure.
Returns:
the given matrix m.
Throws:
IllegalArgumentException - if the number of columns of m is incorrect.

timeNormalize

public static DoubleMatrix2D timeNormalize(PeriodChangeEvent pce,
                                           DoubleMatrix2D m,
                                           boolean preliminary,
                                           boolean wrapup)
Equivalent to timeNormalize (pce, m, preliminary, wrapup, null).

Parameters:
pce - the period change event defining the periods.
m - the matrix being normalized.
preliminary - determines if the preliminary period is included in the time-aggregate values.
wrapup - determines if the wrap-up period is included in the time-aggregate values.
Returns:
the given matrix m.
Throws:
IllegalArgumentException - if the number of columns of m is incorrect.

ContactCenters
V. 0.9.9.

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