|
ContactCenters V. 0.9.9. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectumontreal.iro.lecuyer.contactcenters.router.Router
umontreal.iro.lecuyer.contactcenters.router.AgentsPrefRouter
public class AgentsPrefRouter
Performs agent and contact selection based on user-defined priorities. By default, this router selects the agent with the longest idle time when several agents share the same priority, and the longest waiting time to perform a selection among contacts sharing the same priority. The agents' preference-based router is a generalization of the router taken from [20], using matrices of ranks to take its decisions. The router applies static routing when the ranks are different and uses a dynamic policy when they are equal. This permits the user to partially define the priorities instead of assigning all of them as with the queue priority routing. For example, the user can set the router for the first waiting queue to have precedence over the others while the other queues share the same priority.
Additionally, the router uses matrices of weights to adjust the priority for
candidates with the same rank. These matrices define functions
(k, i)
and
(i, k) which are similar to the ranks functions, except they can
take any real number. These matrices are optional and default to matrices of
1's if they are not specified.
Note that for a fixed contact type k, if
(k, i) is different for all
i such that
(k, i) < ∞, the scheme for agent selection is
equivalent to a pure overflow router: each agent group is tested in a fixed
order for a free agent. In that setting, the weights
(k,⋅) have no
effect. On the other hand, if all finite values of
(k, i) for a fixed
k are equal, the routing is completely based on the
longest-weighted-idle-time selection policy. Any intermediate combination of
these two extremes can be achieved by adjusting the ranks appropriately.
Note that for a fixed agent group i, if
(i, k) is different for all
k such that
(i, k) < ∞, this policy is equivalent to the queue
priority router's contact selection: the waiting queues are queried in a
fixed order for contacts. In that particular setting, the weights
(i,⋅) have no effect. On the other hand, if, for a fixed i, all finite
(i, k) are equal for all k, the router uses the longest weighted
waiting time policy for agent group i. As with agent selection, any
combination of these two extremes can be achieved by adjusting the ranks.
Field Summary | |
---|---|
protected Agent |
bestAgent
Best agent selected by selectAgent(Contact,double,boolean[],int) , or
null if the best agent group does not take account of individual
agents. |
protected AgentGroup |
bestGroup
Best agent group selected by selectAgent(Contact,double,boolean[],int) . |
protected WaitingQueue |
bestQueue
Contains the best waiting queue selected by selectWaitingQueue(AgentGroup,Agent,double,boolean[],int) . |
protected DequeueEvent |
bestQueuedContact
Contains the best queued contact selected by selectWaitingQueue(AgentGroup,Agent,double,boolean[],int) , or
null if the first contact in the best queue is taken. |
protected double[][] |
ranksGT
|
protected double[][] |
ranksTG
|
protected double[][] |
weightsGT
|
protected double[][] |
weightsTG
|
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 | |
---|---|
AgentsPrefRouter(double[][] ranksGT)
Constructs a new agents' preference-based router with matrix of ranks ranksGT defining how agents prefer contacts. |
|
AgentsPrefRouter(double[][] ranksTG,
double[][] ranksGT)
Constructs a new agents' preference-based router with matrix of ranks ranksTG defining how contacts prefer agents, and ranksGT defining how agents prefer contacts. |
|
AgentsPrefRouter(double[][] ranksTG,
double[][] ranksGT,
double[][] weightsTG,
double[][] weightsGT)
Constructs a new agents' preference-based router with matrix of ranks ranksTG defining how contacts prefer agents, and ranksGT defining how agents prefer contacts. |
|
AgentsPrefRouter(int numTypes,
int[][] groupToTypeMap)
Constructs a new agents' preference-based router with a group-to-type map groupToTypeMap and numTypes contact types. |
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 void |
checkWaitingQueues(AgentGroup group)
This method is called when the agent group group contains no more online agents, i.e., AgentGroup.getNumAgents() returns 0. |
AgentSelectionScore |
getAgentSelectionScore()
Returns the current mode of computation for the agent selection score. |
ContactSelectionScore |
getContactSelectionScore()
Returns the current mode of computation for the contact selection score. |
String |
getDescription()
|
int[][] |
getGroupToTypeMap()
Computes a group-to-type map from the contact selection matrix of ranks by calling RoutingTableUtils.getGroupToTypeMap(double[][]) , and
returns the result. |
protected double |
getRankForAgentSelection(int k,
int i)
Determines the rank to be used for agent selection for contact type k, and agent in group i. |
protected double |
getRankForContactSelection(int i,
int k)
Determines the rank to be used for contact selection for contact type k, when an agent in group i becomes free. |
double |
getRankGT(int i,
int k)
Returns the rank of contact type k = k for agent group i = i, used for contact selection. |
double[][] |
getRanksGT()
Returns the matrix of ranks defining how agents prefer contacts, used for contact selection. |
double[][] |
getRanksTG()
Returns the matrix of ranks defining how contacts prefer agents, used for agent selection. |
double |
getRankTG(int k,
int i)
Returns the rank of contact type k = k for agent group i = i, used for agent selection. |
protected double |
getScoreForAgentSelection(Contact ct,
AgentGroup testGroup,
Agent testAgent)
Returns the score for contact ct associated with agent group testGroup and agent testAgent. |
protected double |
getScoreForContactSelection(AgentGroup group,
DequeueEvent ev)
Returns the score for the association between the agent group group and the queued contact represented by ev. |
RandomStream |
getStreamAgentSelection()
Returns the random stream used for agent selection. |
RandomStream |
getStreamContactSelection()
Returns the random stream used for contact selection. |
int[][] |
getTypeToGroupMap()
Computes a type-to-group map from the agent selection matrix of ranks by calling RoutingTableUtils.getTypeToGroupMap(double[][]) on the
transpose of the matrix of ranks, and returns the result. |
WaitingQueueType |
getWaitingQueueType()
Returns an indicator describing how the implemented routing policies organizes waiting queues. |
double |
getWeightGT(int i,
int k)
Returns the weight of contact type k = k for agent group i = i, used for contact selection. |
double[][] |
getWeightsGT()
Returns the matrix of weights defining ![]() |
double[][] |
getWeightsTG()
Returns the matrix of weights defining ![]() |
double |
getWeightTG(int k,
int i)
Returns the weight of contact type k = k for agent group i = i, used for agent selection. |
boolean |
needsDetailedAgentGroup(int i)
Determines if the agent group i should consider individual agents. |
protected EndServiceEvent |
selectAgent(Contact ct)
Begins the service of the contact contact by trying to assign it a free agent. |
protected void |
selectAgent(Contact ct,
double bestRank,
boolean[] candidates1,
int numCandidates)
This method is called by selectAgent(Contact) to perform the
selection of an agent among
the numCandidates agent groups sharing the same minimal finite
rank and containing at least one 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 void |
selectWaitingQueue(AgentGroup group,
Agent agent,
double bestRank,
boolean[] qCandidates1,
int numCandidates)
Selects the queued contact for an agent agent in group group, with waiting queue candidates qCandidates. |
protected DequeueEvent |
selectWaitingQueue(Contact ct)
Selects a waiting queue and puts the contact contact into it. |
void |
setAgentSelectionScore(AgentSelectionScore agentSelectionScore)
Sets the way scores for agent selection are computed to agentSelectionScore. |
void |
setContactSelectionScore(ContactSelectionScore contactSelectionScore)
Sets the way scores for contact selection are computed to contactSelectionScore. |
void |
setRanksGT(double[][] ranksGT)
Sets the matrix of ranks defining how agents prefer contacts to ranksGT. |
void |
setRanksTG(double[][] ranksTG)
Sets the matrix of ranks defining how contacts prefer agents to ranksTG. |
void |
setStreamAgentSelection(RandomStream streamAgentSelection)
Sets the random stream for agent selection to streamAgentSelection. |
void |
setStreamContactSelection(RandomStream streamContactSelection)
Sets the random stream for contact selection to streamContactSelection. |
void |
setWeightsGT(double[][] weightsGT)
Sets the matrix of weights defining ![]() |
void |
setWeightsTG(double[][] weightsTG)
Sets the matrix of weights defining ![]() |
String |
toLongString()
Returns a string representation of detailed information about the router. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected double[][] ranksTG
protected double[][] ranksGT
protected double[][] weightsTG
protected double[][] weightsGT
protected AgentGroup bestGroup
selectAgent(Contact,double,boolean[],int)
.
protected Agent bestAgent
selectAgent(Contact,double,boolean[],int)
, or
null if the best agent group does not take account of individual
agents.
protected WaitingQueue bestQueue
selectWaitingQueue(AgentGroup,Agent,double,boolean[],int)
.
protected DequeueEvent bestQueuedContact
selectWaitingQueue(AgentGroup,Agent,double,boolean[],int)
, or
null if the first contact in the best queue is taken.
Constructor Detail |
---|
public AgentsPrefRouter(int numTypes, int[][] groupToTypeMap)
numTypes
- the number of contact types.groupToTypeMap
- the group-to-type map.public AgentsPrefRouter(double[][] ranksGT)
ranksGT
- the contact selection matrix of ranks being used.
NullPointerException
- if ranksGT is null.
IllegalArgumentException
- if the ranks 2D array is not rectangular.public AgentsPrefRouter(double[][] ranksTG, double[][] ranksGT)
ranksTG
- the matrix of ranks defining how contacts prefer agents.ranksGT
- the matrix of ranks defining how agents prefer contacts.
NullPointerException
- if ranksGT or ranksTG are null.
IllegalArgumentException
- if the ranks 2D arrays are not rectangular.public AgentsPrefRouter(double[][] ranksTG, double[][] ranksGT, double[][] weightsTG, double[][] weightsGT)
ranksTG
- the matrix of ranks defining how contacts prefer agents.ranksGT
- the matrix of ranks defining how agents prefer contacts.weightsTG
- the matrix of weights defining
weightsGT
- the matrix of weights defining
NullPointerException
- if ranksGT, ranksTG, weightsTG,
or weightsGT are null.
IllegalArgumentException
- if the 2D arrays are not rectangular.Method Detail |
---|
public double[][] getRanksTG()
public void setRanksTG(double[][] ranksTG)
ranksTG
- the new agent selection matrix of ranks.
NullPointerException
- if ranksTG is null.
IllegalArgumentException
- if ranksTG is not rectangular or has wrong
dimensions.public double[][] getRanksGT()
public void setRanksGT(double[][] ranksGT)
ranksGT
- the new contact selection matrix of ranks.
NullPointerException
- if ranksGT is null.
IllegalArgumentException
- if ranksGT is not rectangular or has wrong
dimensions.public double[][] getWeightsTG()
public void setWeightsTG(double[][] weightsTG)
weightsTG
- the new matrix of weights defining
NullPointerException
- if weightsTG is null.
IllegalArgumentException
- if weightsTG is not rectangular or has wrong
dimensions.public double[][] getWeightsGT()
public void setWeightsGT(double[][] weightsGT)
weightsGT
- the new matrix of weights defining
NullPointerException
- if weightsGT is null.
IllegalArgumentException
- if weightsGT is not rectangular or has wrong
dimensions.public double getRankTG(int k, int i)
k
- the contact type identifier.i
- the agent group identifier.
ArrayIndexOutOfBoundsException
- if i or k are negative, i is
greater than or equal to Router.getNumAgentGroups()
, or
k is greater than or equal to
Router.getNumContactTypes()
.public double getRankGT(int i, int k)
i
- the agent group identifier.k
- the contact type identifier.
ArrayIndexOutOfBoundsException
- if i or k are negative, i is
greater than or equal to Router.getNumAgentGroups()
, or
k is greater than or equal to
Router.getNumContactTypes()
.public double getWeightTG(int k, int i)
k
- the contact type identifier.i
- the agent group identifier.
ArrayIndexOutOfBoundsException
- if i or k are negative, i is
greater than or equal to Router.getNumAgentGroups()
, or
k is greater than or equal to
Router.getNumContactTypes()
.public double getWeightGT(int i, int k)
i
- the agent group identifier.k
- the contact type identifier.
ArrayIndexOutOfBoundsException
- if i or k are negative, i is
greater than or equal to Router.getNumAgentGroups()
, or
k is greater than or equal to
Router.getNumContactTypes()
.public int[][] getTypeToGroupMap()
RoutingTableUtils.getTypeToGroupMap(double[][])
on the
transpose of the matrix of ranks, and returns the result.
public int[][] getGroupToTypeMap()
RoutingTableUtils.getGroupToTypeMap(double[][])
, and
returns the result.
public RandomStream getStreamAgentSelection()
public void setStreamAgentSelection(RandomStream streamAgentSelection)
streamAgentSelection
- the new random stream for agent selection.public RandomStream getStreamContactSelection()
public void setStreamContactSelection(RandomStream streamContactSelection)
streamContactSelection
- the new random stream for contact selection.public AgentSelectionScore getAgentSelectionScore()
AgentSelectionScore.LONGESTIDLETIME
.
public void setAgentSelectionScore(AgentSelectionScore agentSelectionScore)
agentSelectionScore
- the way scores for agent selection are computed.
NullPointerException
- if agentSelectionScore is null.public ContactSelectionScore getContactSelectionScore()
ContactSelectionScore.LONGESTWAITINGTIME
.
public void setContactSelectionScore(ContactSelectionScore contactSelectionScore)
contactSelectionScore
- the way scores for contact selection are computed.
NullPointerException
- if contactSelectionScore is null.public boolean canServe(int i, int k)
Router
canServe
in class Router
i
- the agent group index.k
- the contact type index.
public boolean needsDetailedAgentGroup(int i)
Router
Router.getAgentGroup(int)
is implemented. This method only gives clues to a
simulator on how to construct the concerned
agent group.
needsDetailedAgentGroup
in class Router
i
- the index of the agent group.
public WaitingQueueType getWaitingQueueType()
Router
WaitingQueueType.GENERAL
must be used.
By default, this method returns WaitingQueueType.GENERAL
.
getWaitingQueueType
in class Router
protected double getRankForAgentSelection(int k, int i)
k
- the contact type index.i
- the agent group index.
protected EndServiceEvent selectAgent(Contact ct)
Router
selectAgent
in class Router
ct
- the contact being routed to an agent.
protected void selectAgent(Contact ct, double bestRank, boolean[] candidates1, int numCandidates)
selectAgent(Contact)
to perform the
selection of an agent among
the numCandidates agent groups sharing the same minimal finite
rank and containing at least one free agent. The method must select an
agent group i among the agent groups for which
candidates[i] is true and store the reference to this
group in the protected field bestGroup
. The field
bestAgent
can be used to hold the selected agent if the agent
group takes account of individual agents. If no candidate is satisfactory,
the method must set bestGroup
and bestAgent
to
null before returning; the incoming contact will be queued or
blocked as appropriate.
The default implementation computes a score for each candidate using
getScoreForAgentSelection(Contact,AgentGroup,Agent)
and takes the
candidate with the best score. This method can be overridden to implement
a different selection scheme, e.g., randomly selecting a free agent.
ct
- the contact being processed.bestRank
- the best rank found when looking for a candidate agent.candidates1
- the agent group that could serve the contact.numCandidates
- the number of true values in candidates.protected double getScoreForAgentSelection(Contact ct, AgentGroup testGroup, Agent testAgent)
selectAgent(Contact,double,boolean[],int)
method calls this method with testAgent = null if
testGroup is not an instance of DetailedAgentGroup
,
otherwise the method is called with testAgent = testGroup.getLongestIdleAgent()
.
By default, this returns a score depending on the return value of
getAgentSelectionScore()
. This can return the longest weighted
idle time (the default), the weighted number of free agents, or the weight
only. See AgentSelectionScore
for more information.
ct
- the contact being assigned an agent.testGroup
- the tested agent group.testAgent
- the tested agent, can be null.
protected DequeueEvent selectWaitingQueue(Contact ct)
Router
selectWaitingQueue
in class Router
ct
- the contact being queued.
protected double getRankForContactSelection(int i, int k)
i
- the agent group index.k
- the contact type index.
protected DequeueEvent selectContact(AgentGroup group, Agent agent)
Router
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.
selectContact
in class Router
group
- the affected agent group.agent
- the agent having ended its service.
protected void selectWaitingQueue(AgentGroup group, Agent agent, double bestRank, boolean[] qCandidates1, int numCandidates)
bestQueue
and possibly the contact to be removed in the
bestQueuedContact
. If bestQueuedContact
is
null, the first contact in the best queue will be used. If no
waiting queue can be selected, bestQueue
must be set to
null.
The default implementation selects the waiting queue with the greatest
score as computed by
getScoreForContactSelection(AgentGroup,DequeueEvent)
, and the
best queued contact is always null. This method can be overridden
to use an alternate selection scheme, e.g., randomly selecting a queued
contact.
group
- the agent group containing the free agent.agent
- the free agent.bestRank
- the best rank found when searching for candidates.qCandidates1
- the waiting queue candidates contacts can be pulled from.protected double getScoreForContactSelection(AgentGroup group, DequeueEvent ev)
By default, this returns a score depending on the return value of
getContactSelectionScore()
. This can return the weighted waiting
time (the default), the weighted number of queued agents, or the weight
only. See ContactSelectionScore
for more information.
group
- the agent group to which pulled contacts would be assigned.ev
- the dequeue event.
protected void checkWaitingQueues(AgentGroup group)
Router
AgentGroup.getNumAgents()
returns 0. It must
check each waiting queue accessible for agents in this group to determine
if they need to be cleared. A queue is cleared if no agent, whether free
or busy, is available to serve any contact in it.
checkWaitingQueues
in class Router
group
- the agent group with no more agents.public String getDescription()
getDescription
in class Router
public String toLongString()
Router
Router.toString()
should be used.
toLongString
in class Router
|
ContactCenters V. 0.9.9. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |