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.model
Class RandomTypeCallFactory

    java.lang.Object
      umontreal.iro.lecuyer.contactcenters.msk.model.RandomTypeCallFactory

All Implemented Interfaces:
  ContactFactory

    public class RandomTypeCallFactory

extends Object
implements ContactFactory

This class is similar to `RandomTypeContactFactory`, but it allows the probability of generating each contact type to change from periods to periods, and possibly depends on the presence of agents in groups. More specifically, the factory contains a K×P 2D array giving a weight pk, p to each call type k and main period p. Each time a call is requested, the current main period is determined, and a weight is assigned to each call type. If the selection takes account of the presence of agents, weights corresponding to call types for which no agent is available are reset to 0. The weights are then summed up, and normalized to give probabilities which are used to select a call type.

Constructor Summary
`RandomTypeCallFactory(CallCenter cc, double[][] probMainPeriod, RandomStream stream, boolean checkAgents)` Constructs a new random-type call factory using period-change event associated with `cc` to obtain the current main period, and random stream `stream` to generate random numbers.

Method Summary
`double[][]` | `getProbPeriod()` Returns a copy of the K×P 2D array giving the values of pk, p.
`double` | `getProbPeriod(int k, int p)` Returns the value of pk, p.
`RandomStream` | `getStream()` Returns the random stream used by this factory.
`Contact` | `newInstance()` Constructs and returns a new `Contact` object.
`int` | `nextIndex()` Generates and returns a new type identifier.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### RandomTypeCallFactory

    public RandomTypeCallFactory(CallCenter cc,
                                 double[][] probMainPeriod,
                                 RandomStream stream,
                                 boolean checkAgents)

  Constructs a new random-type call factory using period-change event associated with `cc` to obtain the current main period, and random stream `stream` to generate random numbers. The probabilities of selection pk, p are initialized using the given `probMainPeriod` K×P 2D array as follows. For each factory `k`, pk, p = 0 for p = 1,…, P if `probMainPeriod[k]` is `null` or has length 0. The probability pk, p = q for p = 1,…, P if `probMainPeriod[k]` has a single element q. Otherwise, pk, p is given by `probMainPeriod[k][p]`.

  Parameters:
    `cc` - the call center object.
    `probMainPeriod` - the main period and call factory specific probabilities.
    `stream` - the random stream used to generate random numbers.
    `checkAgents` - determines if the call factory checks that there are agents capable of serving the call before producing a call of a given type.
  Throws:
    `NullPointerException` - if any argument is `null`.
    `IllegalArgumentException` - if the lengths of `factories` and `probMainPeriod` are different.

Method Detail

### nextIndex

    public int nextIndex()

  Generates and returns a new type identifier.

### newInstance

    public Contact newInstance()

  Description copied from interface: `ContactFactory`
  Constructs and returns a new `Contact` object. If a contact cannot be instantiated, a `ContactInstantiationException` is thrown.

  Specified by:
    `newInstance` in interface `ContactFactory`
  Returns:
    the new contact object.

### getProbPeriod

    public double[][] getProbPeriod()

  Returns a copy of the K×P 2D array giving the values of pk, p.

### getProbPeriod

    public double getProbPeriod(int k,
                                int p)

  Returns the value of pk, p.

### getStream

    public RandomStream getStream()

  Returns the random stream used by this factory.

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.