ContactCenters
V. 0.9.9.

umontreal.iro.lecuyer.contactcenters.app
Class MBatchMeansSim

java.lang.Object
  extended by umontreal.iro.lecuyer.contactcenters.app.AbstractContactCenterInfo
      extended by umontreal.iro.lecuyer.contactcenters.app.AbstractContactCenterEval
          extended by umontreal.iro.lecuyer.contactcenters.app.AbstractContactCenterSim
              extended by umontreal.iro.lecuyer.contactcenters.app.MBatchMeansSim
All Implemented Interfaces:
ContactCenterEval, ContactCenterInfo, ContactCenterSim

public class MBatchMeansSim
extends AbstractContactCenterSim

This simulator performs a certain number of replications of a simulation with batch means. An object from this class is constructed using a simulator which is assumed to use batch means. When an evaluation is triggered, the internal simulator is called several times to get values. This allows, e.g., to simulate with different values of λ for a Poisson-gamma arrival process.


Field Summary
 
Fields inherited from class umontreal.iro.lecuyer.contactcenters.app.AbstractContactCenterSim
autoResetStartStream, seqSampEachEval
 
Constructor Summary
MBatchMeansSim(ContactCenterSim sim, int numReps)
          Constructs a simulator running numReps independent batch means experiments using the internal simulator sim.
 
Method Summary
 void eval()
          Equivalent to eval (getNumTargetReplications()).
 void eval(int numReps)
          Performs numReps independent replications of a batch means simulation.
 String formatStatistics()
          Formats information about every performance measure after ContactCenterEval.eval() is called.
 String getAgentGroupName(int i)
          Returns the name associated with the agent group identifier i.
 int getCompletedSteps()
          Returns the number of completed steps for the simulation.
 double getConfidenceLevel()
          Returns the confidence level of the intervals output by ContactCenterEval.formatStatistics().
 String getContactTypeName(int k)
          Returns the name associated with the contact type k, where k is a number greater than or equal to 0 and smaller than ContactCenterInfo.getNumContactTypes().
 TimeUnit getDefaultUnit()
          Returns the time unit in which output performance measures representing times are expressed.
 Object getEvalOption(EvalOptionType option)
          Returns the current value of the evaluation option option.
 EvalOptionType[] getEvalOptions()
          Returns the array of the evaluation option types supported by the implementing object.
 MatrixOfTallies<Tally> getMatrixOfStatProbes(PerformanceMeasureType pm)
          Returns the matrix of statistical probes used to manage observations for estimating the performance measures in group m.
 int getNumAgentGroups()
          Returns the total number of agent groups supported by this contact center.
 int getNumContactTypes()
          Returns the total number of contact types supported by this contact center.
 int getNumInContactTypes()
          Returns the total number of inbound contact types for this contact center.
 int getNumMainPeriods()
          Returns the number of main periods used for evaluation, as defined in PeriodChangeEvent.
 int getNumMatricesOfAWT()
          Returns the number of matrices containing acceptable waiting times, for estimating service levels.
 int getNumOutContactTypes()
          Returns the total number of outbound contact types for this contact center.
 int getNumTargetReplications()
          Returns the default target number of replications.
 int getNumWaitingQueues()
          Returns the total number of waiting queues capable of storing contacts.
 PerformanceMeasureType[] getPerformanceMeasures()
          Returns an array containing all the groups of performance measures this object can estimate.
 ContactCenterSim getSimulator()
          Returns the internal simulator used by this object.
 String getWaitingQueueName(int q)
          Returns the name of the waiting queue with index q used by the evaluation.
 boolean hasEvalOption(EvalOptionType option)
          Determines if the evaluation option option is supported by the implemented system.
static void main(String[] args)
          Main method allowing to run this class from the command-line with CallCenterSim as the internal simulator.
 void newSeeds()
          Changes the seeds of the random number generators used during the simulation.
 void reset()
          Resets this contact center evaluation system for new parameters.
 void resetNextSubstream()
          Calls RandomStream.resetNextSubstream() for all random streams used by the simulator.
 void resetStartStream()
          Calls RandomStream.resetStartStream() for all random streams used by the simulator.
 void resetStartSubstream()
          Calls RandomStream.resetStartSubstream() for all random streams used by the simulator.
 boolean seemsUnstable()
          Determines if the system seems to be unstable.
 void setConfidenceLevel(double level)
          Sets the level of confidence for the intervals output by ContactCenterEval.formatStatistics() to level.
 void setEvalOption(EvalOptionType option, Object val)
          Sets the evaluation option option to value.
 
Methods inherited from class umontreal.iro.lecuyer.contactcenters.app.AbstractContactCenterSim
formatStatisticsExcel, formatStatisticsLaTeX, getAutoResetStartStream, getConfidenceInterval, getConfidenceInterval, getMatrixOfFunctionOfMultipleMeansTallies, getMatrixOfTallies, getMax, getMin, getOneSimDone, getPerformanceMeasure, getSeqSampEachEval, getVariance, hasPerformanceMeasure, setAutoResetStartStream, setOneSimDone, setSeqSampEachEval
 
Methods inherited from class umontreal.iro.lecuyer.contactcenters.app.AbstractContactCenterEval
getEvalInfo, getReportParams, isVerbose, setReportParams, setVerbose
 
Methods inherited from class umontreal.iro.lecuyer.contactcenters.app.AbstractContactCenterInfo
getAgentGroupProperties, getAgentGroupSegmentName, getAgentGroupSegmentProperties, getContactTypeProperties, getContactTypeSegmentName, getContactTypeSegmentProperties, getInContactTypeSegmentName, getInContactTypeSegmentProperties, getMainPeriodName, getMainPeriodSegmentName, getMatrixOfAWTName, getNumAgentGroupSegments, getNumAgentGroupsWithSegments, getNumContactTypeSegments, getNumContactTypesWithSegments, getNumInContactTypeSegments, getNumInContactTypesWithSegments, getNumMainPeriodSegments, getNumMainPeriodsWithSegments, getNumOutContactTypeSegments, getNumOutContactTypesWithSegments, getNumWaitingQueueSegments, getNumWaitingQueuesWithSegments, getOutContactTypeSegmentName, getOutContactTypeSegmentProperties, getWaitingQueueProperties, getWaitingQueueSegmentName, getWaitingQueueSegmentProperties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface umontreal.iro.lecuyer.contactcenters.app.ContactCenterEval
getEvalInfo, getReportParams, isVerbose, setReportParams, setVerbose
 
Methods inherited from interface umontreal.iro.lecuyer.contactcenters.app.ContactCenterInfo
getAgentGroupProperties, getAgentGroupSegmentName, getAgentGroupSegmentProperties, getContactTypeProperties, getContactTypeSegmentName, getContactTypeSegmentProperties, getInContactTypeSegmentName, getInContactTypeSegmentProperties, getMainPeriodName, getMainPeriodSegmentName, getMatrixOfAWTName, getNumAgentGroupSegments, getNumAgentGroupsWithSegments, getNumContactTypeSegments, getNumContactTypesWithSegments, getNumInContactTypeSegments, getNumInContactTypesWithSegments, getNumMainPeriodSegments, getNumMainPeriodsWithSegments, getNumOutContactTypeSegments, getNumOutContactTypesWithSegments, getNumWaitingQueueSegments, getNumWaitingQueuesWithSegments, getOutContactTypeSegmentName, getOutContactTypeSegmentProperties, getWaitingQueueProperties, getWaitingQueueSegmentName, getWaitingQueueSegmentProperties
 

Constructor Detail

MBatchMeansSim

public MBatchMeansSim(ContactCenterSim sim,
                      int numReps)
Constructs a simulator running numReps independent batch means experiments using the internal simulator sim. Confidence intervals are reported with level level.

Parameters:
sim - the internal simulator which is assumed to use batch means.
numReps - the number of independent batch means experiments.
Method Detail

getSimulator

public ContactCenterSim getSimulator()
Returns the internal simulator used by this object.

Returns:
the internal simulator.

getConfidenceLevel

public double getConfidenceLevel()
Description copied from interface: ContactCenterSim
Returns the confidence level of the intervals output by ContactCenterEval.formatStatistics(). The initial confidence level is implementation-specific, and usually set by a constructor.

Returns:
the level of confidence for the intervals.

setConfidenceLevel

public void setConfidenceLevel(double level)
Description copied from interface: ContactCenterSim
Sets the level of confidence for the intervals output by ContactCenterEval.formatStatistics() to level.

Parameters:
level - the level of confidence of the intervals.

getDefaultUnit

public TimeUnit getDefaultUnit()
Description copied from interface: ContactCenterInfo
Returns the time unit in which output performance measures representing times are expressed. If this method returns null, performance measures representing time are output as any other performance measures; no time conversion can be performed or time unit displayed.

Returns:
the default time unit.

getNumTargetReplications

public int getNumTargetReplications()
Returns the default target number of replications.

Returns:
the target number of replications.

getMatrixOfStatProbes

public MatrixOfTallies<Tally> getMatrixOfStatProbes(PerformanceMeasureType pm)
Description copied from interface: ContactCenterSim
Returns the matrix of statistical probes used to manage observations for estimating the performance measures in group m. The particular subclass of the statistical probe matrix depends on the performance measure type only. For averages, this method must return a MatrixOfTallies object. For functions of multiple averages, e.g., ratios of averages, this must return a MatrixOfFunctionOfMultipleMeansTallies.

Parameters:
pm - the group of performance measures of interest.
Returns:
the matrix of statistical probes.

eval

public void eval()
Equivalent to eval (getNumTargetReplications()).


eval

public void eval(int numReps)
Performs numReps independent replications of a batch means simulation.

Parameters:
numReps - the number of replications.

resetStartStream

public void resetStartStream()
Description copied from interface: ContactCenterSim
Calls RandomStream.resetStartStream() for all random streams used by the simulator.


resetStartSubstream

public void resetStartSubstream()
Description copied from interface: ContactCenterSim
Calls RandomStream.resetStartSubstream() for all random streams used by the simulator.


resetNextSubstream

public void resetNextSubstream()
Description copied from interface: ContactCenterSim
Calls RandomStream.resetNextSubstream() for all random streams used by the simulator.


getPerformanceMeasures

public PerformanceMeasureType[] getPerformanceMeasures()
Description copied from interface: ContactCenterEval
Returns an array containing all the groups of performance measures this object can estimate. If no performance measure is supported by a given implementation, this method should return an array with length 0 instead of null.

Returns:
the array of groups of performance measures.

hasEvalOption

public boolean hasEvalOption(EvalOptionType option)
Description copied from interface: ContactCenterEval
Determines if the evaluation option option is supported by the implemented system. It should return true if and only if the option is in the array returned by ContactCenterEval.getEvalOptions(). Otherwise, it returns false.

Parameters:
option - the queried evaluation option.
Returns:
the support status of the option.

getEvalOptions

public EvalOptionType[] getEvalOptions()
Description copied from interface: ContactCenterEval
Returns the array of the evaluation option types supported by the implementing object. The evaluation options are the variable parameters of the contact center which can be changed between calls to ContactCenterEval.eval(). This should never return a null pointer; if no evaluation options are supported for some reasons, this should return an array with length 0.

Returns:
the array of supported evaluation options.

getEvalOption

public Object getEvalOption(EvalOptionType option)
Description copied from interface: ContactCenterEval
Returns the current value of the evaluation option option. The class of the returned object must be assignable to the class given by EvalOptionType.getType(). If the option is not supported, this should throw a NoSuchElementException. This exception can be thrown if and only if ContactCenterEval.hasEvalOption(umontreal.iro.lecuyer.contactcenters.app.EvalOptionType) returns false for the given option.

Parameters:
option - the queried evaluation option.
Returns:
the current value of the option.

setEvalOption

public void setEvalOption(EvalOptionType option,
                          Object val)
Description copied from interface: ContactCenterEval
Sets the evaluation option option to value. If the given option is not supported, this throws a NoSuchElementException. If the class of the given value is incompatible, this throws a ClassCastException. If the evaluation option cannot be changed, this throws an UnsupportedOperationException.

Parameters:
option - the option to be set.
val - the new value of the option.

getAgentGroupName

public String getAgentGroupName(int i)
Description copied from interface: ContactCenterInfo
Returns the name associated with the agent group identifier i. If no name is associated with a given agent group, this returns null.

Specified by:
getAgentGroupName in interface ContactCenterInfo
Overrides:
getAgentGroupName in class AbstractContactCenterInfo
Parameters:
i - the identifier of the agent group.
Returns:
the agent group name, or null.

getContactTypeName

public String getContactTypeName(int k)
Description copied from interface: ContactCenterInfo
Returns the name associated with the contact type k, where k is a number greater than or equal to 0 and smaller than ContactCenterInfo.getNumContactTypes(). The first ContactCenterInfo.getNumInContactTypes() indices are inbound contact types whereas the remaining indices are outbound contact types. If no contact type name is available, this returns null.

Specified by:
getContactTypeName in interface ContactCenterInfo
Overrides:
getContactTypeName in class AbstractContactCenterInfo
Parameters:
k - the contact type identifier.
Returns:
the contact type name or null if no name is defined.

getWaitingQueueName

public String getWaitingQueueName(int q)
Description copied from interface: ContactCenterInfo
Returns the name of the waiting queue with index q used by the evaluation. If the waiting queue has no name, returns null.

Specified by:
getWaitingQueueName in interface ContactCenterInfo
Overrides:
getWaitingQueueName in class AbstractContactCenterInfo
Parameters:
q - the index of the waiting queue.
Returns:
the name of the waiting queue.

