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.contact
Class PoissonUniformArrivalProcess

    java.lang.Object
      umontreal.iro.lecuyer.contactcenters.contact.ContactArrivalProcess
          umontreal.iro.lecuyer.contactcenters.contact.PoissonUniformArrivalProcess

All Implemented Interfaces:
  ContactSource, Initializable, Named, ToggleElement

Direct Known Subclasses:
  DirichletArrivalProcess, FixedCountsArrivalProcess, NORTADrivenArrivalProcess

    public class PoissonUniformArrivalProcess

extends ContactArrivalProcess

This arrival process can be used when the number of arrivals per period Ap is known (when B = 1). By default, for each period p, Ap* = round(BAp) uniforms are generated and sorted in increasing order to get the inter-arrival times, supposing we have a Poisson process with stationary increments. Because this algorithm requires the duration of each period, arrivals are not allowed during the wrap-up period, which has a random duration not known at the time arrivals are generated. The algorithm for generating arrival times can be customized by overriding `computeArrivalTimes()`. The number of arrivals, constant by default, can also be changed between replications.

Field Summary
`protected DoubleArrayList` | `times` Array list containing the arrival times of contacts.

Fields inherited from class umontreal.iro.lecuyer.contactcenters.contact.ContactArrivalProcess
`contactEvent`

Constructor Summary
`PoissonUniformArrivalProcess(PeriodChangeEvent pce, ContactFactory factory, int[] arrivals, RandomStream stream)` Constructs a new arrival process with known number of arrivals in each period.

Method Summary
`protected void` | `computeArrivalTimes()` This is called by `init()` to compute the arrival times based on the number of arrivals in each period.
`double` | `getArrivalRate(double st, double et)` Computes the arrival rate using the period-change event returned by `getPeriodChangeEvent()` to determine the boundaries of periods, and the arrival rates returned by `getArrivalRate(int)`.
`double` | `getArrivalRate(int p)` Determines the arrival rate in period `p` for this arrival process.
`int[]` | `getArrivals()` Returns the number of arrivals for each period.
`double` | `getExpectedArrivalRate(double st, double et)` Computes the expected arrival rate using the period-change event returned by `getPeriodChangeEvent()` to determine the boundaries of periods, and the expected arrival rates returned by `getExpectedArrivalRate(int)`.
`double` | `getExpectedArrivalRate(int p)` Determines the expected arrival rate in period `p` for this arrival process assuming that the expected value of the busyness factor is 1.
`PeriodChangeEvent` | `getPeriodChangeEvent()` Returns the period-change event associated with this object.
`RandomStream` | `getStream()` Returns the random number stream used to generate uniforms.
`void` | `init()` Initializes the new arrival process.
`double` | `nextTime()` Computes and returns the time before the next contact arrival is simulated by this object.
`void` | `setArrivals(int[] arrivals)` Sets the number of arrivals in each period to `arrivals`.
`void` | `setStream(RandomStream stream)` Sets the random number stream to `stream` for generating uniforms.
`String` | `toString()`

Methods inherited from class umontreal.iro.lecuyer.contactcenters.contact.ContactArrivalProcess
`addNewContactListener, clearNewContactListeners, getArrivalRates, getBusynessFactor, getContactFactory, getExpectedArrivalRateB, getExpectedArrivalRateB, getExpectedArrivalRates, getExpectedArrivalRatesB, getExpectedBusynessFactor, getName, getNewContactListeners, getNextArrivalTime, init, isStarted, notifyNewContact, removeNewContactListener, setBusynessFactor, setContactFactory, setExpectedBusynessFactor, setName, setSimulator, simulator, start, start, startStationary, stop`

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

Field Detail

### times

    protected DoubleArrayList times

  Array list containing the arrival times of contacts.

Constructor Detail

### PoissonUniformArrivalProcess

    public PoissonUniformArrivalProcess(PeriodChangeEvent pce,
                                        ContactFactory factory,
                                        int[] arrivals,
                                        RandomStream stream)

  Constructs a new arrival process with known number of arrivals in each period. The constructed process uses period-change event `pce`, contact factory `factory`, mean number of arrivals `arrivals[p]` in period `p`, and random number stream `stream` to generate random values.

  Parameters:
    `pce` - the period-change event defining the periods.
    `factory` - the contact factory used to create contacts.
    `arrivals` - the mean number of arrivals in each period.
    `stream` - the random number stream for the uniforms.
  Throws:
    `IllegalArgumentException` - if there is not a mean number of arrivals for each period.
    `NullPointerException` - if any argument is `null`.

Method Detail

### getStream

    public RandomStream getStream()

  Returns the random number stream used to generate uniforms.

  Returns:
    the associated random number stream.

### setStream

    public void setStream(RandomStream stream)

  Sets the random number stream to `stream` for generating uniforms.

  Parameters:
    `stream` - the new random number stream.
  Throws:
    `NullPointerException` - if `stream` is `null`.

