|
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.RoutingTableUtils
public final class RoutingTableUtils
Provides some utility methods to manage routing tables represented using 2D arrays. Three types of routing tables are supported: type-to-group and group-to-type maps, incidence matrices and matrices of ranks. This class provides facilities to check the consistency of such routing tables, to generate one table from the other, and to format them as strings. However, converting from one routing table to another may destroy some information or force the conversion algorithm to infer information, which can lead to bad routing policies.
Method Summary | |
---|---|
static void |
checkConsistency(int[][] typeToGroupMap,
int[][] groupToTypeMap)
Checks the consistency of the routing tables typeToGroupMap and groupToTypeMap. |
static void |
checkGroupToTypeMap(int numTypes,
int[][] groupToTypeMap)
Applies a consistency check for the group-to-type map groupToTypeMap supporting K = numTypes contact types. |
static void |
checkTypeToGroupMap(int numGroups,
int[][] typeToGroupMap)
Applies a consistency check for the type-to-group map typeToGroupMap supporting I = numGroups agent groups. |
static String |
formatGroupToTypeMap(int[][] groupToTypeMap)
Formats the group-to-type ordered lists as a string. |
static String |
formatIncidence(boolean[][] m)
Formats the incidence matrix m for each contact type and agent group. |
static String |
formatOrderedList(int[] orderedList)
Formats the ordered list orderedList as a string. |
static String |
formatRanksGT(double[][] ranksGT)
Formats the contact selection matrix of ranks ranksGT for each contact type and agent group. |
static String |
formatRanksTG(double[][] ranksTG)
Formats the agent selection matrix of ranks ranksTG for each contact type and agent group. |
static String |
formatTypeToGroupMap(int[][] typeToGroupMap)
Formats the type-to-group ordered lists as a string. |
static String |
formatWeightsGT(double[][] weightsGT)
Formats the contact selection weights matrix weightsGT for each contact type and agent group. |
static String |
formatWeightsTG(double[][] weightsTG)
Formats the agent selection weights matrix weightsTG for each contact type and agent group. |
static int[][] |
getGroupToTypeMap(boolean[][] m)
Constructs and returns a new group-to-type map from the incidence matrix m. |
static int[][] |
getGroupToTypeMap(double[][] ranksGT)
Generates a group-to-type map from the contact selection matrix of ranks ranksGT. |
static int[][] |
getGroupToTypeMap(double[][] ranksGT,
int[] typeRegions,
int[] groupRegions)
This method is similar to getGroupToTypeMap(double[][])
with a sorting algorithm adapted for the local-specialist
policy. |
static int[][] |
getGroupToTypeMap(int numGroups,
int[][] typeToGroupMap)
Generates the group-to-type map from the type-to-group map typeToGroupMap. |
static boolean[][] |
getIncidenceFromGT(int numTypes,
int[][] groupToTypeMap)
Constructs and returns the incidence matrix from the groupToTypeMap with numTypes contact types. |
static boolean[][] |
getIncidenceFromTG(int numGroups,
int[][] typeToGroupMap)
Constructs and returns the incidence matrix from the typeToGroupMap with numGroups agent groups. |
static int[][][] |
getOverflowLists(double[][] ranksTG)
Constructs and returns overflow lists from the given matrix of ranks ranksTG. |
static double[][] |
getRanks(boolean[][] m,
int[] skillCounts)
Constructs a contact selection matrix of ranks from the incidence matrix m and skill counts skillCounts. |
static double[][] |
getRanksFromGT(int numTypes,
int[][] groupToTypeMap)
Constructs the contact selection matrix of ranks from the groupToTypeMap with numTypes contact types. |
static double[][] |
getRanksFromTG(int numGroups,
int[][] typeToGroupMap)
Constructs the agent selection matrix of ranks from the typeToGroupMap with numGroups agent groups. |
static int[][] |
getTypeToGroupMap(boolean[][] m)
Constructs and returns a new type-to-group map from the incidence matrix m. |
static int[][] |
getTypeToGroupMap(double[][] ranksTG)
Generates a type-to-group map from the agent selection matrix of ranks ranksTG. |
static int[][] |
getTypeToGroupMap(double[][] ranksTG,
int[] typeRegions,
int[] groupRegions)
This method is similar to getTypeToGroupMap(double[][])
with a sorting algorithm adapted for the local-specialist
policy. |
static int[][] |
getTypeToGroupMap(int numTypes,
int[][] groupToTypeMap)
Generates the type-to-group map from the group-to-type map groupToTypeMap. |
static int[][] |
normalizeRoutingTable(int[][] table)
Equivalent to normalizeRoutingTable
(table, 0). |
static int[][] |
normalizeRoutingTable(int[][] table,
int minColumns)
Converts the routing table table to a rectangular matrix containing table.length rows and at least minColumns columns. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void checkTypeToGroupMap(int numGroups, int[][] typeToGroupMap)
IllegalArgumentException
describing the problem.
numGroups
- the number of agent groups I.typeToGroupMap
- the type-to-group map being checked.
NullPointerException
- if typeToGroupMap or
one of its elements are null.
IllegalArgumentException
- if the matrix is incorrect.public static void checkGroupToTypeMap(int numTypes, int[][] groupToTypeMap)
IllegalArgumentException
describing the problem.
numTypes
- the number of contact types K.groupToTypeMap
- the group-to-type map being checked.
NullPointerException
- if groupToTypeMap or
one of its elements are null.
IllegalArgumentException
- if the matrix is incorrect.public static void checkConsistency(int[][] typeToGroupMap, int[][] groupToTypeMap)
checkTypeToGroupMap
(groupToTypeMap.length, typeToGroupMap) and
checkGroupToTypeMap
(typeToGroupMap.length, groupToTypeMap) do
not throw exceptions.
This methods checks that an agent group index i appears
in the ordered list for contact type k if and only if the contact
type k appears in the ordered list for agent group i.
If this consistency criterion is violated,
an IllegalArgumentException
is thrown.
typeToGroupMap
- the type-to-group map.groupToTypeMap
- the group-to-type map.
IllegalArgumentException
- if the
consistency check fails.checkTypeToGroupMap(int,int[][])
,
checkGroupToTypeMap(int,int[][])
public static int[][] getTypeToGroupMap(int numTypes, int[][] groupToTypeMap)
checkGroupToTypeMap(int,int[][])
does not throw
an exception when called with it.
numTypes
- the number of contact types K.groupToTypeMap
- the group-to-type map being processed.
checkGroupToTypeMap(int,int[][])
public static int[][] getTypeToGroupMap(boolean[][] m)
m
- the incidence matrix.
ArrayUtil.checkRectangularMatrix(Object)
public static int[][] getTypeToGroupMap(double[][] ranksTG)
getTypeToGroupMap(boolean[][])
to get
a list of agent groups sorted in increasing order of
group identifier for each
contact type. Each row of the resulting type-to-group map
is then sorted in rank-increasing order, i.e.,
an agent group i1 goes before i2 if
ranksTG
- the matrix of ranks being transformed.
public static int[][] getTypeToGroupMap(double[][] ranksTG, int[] typeRegions, int[] groupRegions)
getTypeToGroupMap(double[][])
with a sorting algorithm adapted for the local-specialist
policy.
Except from the agent selection matrix of ranks, the method needs arrays
associating a region identifier to each contact type and agent group.
For contact type k,
an agent group i1 goes before an agent group i2
if the location of i1 is the same as the originating
region of contacts of type k, but i2's location is
different from i1's. In other words, groupRegions[i1] == typeRegions[k]
and groupRegions[i2] != typeRegions[k] if i1 is before i2.
Any pair
(i1, i2) not meeting this extra condition is
sorted using the same algorithm as in getTypeToGroupMap(double[][])
.
ranksTG
- the matrix of ranks.typeRegions
- the region identifier of each contact type.groupRegions
- the region identifier of each agent group.
public static int[][] getGroupToTypeMap(int numGroups, int[][] typeToGroupMap)
checkTypeToGroupMap(int,int[][])
does not throw
an exception when called with it.
numGroups
- the number of agent groups I.typeToGroupMap
- the type-to-group map being processed.
int[][])
public static int[][] getGroupToTypeMap(boolean[][] m)
m
- the incidence matrix.
public static int[][] getGroupToTypeMap(double[][] ranksGT)
getGroupToTypeMap(boolean[][])
to get
a list of contact types sorted in increasing order of
type identifier for each
agent group. Each row of the resulting group-to-type map
is then sorted in rank-increasing order, i.e.,
a contact type k1 goes before k2 if
ranksGT
- the matrix of ranks.
public static int[][] getGroupToTypeMap(double[][] ranksGT, int[] typeRegions, int[] groupRegions)
getGroupToTypeMap(double[][])
with a sorting algorithm adapted for the local-specialist
policy.
Except from the contact selection matrix of ranks, the method needs arrays
associating a region identifier to each contact type and agent group.
For each agent group i,
a contact type k1 goes before a contact type k2
if the originating region of k1 is the same as the location
of agent group i, but k2's originating region is
different from k1's. In other words, typeRegions[k1] == groupRegions[i]
and typeRegions[k2] != groupRegions[i] if k1 is before k2.
Any pair
(k1, k2) not meeting this extra condition is
sorted using the same algorithm as in getGroupToTypeMap(double[][])
.
ranksGT
- the matrix of ranks.typeRegions
- the region identifier of each contact type.groupRegions
- the region identifier of each agent group.
public static boolean[][] getIncidenceFromTG(int numGroups, int[][] typeToGroupMap)
checkTypeToGroupMap(int,int[][])
.
numGroups
- the number of agent groups.typeToGroupMap
- the type-to-group map.
public static boolean[][] getIncidenceFromGT(int numTypes, int[][] groupToTypeMap)
checkGroupToTypeMap(int,int[][])
.
numTypes
- the number of contact types.groupToTypeMap
- the group-to-type map.
public static double[][] getRanksFromTG(int numGroups, int[][] typeToGroupMap)
numGroups
- the number of agent groups.typeToGroupMap
- the type-to-group map.
public static double[][] getRanksFromGT(int numTypes, int[][] groupToTypeMap)
numTypes
- the number of contact types.groupToTypeMap
- the group-to-type map.
public static double[][] getRanks(boolean[][] m, int[] skillCounts)
m
- the incidence matrix.skillCounts
- the skill counts.
IllegalArgumentException
- if m.length
is different from skillCounts.length.public static int[][][] getOverflowLists(double[][] ranksTG)
ranksTG
- the input matrix of ranks.
public static String formatTypeToGroupMap(int[][] typeToGroupMap)
formatOrderedList(int[])
.
typeToGroupMap
- the type-to-group map being formatted.
public static String formatGroupToTypeMap(int[][] groupToTypeMap)
formatOrderedList(int[])
.
groupToTypeMap
- the group-to-type map being formatted.
public static String formatRanksTG(double[][] ranksTG)
ranksTG
- the matrix of ranks to be formatted.
public static String formatRanksGT(double[][] ranksGT)
ranksGT
- the matrix of ranks to be formatted.
public static String formatWeightsTG(double[][] weightsTG)
weightsTG
- the weights matrix to be formatted.
public static String formatWeightsGT(double[][] weightsGT)
weightsGT
- the weights matrix to be formatted.
public static String formatIncidence(boolean[][] m)
m
- the incidence matrix to be formatted.
public static String formatOrderedList(int[] orderedList)
orderedList
- the ordered list to be formatted.
public static int[][] normalizeRoutingTable(int[][] table, int minColumns)
table
- the routing table to be converted.minColumns
- the minimal number of columns in the normalized
routing table.
NullPointerException
- if table or one of its
elements is null.
IllegalArgumentException
- if minColumns
is negative.public static int[][] normalizeRoutingTable(int[][] table)
normalizeRoutingTable
(table, 0).
|
ContactCenters V. 0.9.9. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |