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.router
Class QueuePriorityRouter

    java.lang.Object
      umontreal.iro.lecuyer.contactcenters.router.Router
          umontreal.iro.lecuyer.contactcenters.router.QueuePriorityRouter

All Implemented Interfaces:
  NewContactListener

Direct Known Subclasses:
  LongestQueueFirstRouter, LongestWeightedWaitingTimeRouter, SingleFIFOQueueRouter

    public class QueuePriorityRouter

extends Router

This skill-based router with queue priority ranking is based on the routing heuristic in [14], extended to support queueing. When a contact arrives to the router, an ordered list (the type-to-group map) is used to determine which agent groups are able to serve it, and the order in which they are checked. If agent group ik, 0 contains at least one free agent, this agent serves the contact. Otherwise, the router tries to test agent groups ik, 1, ik, 2, etc. until a free agent is found, or the list of agent groups is exhausted. In other words, the contact overflows from one agent group to another. If no agent group in the ordered list associated with the contact's type is able to serve the contact, the contact is inserted into a waiting queue corresponding to its type unless the queue is full. If the total queueing capacity of the router is exceeded, the contact is blocked.

When an agent becomes free, it uses another ordered list (the group-to-type map) to determine which types of contacts it can serve. If the queue containing contacts of type ki, 0 is non-empty, the first contact, i.e., the contact of type ki, 0 with the longest waiting time, is removed and handled to the free agent. Otherwise, the queues containing contacts of types ki, 1, ki, 2, etc. are queried similarly for contacts to be served. If no contact is available in any accessible waiting queue, the agent stays free. The router behaves as if a priority queue was associated with each agent group, implementing priorities by using several FIFO waiting queues.

This router should be used only when the type-to-group and group-to-type maps are specified as input data. If one table has to be generated from the other one, the induced arbitrary order of the lists can affect the performance of the contact center.

Field Summary
`protected int[][]` | `groupToTypeMap` Contains the group-to-type map routing table.
`protected int[][]` | `typeToGroupMap` Contains the type-to-group map routing table.

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
`QueuePriorityRouter(int[][] typeToGroupMap, int[][] groupToTypeMap)` Constructs a new queue priority router with a type-to-group map `typeToGroupMap`, and a group-to-type map `groupToTypeMap`.