getNumAgentGroups

public int getNumAgentGroups()
Description copied from interface: ContactCenterInfo
Returns the total number of agent groups supported by this contact center.

Returns:
the total number of agent groups.

getNumContactTypes

public int getNumContactTypes()
Description copied from interface: ContactCenterInfo
Returns the total number of contact types supported by this contact center. This should be the same as ContactCenterInfo.getNumInContactTypes() + ContactCenterInfo.getNumOutContactTypes().

Returns:
the total number of contact types.

getNumInContactTypes

public int getNumInContactTypes()
Description copied from interface: ContactCenterInfo
Returns the total number of inbound contact types for this contact center.

Returns:
the total number of inbound contact types.

getNumMainPeriods

public int getNumMainPeriods()
Description copied from interface: ContactCenterInfo
Returns the number of main periods used for evaluation, as defined in PeriodChangeEvent. For a steady-state evaluation on a single period, this always returns 1, even if the model defines several period.

Returns:
the total number of main periods.

getNumOutContactTypes

public int getNumOutContactTypes()
Description copied from interface: ContactCenterInfo
Returns the total number of outbound contact types for this contact center.

Returns:
the total number of outbound contact types.

getNumWaitingQueues

public int getNumWaitingQueues()
Description copied from interface: ContactCenterInfo
Returns the total number of waiting queues capable of storing contacts.

Returns:
the number of waiting queues.

seemsUnstable

public boolean seemsUnstable()
Description copied from interface: ContactCenterEval
Determines if the system seems to be unstable. When a system is unstable, the returned steady-state performance measures are not reliable. This method mainly applies for stationary simulators which return true when the system appears to be unstable, i.e., some waiting queues grow up with simulation time. The method must throw an IllegalStateException if it is called before ContactCenterEval.eval() and always return false if no stability check applies.

Returns:
the result of the stability check.

reset

public void reset()
Description copied from interface: ContactCenterEval
Resets this contact center evaluation system for new parameters. Every cached or processed parameter should be reread from the parameter objects. In the case of the simulation, one should try to preserve random number seeds whenever possible, even if the contact center needs to be reconstructed. Some implementatios of this interface provide specialized reset methods allowing to change the associated parameter objects.


getCompletedSteps

public int getCompletedSteps()
Description copied from interface: ContactCenterSim
Returns the number of completed steps for the simulation. When using independent replications, a step corresponds to a replication. When using batch means for stationary simulation, this corresponds to the number of terminated batches.

Returns:
the number of completed steps.

newSeeds

public void newSeeds()
Description copied from interface: ContactCenterSim
Changes the seeds of the random number generators used during the simulation. When calling ContactCenterSim.eval() multiple times to perform a simulation, the results should be identical for the same values of parameters. If one requires the simulation to be performed with new random seeds, the random streams need to be reset. This can be done by calling RandomStream.resetNextSubstream() method on each RandomStream object associated with the simulator, or by creating new random streams.


formatStatistics

public String formatStatistics()
Description copied from interface: ContactCenterEval
Formats information about every performance measure after ContactCenterEval.eval() is called. It can be simulation statistics, information about the steps of an approximation algorithm, or simply the values of all performance measures. This method should call ContactCenterEval.getEvalInfo() to obtain general information about the evaluation and incorporate the information into the returned string. For each entry in the map, the method should add a key: value line in the string. Then, the method appends the performance measures to the returned string. The PerformanceMeasureFormatText class can be used to convert matrices of performance measures into strings. If the evaluation was not triggered by calling ContactCenterEval.eval() before this method is called, an IllegalStateException is thrown. If no statistical information is available even after the evaluation, this method should return an empty string instead of throwing an exception.

Specified by:
formatStatistics in interface ContactCenterEval
Overrides:
formatStatistics in class AbstractContactCenterSim
Returns:
a string containing a statistical report.

getNumMatricesOfAWT

public int getNumMatricesOfAWT()
Description copied from interface: ContactCenterInfo
Returns the number of matrices containing acceptable waiting times, for estimating service levels. Usually, this returns 1.

Returns:
the number of matrices of acceptable waiting times.

main

public static void main(String[] args)
                 throws IOException,
                        ParserConfigurationException,
                        SAXException
Main method allowing to run this class from the command-line with CallCenterSim as the internal simulator. The needed command-line arguments are the name of an XML file containing the simulation parameters (root element mskccparams), and the name of a second XML file containing the simulation parameters (root elements batchsimparams).

Parameters:
args - the command-line arguments.
Throws:
IOException
ParserConfigurationException
SAXException

ContactCenters
V. 0.9.9.

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