Overview | Package | Class | Tree | Deprecated | Index | Help
| ContactCenters V. 0.9.9.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## umontreal.iro.lecuyer.contactcenters.msk.simlogic
Class RepLogic

    java.lang.Object
      umontreal.iro.lecuyer.simexp.SimExp
          umontreal.iro.lecuyer.simexp.RepSim
              umontreal.iro.lecuyer.contactcenters.msk.simlogic.RepLogic

All Implemented Interfaces:
  SimLogic, AWTPeriod, StatPeriod

    public class RepLogic

extends RepSim
implements SimLogic

Implements the logic for a simulation with independent replications. For each replication, this logic initializes the model to an empty state, and simulates the entire horizon, i.e., a single day, week, month, etc., depending on the model's parameters. Statistics are collected in every period.

Field Summary

Fields inherited from class umontreal.iro.lecuyer.simexp.SimExp
`sim, simulating`

Constructor Summary
`RepLogic(CallCenter cc, RepSimParams simParams, PerformanceMeasureType... pms)` Constructs a new simulation logic for independent replications, using the model `cc`, the simulation parameters `simParams`, and estimating performance measures of all types listed in `pms`.

Method Summary
`void` | `addReplicationObs(int r)`
`void` | `addSimLogicListener(SimLogicListener l)` Registers the listener `l` to be notified about the progress of the simulator.
`void` | `clearSimLogicListeners()` Removes all the listeners registered with this simulator.
`void` | `formatReport(Map<String,Object> evalInfo)` Adds the information specific to this simulation logic into the evaluation information map of the simulator.
`int` | `getAwtPeriod(Contact contact)` Computes the statistical period p of the contact by calling `getStatPeriod(Contact)`, and converts p to a main period using `PeriodChangeEvent.getMainPeriod(int)`.
`CallCenter` | `getCallCenter()` Returns the model associated with this simulation logic.
`CallCenterMeasureManager` | `getCallCenterMeasureManager()` Returns an object containing the counters updated throughout the simulation.
`CallCenterStatProbes` | `getCallCenterStatProbes()` Returns the call center statistical probes used by this simulation logic.
`int` | `getCompletedSteps()` Returns the number of completed simulation steps.
`int` | `getCurrentMainPeriod()` Returns the current period used by this simulator.
`int` | `getGlobalAwtPeriod()` This returns P' - 1.
`MeasureType[]` | `getMeasures()`
`int` | `getNumPeriodsForCounters()` This method returns P + 2, the number of periods.
`int` | `getNumPeriodsForCountersAwt()` This method returns P', the number of segments regrouping main periods.
`int[][]` | `getScheduledAgents()` Returns the 2D array of scheduled agents for each shift and each agent group.
`List<SimLogicListener>` | `getSimLogicListeners()` Returns the listeners registered with this simulator.
`RepSimParams` | `getSimParams()` Returns the parameters associated with this simulation logic.
`int[]` | `getStaffing()` Returns the staffing vector used by this simulator.
`int[][]` | `getStaffingMatrix()` Gets the staffing matrix for the simulated model.
`int` | `getStatPeriod()` Returns the index of the current period.
`int` | `getStatPeriod(Contact contact)` By default, this returns the period of arrival of the given contact.
`int` | `getStatPeriodAwt(Contact contact)` Returns the result of `getAwtPeriod(Contact)`.
`boolean` | `hasMeasureMatricesFor(PerformanceMeasureType pm)`
`boolean` | `hasMeasureMatrix(MeasureType mt)`
`void` | `init()` Initializes the simulation logic for a new experiment.
`void` | `initMeasureMatrices()`
`void` | `initReplication(int r)`
`void` | `initReplicationProbes()`
`boolean` | `isAborted()` Determines if the simulation has been aborted by using the `SimLogic.setAborted(boolean)` method.
`boolean` | `isContactTypeAgentGroup()`
`boolean` | `isSteadyState()` Determines if this simulator performs a steady-state simulation.
`boolean` | `isVerbose()` Determines if the simulation logic is in verbose mode.
`boolean` | `needsSlidingWindows()` Determines if sliding windows are needed by statistical counters using an object implementing this interface to get the statistical periods of calls.
`boolean` | `needsStatForPeriodSegmentsAwt()` Determines if statistics for segments regrouping main periods are collected for measure types using acceptable waiting times.
`void` | `performReplication(int r)`
`void` | `registerListeners()` Registers any listener required by the simulator from the model.
`void` | `removeSimLogicListener(SimLogicListener l)` Removes the listener `l` from the list of listeners registered with this simulator.
`void` | `reset(PerformanceMeasureType... pms)` Resets the simulation logic for a new experiment after the model has been reset.
`boolean` | `seemsUnstable()` Returns `true` if, after the simulation, the system seems unstable.
`void` | `setAborted(boolean aborted)` Aborts the current simulation.
`void` | `setCurrentMainPeriod(int mp)` Sets the current period for this simulator to `p`.
`void` | `setScheduledAgents(int[][] ag)` Sets the number of scheduled agents for each group and shift using the given 2D array.
`void` | `setStaffing(int[] numAgents)` Sets the staffing vector used by this simulator to `staffing`.
`void` | `setStaffingMatrix(int[][] numAgents)` Sets the 2D array representing the staffing matrix to `staffing`.
`void` | `setVerbose(boolean verbose)` Sets the verbose indicator to `verbose`.
`void` | `simulate(int numSteps)` Simulates `numSteps` steps, and updates observations in statistical collectors as well as the number of completed steps returned by `SimLogic.getCompletedSteps()`.
`void` | `unregisterListeners()` Disconnects every listener registered by the simulator from the model.