### getPeriodChangeEvent

    public PeriodChangeEvent getPeriodChangeEvent()

  Returns the period-change event associated with this object.

  Returns:
    the associated period-change event.

### getArrivalRate

    public double getArrivalRate(int p)

  Description copied from class: `ContactArrivalProcess`
  Determines the arrival rate in period `p` for this arrival process. The arrival rate corresponds to the expected number of arrivals per simulation time unit during the specified period; one must multiply the rate by the period duration to get the expected number of arrivals during the period.

  If arrival rate is random, this returns the arrival rate for the current replication. One should use `ContactArrivalProcess.getExpectedArrivalRate(int)` or `ContactArrivalProcess.getExpectedArrivalRateB(int)` to get the expected arrival rate.

  If the arrival rate is not available, throws an `UnsupportedOperationException`.

  Overrides:
    `getArrivalRate` in class `ContactArrivalProcess`
  Parameters:
    `p` - the queried period index.
  Returns:
    the arrival rate in that period.

### getArrivalRate

    public double getArrivalRate(double st,
                                 double et)

  Computes the arrival rate using the period-change event returned by `getPeriodChangeEvent()` to determine the boundaries of periods, and the arrival rates returned by `getArrivalRate(int)`.

  Overrides:
    `getArrivalRate` in class `ContactArrivalProcess`
  Parameters:
    `st` - the starting time s.
    `et` - the ending time e.
  Returns:
    the arrival rate in the given time interval.

### getExpectedArrivalRate

    public double getExpectedArrivalRate(int p)

  Description copied from class: `ContactArrivalProcess`
  Determines the expected arrival rate in period `p` for this arrival process assuming that the expected value of the busyness factor is 1. The arrival rate corresponds to the expected number of arrivals per simulation time unit during the specified period; one must multiply the rate by the period duration to get the expected number of arrivals during the period. If arrival rates are deterministic, this returns the same value as `ContactArrivalProcess.getArrivalRate(int)`.

  If [B]≠1, one should use `ContactArrivalProcess.getExpectedArrivalRateB(int)` which takes the expectation of the busyness factor into account.

  If the expected arrival rate is not available, throws an `UnsupportedOperationException`. This is the default behavior of this method if not overridden by a subclass.

  Overrides:
    `getExpectedArrivalRate` in class `ContactArrivalProcess`
  Parameters:
    `p` - the queried period index.
  Returns:
    the expected arrival rate in that period.

### getExpectedArrivalRate

    public double getExpectedArrivalRate(double st,
                                         double et)

  Computes the expected arrival rate using the period-change event returned by `getPeriodChangeEvent()` to determine the boundaries of periods, and the expected arrival rates returned by `getExpectedArrivalRate(int)`.

  Overrides:
    `getExpectedArrivalRate` in class `ContactArrivalProcess`
  Parameters:
    `st` - the starting time s.
    `et` - the ending time e.
  Returns:
    the expected arrival rate in the given time interval.

### getArrivals

    public int[] getArrivals()

  Returns the number of arrivals for each period.

  Returns:
    the array of number of arrivals.

### setArrivals

    public void setArrivals(int[] arrivals)

  Sets the number of arrivals in each period to `arrivals`.

  Parameters:
    `arrivals` - the number of arrivals.
  Throws:
    `NullPointerException` - if the array is `null`.
    `IllegalArgumentException` - if the length of the given array does not correspond to the number of periods as defined by `getPeriodChangeEvent()`.

### init

    public void init()

  Description copied from class: `ContactArrivalProcess`
  Initializes the new arrival process. If this method is overridden by a subclass, it is important to call `super.init()` in order to ensure that everything is initialized correctly.

  Specified by:
    `init` in interface `ContactSource`
  Specified by:
    `init` in interface `Initializable`
  Overrides:
    `init` in class `ContactArrivalProcess`

### computeArrivalTimes

    protected void computeArrivalTimes()

  This is called by `init()` to compute the arrival times based on the number of arrivals in each period. The arrival times must be stored in the array list `times`, which is empty at the time the method is called. The arrival times in the list are assumed to be sorted in increasing order after the method returns. The method should use the random stream returned by `getStream()` to generate the random numbers.

  By default, for each period p = 0,…, P (preliminary and main periods), this generates Ap* uniforms in [tp-1, tp), where t-1 = 0, Ap is the expected number of arrivals in period p, and tp is the ending time of period p. The generated arrival times are then sorted. If B = 1, Ap* = Ap, otherwise Ap* = round(ApB).

### nextTime

    public double nextTime()

  Description copied from class: `ContactArrivalProcess`
  Computes and returns the time before the next contact arrival is simulated by this object. If this method returns `Double.POSITIVE_INFINITY`, no more arrival events will be scheduled until the arrival process is reinitialized.

  Specified by:
    `nextTime` in class `ContactArrivalProcess`
  Returns:
    the time before the next arrival.

### toString

    public String toString()

  Overrides:
    `toString` in class `ContactArrivalProcess`

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.