ContactCenters
V. 0.9.9.

umontreal.iro.lecuyer.contactcenters.router
Class LongestWeightedWaitingTimeRouter

java.lang.Object
  extended by umontreal.iro.lecuyer.contactcenters.router.Router
      extended by umontreal.iro.lecuyer.contactcenters.router.QueuePriorityRouter
          extended by umontreal.iro.lecuyer.contactcenters.router.LongestWeightedWaitingTimeRouter
All Implemented Interfaces:
NewContactListener

public class LongestWeightedWaitingTimeRouter
extends QueuePriorityRouter

This extends the queue priority router to select contacts with the longest weighted waiting time. The router assumes that every attached waiting queue uses a FIFO discipline. When a contact arrives into the router, the same scheme for agent group selection as with the queue priority router is used. However, when an agent becomes free, instead of using the group-to-type map to determine the order in which the queues are queried, all queues authorized by the group-to-type map are considered, and the contact with the longest weighted waiting time is removed. More specifically, let wq be a user-defined weight associated with waiting queue q, and let Wq be the waiting time of the first contact waiting in queue q (if queue q is empty, let Wq = - ∞). The router then selects the first contact in the queue with the maximal wqWq value. If more than one queue authorized by the freed agent has a first contact with the same weighted waiting time, which rarely happens in practice, the contact is removed from the first queue in the ordered list obtained from the group-to-type map.


Field Summary
 
Fields inherited from class umontreal.iro.lecuyer.contactcenters.router.QueuePriorityRouter
groupToTypeMap, typeToGroupMap
 
Fields inherited from class umontreal.iro.lecuyer.contactcenters.router.Router
BLOCKTYPE_CANTQUEUE, BLOCKTYPE_NOLINE, BLOCKTYPE_QUEUEFULL, DEQUEUETYPE_BEGINSERVICE, DEQUEUETYPE_FANTOM, DEQUEUETYPE_NOAGENT, DEQUEUETYPE_TRANSFER, dqTypeRet
 
Constructor Summary
LongestWeightedWaitingTimeRouter(int[][] typeToGroupMap, int[][] groupToTypeMap, double[] queueWeights)
          Constructs a new longest weighted waiting time router with a type-to-group map typeToGroupMap, a group-to-type map groupToTypeMap, and an array of weights queueWeights.
 
Method Summary
 String getDescription()
           
 double[] getQueueWeights()
          Returns the weights associated with each waiting queue.
protected  DequeueEvent selectContact(AgentGroup group, Agent agent)
          Returns a dequeue event representing a queued contact to be served by the agent agent in agent group group.
 void setQueueWeights(double[] queueWeights)
          Sets the weights of waiting queues to queueWeights.
 String toLongString()
          Returns a string representation of detailed information about the router.
 
Methods inherited from class umontreal.iro.lecuyer.contactcenters.router.QueuePriorityRouter
canServe, checkFreeAgents, checkWaitingQueues, formatGroupToTypeMap, formatTypeToGroupMap, getGroupToTypeMap, getGroupToTypeMap, getTypeToGroupMap, getTypeToGroupMap, getWaitingQueueType, selectAgent, selectWaitingQueue, setRoutingTable
 
Methods inherited from class umontreal.iro.lecuyer.contactcenters.router.Router
addExitedContactListener, agentReroutingEventsIterator, beginService, clearExitedContactListeners, contactReroutingEventsIterator, dequeued, endContact, endService, enqueued, exitBlocked, exitDequeued, exitServed, formatAgentGroups, formatWaitingQueues, getAgentGroup, getAgentGroupListener, getAgentGroups, getAgentReroutingEvents, getContactFactory, getContactReroutingEvents, getCurrentQueueSize, getDialers, getExitedContactListeners, getNeededWaitingQueueComparator, getNeededWaitingQueueStructure, getNumAgentGroups, getNumContactTypes, getNumWaitingQueues, getReroutingDelay, getReroutingDelay, getTotalQueueCapacity, getWaitingQueue, getWaitingQueueListener, getWaitingQueues, init, isKeepingReroutingEvents, mustClearWaitingQueue, needsDetailedAgentGroup, newContact, notifyBlocked, notifyDequeued, notifyServed, removeExitedContactListener, restore, save, selectAgent, selectContact, selectWaitingQueue, setAgentGroup, setClearWaitingQueue, setClearWaitingQueues, setContactFactory, setKeepingReroutingEvents, setTotalQueueCapacity, setWaitingQueue, startDialers, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LongestWeightedWaitingTimeRouter

public LongestWeightedWaitingTimeRouter(int[][] typeToGroupMap,
                                        int[][] groupToTypeMap,
                                        double[] queueWeights)
Constructs a new longest weighted waiting time router with a type-to-group map typeToGroupMap, a group-to-type map groupToTypeMap, and an array of weights queueWeights. Each element of the last array corresponds to a weight assigned to a waiting queue.

Parameters:
typeToGroupMap - the type-to-group map.
groupToTypeMap - the group-to-type map.
queueWeights - the array of weights wq for waiting queues.
Method Detail

getQueueWeights

public double[] getQueueWeights()
Returns the weights associated with each waiting queue. Element q of the returned array contains the weight wq for the waiting queue q.

Returns:
the array of weights.

setQueueWeights

public void setQueueWeights(double[] queueWeights)
Sets the weights of waiting queues to queueWeights.

Parameters:
queueWeights - the new array of weights.

selectContact

protected DequeueEvent selectContact(AgentGroup group,
                                     Agent agent)
Description copied from class: Router
Returns a dequeue event representing a queued contact to be served by the agent agent in agent group group. If agent is null, the method must return a contact that can be served by any agent in the group. If no contact is available, this method returns null. The selected contacts come from waiting queues attached to the router. Before the selected contact is returned, it must be removed from its queue with dequeue type Router.DEQUEUETYPE_BEGINSERVICE, e.g., by using queue.removeFirst (DEQUEUETYPE_BEGINSERVICE), or queue.remove (ev, DEQUEUETYPE_BEGINSERVICE), etc.

Generally, it is sufficient to override this method instead of Router.checkFreeAgents(AgentGroup,Agent). One can override Router.checkFreeAgents(AgentGroup,Agent) to improve efficiency when looking for contacts in the same waiting queue. This method is not abstract and returns null by default in order to allow Router.checkFreeAgents(AgentGroup,Agent) to be overridden without implementing this method.

Overrides:
selectContact in class QueuePriorityRouter
Parameters:
group - the affected agent group.
agent - the agent having ended its service.
Returns:
the dequeue event representing the contact being selected.

getDescription

public String getDescription()
Overrides:
getDescription in class QueuePriorityRouter

toLongString

public String toLongString()
Description copied from class: Router
Returns a string representation of detailed information about the router. This returns a string representation of each associated waiting queue and agent group and routing policies. For a short, one-line description, Router.toString() should be used.

Overrides:
toLongString in class QueuePriorityRouter
Returns:
a string representation of detailed information about the router.

ContactCenters
V. 0.9.9.

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