Methods inherited from class umontreal.iro.lecuyer.simexp.RepSim
`adjustTargetReplications, getCompletedReplications, getMaxReplications, getMinReplications, getRequiredNewReplications, getTargetReplications, 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

### RepLogic

    public RepLogic(CallCenter cc,
                    RepSimParams simParams,
                    PerformanceMeasureType... pms)

  Constructs a new simulation logic for independent replications, using the model `cc`, the simulation parameters `simParams`, and estimating performance measures of all types listed in `pms`.

  Parameters:
    `cc` - the simulated model.
    `simParams` - the simulation parameters.
    `pms` - the estimated performance measures.

Method Detail

### registerListeners

    public void registerListeners()

  Description copied from interface: `SimLogic`
  Registers any listener required by the simulator from the model.

  Specified by:
    `registerListeners` in interface `SimLogic`

### unregisterListeners

    public void unregisterListeners()

  Description copied from interface: `SimLogic`
  Disconnects every listener registered by the simulator from the model.

  Specified by:
    `unregisterListeners` in interface `SimLogic`

### getCallCenterStatProbes

    public CallCenterStatProbes getCallCenterStatProbes()

  Description copied from interface: `SimLogic`
  Returns the call center statistical probes used by this simulation logic.

  Specified by:
    `getCallCenterStatProbes` in interface `SimLogic`
  Returns:
    the call center statistical probes.

### performReplication

    public void performReplication(int r)

  Overrides:
    `performReplication` in class `RepSim`

### initReplication

    public void initReplication(int r)

  Specified by:
    `initReplication` in class `RepSim`

### addReplicationObs

    public void addReplicationObs(int r)

  Specified by:
    `addReplicationObs` in class `RepSim`

### getCallCenter

    public CallCenter getCallCenter()

  Description copied from interface: `SimLogic`
  Returns the model associated with this simulation logic.

  Specified by:
    `getCallCenter` in interface `SimLogic`
  Returns:
    the associated model.

### getSimParams

    public RepSimParams getSimParams()

  Description copied from interface: `SimLogic`
  Returns the parameters associated with this simulation logic.

  Specified by:
    `getSimParams` in interface `SimLogic`
  Returns:
    the associated parameters.

### reset

    public void reset(PerformanceMeasureType... pms)

  Description copied from interface: `SimLogic`
  Resets the simulation logic for a new experiment after the model has been reset. This method should update or recreate the associated counters and statistical probes, since the size of the model may have changed.

  Specified by:
    `reset` in interface `SimLogic`

### getNumPeriodsForCounters

    public int getNumPeriodsForCounters()

  This method returns P + 2, the number of periods.

  Specified by:
    `getNumPeriodsForCounters` in interface `StatPeriod`
  Returns:
    the number of periods for matrices of counters.

### getNumPeriodsForCountersAwt

    public int getNumPeriodsForCountersAwt()

  This method returns P', the number of segments regrouping main periods.

  Specified by:
    `getNumPeriodsForCountersAwt` in interface `StatPeriod`
  Returns:
    the number of periods for matrices of counters.

### needsSlidingWindows

    public boolean needsSlidingWindows()

  Description copied from interface: `StatPeriod`
  Determines if sliding windows are needed by statistical counters using an object implementing this interface to get the statistical periods of calls. Usually, the period index returned by `StatPeriod.getStatPeriod(Contact)` is never greater than the integer returned by `StatPeriod.getNumPeriodsForCounters()`, and the same relationship holds for `StatPeriod.getStatPeriodAwt(Contact)` and `StatPeriod.getNumPeriodsForCountersAwt()`. However, this assumption can be violated if one needs to get real-time statistics concerning the last observed periods. In such cases, matrices of counters need to be implemented using sliding windows: when the index a statistical period becomes higher than the number of stored periods, the first periods are discarded. This method determines if such sliding windows are needed.

  Specified by:
    `needsSlidingWindows` in interface `StatPeriod`

### needsStatForPeriodSegmentsAwt

    public boolean needsStatForPeriodSegmentsAwt()

  Description copied from interface: `StatPeriod`
  Determines if statistics for segments regrouping main periods are collected for measure types using acceptable waiting times. Usually, statistics are collected for each main period, and sums are computed at a later time if needed. However, statistics based on acceptable waiting times cannot be summed, because the AWT may change from periods to periods in general. This method thus indicates if observers must collect observations for groups of main periods in addition to the statistical periods of calls.

  Specified by:
    `needsStatForPeriodSegmentsAwt` in interface `StatPeriod`

### getCompletedSteps

    public int getCompletedSteps()

  Description copied from interface: `SimLogic`
  Returns the number of completed simulation steps.

  Specified by:
    `getCompletedSteps` in interface `SimLogic`
  Returns:
    the number of completed steps.

### getCallCenterMeasureManager

    public CallCenterMeasureManager getCallCenterMeasureManager()

  Description copied from interface: `SimLogic`
  Returns an object containing the counters updated throughout the simulation.

  Specified by:
    `getCallCenterMeasureManager` in interface `SimLogic`
  Returns:
    the call center measures.

### isContactTypeAgentGroup

    public boolean isContactTypeAgentGroup()

### initMeasureMatrices

    public void initMeasureMatrices()

### getMeasures

    public MeasureType[] getMeasures()

### hasMeasureMatrix

    public boolean hasMeasureMatrix(MeasureType mt)

### hasMeasureMatricesFor

    public boolean hasMeasureMatricesFor(PerformanceMeasureType pm)

### getStatPeriod

    public int getStatPeriod(Contact contact)

  By default, this returns the period of arrival of the given contact. However, this can be changed using the `PerPeriodCollectingMode` attribute in the `repSimParams` parameter file.

  Specified by:
    `getStatPeriod` in interface `StatPeriod`

### getStatPeriodAwt

    public int getStatPeriodAwt(Contact contact)

  Returns the result of `getAwtPeriod(Contact)`.

  Specified by:
    `getStatPeriodAwt` in interface `StatPeriod`

### getStatPeriod

    public int getStatPeriod()

  Returns the index of the current period.

  Specified by:
    `getStatPeriod` in interface `StatPeriod`

### getAwtPeriod

    public int getAwtPeriod(Contact contact)

  Computes the statistical period p of the contact by calling `getStatPeriod(Contact)`, and converts p to a main period using `PeriodChangeEvent.getMainPeriod(int)`.

  Specified by:
    `getAwtPeriod` in interface `AWTPeriod`
  Parameters:
    `contact` - the contact being queried.
  Returns:
    the main period index for the acceptable waiting time.

### getGlobalAwtPeriod

    public int getGlobalAwtPeriod()

  This returns P' - 1.

  Specified by:
    `getGlobalAwtPeriod` in interface `AWTPeriod`
  Returns:
    the main period index for the acceptable waiting time.

### isSteadyState

    public boolean isSteadyState()

  Description copied from interface: `SimLogic`
  Determines if this simulator performs a steady-state simulation.

  Specified by:
    `isSteadyState` in interface `SimLogic`
  Returns:
    `true` if this is a steady-state simulator, `false` otherwise.

### initReplicationProbes

    public void initReplicationProbes()

  Specified by:
    `initReplicationProbes` in class `RepSim`

### init

    public void init()

  Description copied from interface: `SimLogic`
  Initializes the simulation logic for a new experiment. In particular, this resets the event list of the simulator, the state of the model, and the current number of completed steps to 0.

  Specified by:
    `init` in interface `SimLogic`
  Overrides:
    `init` in class `RepSim`

### simulate

    public void simulate(int numSteps)

  Description copied from interface: `SimLogic`
  Simulates `numSteps` steps, and updates observations in statistical collectors as well as the number of completed steps returned by `SimLogic.getCompletedSteps()`. Usually, this method simulates the required number of replications, and adds one observation to each statistical collector of the matrices returned by `SimLogic.getCallCenterStatProbes()`.

  Note that this method may be called several times during a simulation experiment using sequential sampling. For this reason, one should take account of every observation collected since the last call to `SimLogic.init()`.

  Specified by:
    `simulate` in interface `SimLogic`

### formatReport

    public void formatReport(Map<String,Object> evalInfo)

  Description copied from interface: `SimLogic`
  Adds the information specific to this simulation logic into the evaluation information map of the simulator. The keys and values of this map are listed at the beginning of the simulation report.

  Specified by:
    `formatReport` in interface `SimLogic`

### getStaffing

    public int[] getStaffing()

  Description copied from interface: `SimLogic`
  Returns the staffing vector used by this simulator. This vector has the same format as the `EvalOptionType.STAFFINGVECTOR` evaluation option.

  Specified by:
    `getStaffing` in interface `SimLogic`
  Returns:
    the staffing vector.

### setStaffing

    public void setStaffing(int[] numAgents)

  Description copied from interface: `SimLogic`
  Sets the staffing vector used by this simulator to `staffing`. This vector has the same format as the `EvalOptionType.STAFFINGVECTOR` evaluation option.

  Specified by:
    `setStaffing` in interface `SimLogic`
  Parameters:
    `numAgents` - the new staffing vector.

### getStaffingMatrix

    public int[][] getStaffingMatrix()

  Description copied from interface: `SimLogic`
  Gets the staffing matrix for the simulated model. The returned 2D array has the format specified by `EvalOptionType.STAFFINGMATRIX`.

  Specified by:
    `getStaffingMatrix` in interface `SimLogic`
  Returns:
    the 2D array representing the staffing matrix.

### setStaffingMatrix

    public void setStaffingMatrix(int[][] numAgents)

  Description copied from interface: `SimLogic`
  Sets the 2D array representing the staffing matrix to `staffing`.

  Specified by:
    `setStaffingMatrix` in interface `SimLogic`
  Parameters:
    `numAgents` - the new staffing matrix.

### getScheduledAgents

    public int[][] getScheduledAgents()

  Description copied from interface: `SimLogic`
  Returns the 2D array of scheduled agents for each shift and each agent group. Element (i, j) of the returned array contains the number of agents scheduled in group i during shift j.

  Specified by:
    `getScheduledAgents` in interface `SimLogic`
  Returns:
    the scheduled agents.

### setScheduledAgents

    public void setScheduledAgents(int[][] ag)

  Description copied from interface: `SimLogic`
  Sets the number of scheduled agents for each group and shift using the given 2D array.

  Specified by:
    `setScheduledAgents` in interface `SimLogic`
  Parameters:
    `ag` - the array of scheduled agents.

### getCurrentMainPeriod

    public int getCurrentMainPeriod()

  Description copied from interface: `SimLogic`
  Returns the current period used by this simulator. If this simulator is not steady-state, this throws an `UnsupportedOperationException`.

  Specified by:
    `getCurrentMainPeriod` in interface `SimLogic`
  Returns:
    the current period.

### setCurrentMainPeriod

    public void setCurrentMainPeriod(int mp)

  Description copied from interface: `SimLogic`
  Sets the current period for this simulator to `p`. If this simulator is not steady-state, this throws an `UnsupportedOperationException`.

  Specified by:
    `setCurrentMainPeriod` in interface `SimLogic`
  Parameters:
    `mp` - the new current period.

### seemsUnstable

    public boolean seemsUnstable()

  Description copied from interface: `SimLogic`
  Returns `true` if, after the simulation, the system seems unstable. This is applicable for steady state simulations only.

  Specified by:
    `seemsUnstable` in interface `SimLogic`
  Returns:
    the result of the stability check.

### isVerbose

    public boolean isVerbose()

  Description copied from interface: `SimLogic`
  Determines if the simulation logic is in verbose mode.

  Specified by:
    `isVerbose` in interface `SimLogic`
  Returns:
    the status of the verbose mode.

### setVerbose

    public void setVerbose(boolean verbose)

  Description copied from interface: `SimLogic`
  Sets the verbose indicator to `verbose`.

  Specified by:
    `setVerbose` in interface `SimLogic`
  Parameters:
    `verbose` - the value of the indicator.

### isAborted

    public boolean isAborted()

  Description copied from interface: `SimLogic`
  Determines if the simulation has been aborted by using the `SimLogic.setAborted(boolean)` method.

  Specified by:
    `isAborted` in interface `SimLogic`
  Returns:
    `true` if the simulation was aborted, `false` otherwise.

### setAborted

    public void setAborted(boolean aborted)

  Description copied from interface: `SimLogic`
  Aborts the current simulation.

  Specified by:
    `setAborted` in interface `SimLogic`

### addSimLogicListener

    public void addSimLogicListener(SimLogicListener l)

  Description copied from interface: `SimLogic`
  Registers the listener `l` to be notified about the progress of the simulator.

  Specified by:
    `addSimLogicListener` in interface `SimLogic`
  Parameters:
    `l` - the listener to be notified.

### clearSimLogicListeners

    public void clearSimLogicListeners()

  Description copied from interface: `SimLogic`
  Removes all the listeners registered with this simulator.

  Specified by:
    `clearSimLogicListeners` in interface `SimLogic`

### getSimLogicListeners

    public List<SimLogicListener> getSimLogicListeners()

  Description copied from interface: `SimLogic`
  Returns the listeners registered with this simulator.

  Specified by:
    `getSimLogicListeners` in interface `SimLogic`
  Returns:
    the list of registered listeners.

### removeSimLogicListener

    public void removeSimLogicListener(SimLogicListener l)

  Description copied from interface: `SimLogic`
  Removes the listener `l` from the list of listeners registered with this simulator.

  Specified by:
    `removeSimLogicListener` in interface `SimLogic`
  Parameters:
    `l` - the listener being removed.

Overview | Package | Class | Tree | Deprecated | Index | Help
| ContactCenters V. 0.9.9.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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