Method Summary
`boolean` | `canServe(int i, int k)` Returns `true` if and only if some agents in group `i` are authorized to serve contacts of type `k` by this router.
`protected boolean` | `checkFreeAgents(AgentGroup group, Agent agent)` This method is called when the agent `agent` in agent group `group` becomes free.
`protected void` | `checkWaitingQueues(AgentGroup group)` This default implementation is suitable only for routers specifying a type-to-group and a group-to-type map and using one waiting queue for each contact type.
`String` | `formatGroupToTypeMap()` Calls `RoutingTableUtils.formatGroupToTypeMap(int[][])` with the group-to-type map associated with this router.
`String` | `formatTypeToGroupMap()` Calls `RoutingTableUtils.formatTypeToGroupMap(int[][])` with the type-to-group map associated with this router.
`String` | `getDescription()`
`int[][]` | `getGroupToTypeMap()` Returns the group-to-type map associated with this router.
`int[]` | `getGroupToTypeMap(int i)` Returns the ordered list concerning agent group `i` in the group-to-type map.
`int[][]` | `getTypeToGroupMap()` Returns the type-to-group map associated with this router.
`int[]` | `getTypeToGroupMap(int k)` Returns the ordered list concerning contact type `k` in the type-to-group map.
`WaitingQueueType` | `getWaitingQueueType()` Returns an indicator describing how the implemented routing policies organizes waiting queues.
`protected EndServiceEvent` | `selectAgent(Contact ct)` Begins the service of the contact `contact` by trying to assign it a free agent.
`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`.
`protected DequeueEvent` | `selectWaitingQueue(Contact ct)` Selects a waiting queue and puts the contact `contact` into it.
`void` | `setRoutingTable(int[][] typeToGroupMap, int[][] groupToTypeMap)` Changes the routing table for this router.
`String` | `toLongString()` Returns a string representation of detailed information about the router.

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`

Field Detail

### typeToGroupMap

    protected int[][] typeToGroupMap

  Contains the type-to-group map routing table.

### groupToTypeMap

    protected int[][] groupToTypeMap

  Contains the group-to-type map routing table.

Constructor Detail

### QueuePriorityRouter

    public QueuePriorityRouter(int[][] typeToGroupMap,
                               int[][] groupToTypeMap)

  Constructs a new queue priority router with a type-to-group map `typeToGroupMap`, and a group-to-type map `groupToTypeMap`.

  Parameters:
    `typeToGroupMap` - the type-to-group map.
    `groupToTypeMap` - the group-to-type map.

Method Detail

### getTypeToGroupMap

    public int[][] getTypeToGroupMap()

  Returns the type-to-group map associated with this router.

  Returns:
    the associated type-to-group map.

### getTypeToGroupMap

    public int[] getTypeToGroupMap(int k)

  Returns the ordered list concerning contact type `k` in the type-to-group map.

  Parameters:
    `k` - the index of the contact type.
  Returns:
    the ordered list.

### getGroupToTypeMap

    public int[][] getGroupToTypeMap()

  Returns the group-to-type map associated with this router.

  Returns:
    the associated group-to-type map.

### getGroupToTypeMap

    public int[] getGroupToTypeMap(int i)

  Returns the ordered list concerning agent group `i` in the group-to-type map.

  Parameters:
    `i` - the index of the agent group.
  Returns:
    the ordered list.

### setRoutingTable

    public void setRoutingTable(int[][] typeToGroupMap,
                                int[][] groupToTypeMap)

  Changes the routing table for this router. The routing table must be specified using `typeToGroupMap` and `groupToTypeMap`.

  Parameters:
    `typeToGroupMap` - the type-to-group map.
    `groupToTypeMap` - the group-to-type map.
  Throws:
    `IllegalArgumentException` - if the type-to-group map does not contain K rows, or the group-to-type map does not contain I rows.

### getWaitingQueueType

    public WaitingQueueType getWaitingQueueType()

  Description copied from class: `Router`
  Returns an indicator describing how the implemented routing policies organizes waiting queues. The supported modes of organization cover the most common cases only: waiting queues corresponding to contact types or agent groups. For any other modes, the `WaitingQueueType.GENERAL` must be used.

  By default, this method returns `WaitingQueueType.GENERAL`.

  Overrides:
    `getWaitingQueueType` in class `Router`
  Returns:
    the organization mode of waiting queues.

### canServe

    public boolean canServe(int i,
                            int k)

  Description copied from class: `Router`
  Returns `true` if and only if some agents in group `i` are authorized to serve contacts of type `k` by this router.

  Specified by:
    `canServe` in class `Router`
  Parameters:
    `i` - the agent group index.
    `k` - the contact type index.
  Returns:
    determines if contacts can be served.

### selectAgent

    protected EndServiceEvent selectAgent(Contact ct)

  Description copied from class: `Router`
  Begins the service of the contact `contact` by trying to assign it a free agent. The method must select an agent group with a free agent (or a specific free agent), start the service, and return the end-service event if the service was started, or `null` otherwise.

  Specified by:
    `selectAgent` in class `Router`
  Parameters:
    `ct` - the contact being routed to an agent.
  Returns:
    the end-service event representing the started service, or `null` if the contact could not be served immediately.

### selectWaitingQueue

    protected DequeueEvent selectWaitingQueue(Contact ct)

  Description copied from class: `Router`
  Selects a waiting queue and puts the contact `contact` into it. Returns the dequeue event if the contact could be queued, or `null` otherwise.

  Specified by:
    `selectWaitingQueue` in class `Router`
  Parameters:
    `ct` - the contact being queued.
  Returns:
    the dequeue event representing the queued contact, or `null` if the contact could not be queued.

### 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 `Router`
  Parameters:
    `group` - the affected agent group.
    `agent` - the agent having ended its service.
  Returns:
    the dequeue event representing the contact being selected.

### checkFreeAgents

    protected boolean checkFreeAgents(AgentGroup group,
                                      Agent agent)

  Description copied from class: `Router`
  This method is called when the agent `agent` in agent group `group` becomes free. If the given agent is `null`, the method assumes that one or more arbitrary agents in the group became free. The method must select a contact to be transferred to the free agent. The selected contacts come from waiting queues, and must be removed from the queues with dequeue type `Router.DEQUEUETYPE_BEGINSERVICE` before they are transferred to agents. The method returns `true` if and only if at least one free agent could be made busy.

  The default implementation calls `Router.selectContact(AgentGroup,Agent)` to get a new dequeue event representing the removed contact, extracts the contact, and routes it to an agent, until `group` has no more free agent.

  Overrides:
    `checkFreeAgents` in class `Router`
  Parameters:
    `group` - the affected agent group.
    `agent` - the agent having ended its service.
  Returns:
    `true` if some free agents became busy, `false` otherwise.

### checkWaitingQueues

    protected void checkWaitingQueues(AgentGroup group)

  This default implementation is suitable only for routers specifying a type-to-group and a group-to-type map and using one waiting queue for each contact type. If the tables are not specified or the number of supported waiting queues is different from the number of supported contact types, this implementation does nothing.

  Specified by:
    `checkWaitingQueues` in class `Router`
  Parameters:
    `group` - the agent group with no more agents.

### formatTypeToGroupMap

    public String formatTypeToGroupMap()

  Calls `RoutingTableUtils.formatTypeToGroupMap(int[][])` with the type-to-group map associated with this router.

  Returns:
    the type-to-group map, formatted as a string.

### formatGroupToTypeMap

    public String formatGroupToTypeMap()

  Calls `RoutingTableUtils.formatGroupToTypeMap(int[][])` with the group-to-type map associated with this router.

  Returns:
    the group-to-type map, formatted as a string.

### getDescription

    public String getDescription()

  Overrides:
    `getDescription` in class `Router`

### 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 `Router`
  Returns:
    a string representation of detailed information about the router.

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.