ContactCenters
V. 0.9.9.

umontreal.iro.lecuyer.contactcenters.ctmc
Class EventWithTest

java.lang.Object
  extended by umontreal.iro.lecuyer.contactcenters.ctmc.EventWithTest
All Implemented Interfaces:
CCEvent
Direct Known Subclasses:
EventWithSelection

public abstract class EventWithTest
extends Object
implements CCEvent

Abstract event type with some helper methods to generate u1u < u2 randomly and uniformly, and to test that u < t for any value of t.


Constructor Summary
EventWithTest(double minU, double maxU, int numBits)
          Constructs a new event with the associated interval [u1, u2), and using numBits additional random bits to generate u when needed.
 
Method Summary
 double getMaxU()
          Returns the value of u2 associated with this event.
 double getMinU()
          Returns the value of u1 associated with this event.
 int getPosition(int rv, int usedBits, double weight, double maxWeight, int maxS)
          Returns the value s for which 0≤u - sW < w, where s = 0,…, S - 1, or S if such s does not exist.
 double getU(int rv, int usedBits)
          Generates the value of u using bits in rv but ignoring the first least significant usedBits bits.
 boolean isUSmallerThan(int rv, int usedBits, double t)
          Returns true if and only if u < t, using getU (rv, usedBits) to generate u randomly.
 
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.ctmc.CCEvent
actions
 

Constructor Detail

EventWithTest

public EventWithTest(double minU,
                     double maxU,
                     int numBits)
Constructs a new event with the associated interval [u1, u2), and using numBits additional random bits to generate u when needed. The value of u1 and u2 are given using the fields minU and maxU.

Parameters:
minU - the value of u1.
maxU - the value of u2.
numBits - the number of bits used to generate u.
Method Detail

getMinU

public double getMinU()
Returns the value of u1 associated with this event.

Returns:
the associated value of u1.

getMaxU

public double getMaxU()
Returns the value of u2 associated with this event.

Returns:
the associated value of u2.

getU

public double getU(int rv,
                   int usedBits)
Generates the value of u using bits in rv but ignoring the first least significant usedBits bits.

Parameters:
rv - the random bits to generate u from.
usedBits - the number of used random bits.
Returns:
the value of u.

isUSmallerThan

public boolean isUSmallerThan(int rv,
                              int usedBits,
                              double t)
Returns true if and only if u < t, using getU (rv, usedBits) to generate u randomly. This method returns true without generating u if u2 < t since in that case, u < u2 < t. Similarly, it returns false without generating u if u1t since in this case, uu1t. Otherwise, getU(int,int) is called to get the value of u.

Parameters:
rv - the random bits to generate u from.
usedBits - the number of used random bits.
t - the tested threshold.
Returns:
the success indicator of the test.

getPosition

public int getPosition(int rv,
                       int usedBits,
                       double weight,
                       double maxWeight,
                       int maxS)
Returns the value s for which 0≤u - sW < w, where s = 0,…, S - 1, or S if such s does not exist. Here, wW. For example, if 0≤u < $ \tilde{q}$, w = ν, and W = $ \tilde{\nu}$, s can be interpreted as the position in queue of a contact having abandoned.

Parameters:
rv - the random bits to generate u from.
usedBits - the number of used random bits.
weight - the value of w.
maxWeight - the value of W.
maxS - the maximal value S of s.
Returns:
the value of s.

ContactCenters
V. 0.9.9.

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