public class WhittWallaceRoutingStaffing extends Object
Important: the original groups and routing policy are ignored! The new model will contain ONLY groups with 2 skills, and all agents have the same cost. This program does not optimize the queue capacity.
The new routing policy is a priority-rule policy with equality priorities;
this is implemented by the policy AgentsPrefRouter
.
For the call selection rule (when an agent becomes idle), the agent will always give priority to
her first skill over her second skill.
For the agent selection rule (when a new call arrives and finds an idle agent),
the call has 2 levels of priorities. First, it
will give priority to all agents whose primary skill corresponds to its call type.
Next, if it has not been match with an agent yet, it will look at all agents
whose secondary skill corresponds to its call type. If it is still not matched,
then it will enter into the waiting queue of its type.
Note that the algorithm of Wallace and Whitt (2005) was designed for a single period (or whole day)
optimization. Hence, the optimization requires a simulator using BatchSimParams
.
The user may control the current period to optimize by changing BatchSimParams.setCurrentPeriod(int)
.
The user should call java.lang.String)
to execute the optimization and
export the solution to a new call center parameter file.
Modifier and Type | Class and Description |
---|---|
protected static class |
WhittWallaceRoutingStaffing.MatrixRow
Used to represent the skill set of an agent.
|
protected static class |
WhittWallaceRoutingStaffing.RoutingMatrix
Represents a
groupToTypeMap matrix. |
Modifier and Type | Field and Description |
---|---|
protected CallCenterParams |
ccParams
The call center model.
|
protected int |
cp
Period to optimize.
|
protected int |
K
Number of call types.
|
protected int |
P
Number of periods.
|
protected CallCenterSim |
sim
The simulator used for the optimization.
|
protected BatchSimParams |
simParams
The parameters of the simulator.
|
Constructor and Description |
---|
WhittWallaceRoutingStaffing(CallCenterParams ccParams,
BatchSimParams simParams)
Creates a new instance of the optimization algorithm.
|
Modifier and Type | Method and Description |
---|---|
protected void |
cleanGroupToTypeMap()
Cleans the
groupToTypeMap matrix by removing invalid rows and by regrouping
agents with the same routing priorities into a single group. |
protected void |
constructInitialRoutingMatrix()
Finds an initial solution using approximation formula Erlang A or Erlang C
(depends on the patience time).
|
protected boolean |
findBestRowToAdd(int[] row)
Returns if the current solution is feasible or not.
|
protected int |
findBestRowToRemove()
Finds the best agent to remove.
|
protected void |
findInitialFeasibleSolution()
Finds a feasible solution that satisfies all service level targets, based on simulation.
|
static int |
getStaffingByErlang(double lambda,
double mu,
double pat,
double awt,
double minSL)
Finds the minimum number of agents to satisfy the service level of a M/M/c queueing system,
using the Erlang formulas.
|
protected void |
improveSolution(int maxSwaps)
Improves the solution by removing agents and switching skill sets of agents.
|
protected static boolean |
isValidRow(int[] row)
A row is not valid if it is
null or if at least one element is
smaller than 0. |
static void |
main(String[] args)
Executes the staffing and routing optimization.
|
void |
optimize(int maxSwaps)
Executes the optimization.
|
void |
optimize(int maxSwaps,
String outputFn)
Executes
optimize(int) , then writeResult(java.lang.String) to export
the solution to a new call center parameter file. |
protected static int[] |
roundValues(double[] values,
int sum)
Rounds the vector
values such that the sum of rounded values
is equal to sum . |
protected void |
setGroupToTypeMap(RouterParams rpar,
int[][] groupToTypeMap)
Sets the new
groupToTypeMap parameter into the routing parameters. |
void |
writeResult(String outputFileName)
Exports the optimization result to a new call center parameter file.
|
protected CallCenterParams ccParams
protected BatchSimParams simParams
protected int K
protected int P
protected int cp
protected CallCenterSim sim
public WhittWallaceRoutingStaffing(CallCenterParams ccParams, BatchSimParams simParams)
BatchSimParams.getCurrentPeriod()
.ccParams
- the original call center modelsimParams
- the parameters of the simulationpublic static int getStaffingByErlang(double lambda, double mu, double pat, double awt, double minSL)
pat
, it will use Erlang A or Erlang C.lambda
- the arrival ratemu
- the service ratepat
- the patience rateawt
- the acceptable waiting timeminSL
- the minimum service level required (number within 0 and 1)protected static int[] roundValues(double[] values, int sum)
values
such that the sum of rounded values
is equal to sum
.
This method first round all values to their floor values.
Then, it sorts all fractional remainders in decreasing order. This means
the value with the biggest fractional value is first.
Following this order, increase each value by one until the sum is equal
to sum
.
In general, the parameter sum
should be the rounded value
of the sum of all real numbers in vector values
.
values
- the vector to roundsum
- the sum of the rounded value should be equal to this parameterprotected void constructInitialRoutingMatrix()
protected void setGroupToTypeMap(RouterParams rpar, int[][] groupToTypeMap)
groupToTypeMap
parameter into the routing parameters.
This will set the groupToTypeMap
.
It will also convert groupToTypeMap
into ranksGT
and ranksGT
for the policy RouterPolicyType.AGENTSPREF
.rpar
- the routing parameter to be update with the new groupToTypeMap
groupToTypeMap
- the new groupToTypeMap
protected boolean findBestRowToAdd(int[] row)
row
.
The worst mean the largest positive gap between the service level target minus
the service level.
Note that it is preferable that the global service level target is the same as the target per call type.
row
- this will contain exactly the array -1,-1 if the solution is
feasible, otherwise it will contain k1, k2 where k1
is the worst
unsatisfied call type and k2
is the second worst unsatisfied call type.
In case of ties, the call type with the lowest index is kept.true
is the solution is feasible, otherwise false
. Also
see the modified parameter row
.protected int findBestRowToRemove()
k1
be the primary call type and k2
be the secondary call type of an agent.
This method selects the agent such that her primary type k1
corresponds to
the call type with the highest difference of the service level minus its target.
If multiple agents have primary type k1
, then this method will choose the agent
such that her secondary type k2
has the highest difference (service level minus its target).-1
if no agent can be removedprotected void findInitialFeasibleSolution()
findBestRowToAdd(int[])
.
It stops when the solution becomes feasible.protected void improveSolution(int maxSwaps)
At each iteration of this method, it removes an agent and if the solution is not feasible,
then it tries to find a feasible solution by switching the skill sets of at most maxSwaps
agents.
This method stops on the first iteration that
it cannot generate a feasible solution after removing and swapping skill sets.
maxSwaps
- the maximum number of tries to switch skill sets, in each iterationprotected static boolean isValidRow(int[] row)
null
or if at least one element is
smaller than 0.row
- the row to testtrue
if valid, otherwise false
protected void cleanGroupToTypeMap()
groupToTypeMap
matrix by removing invalid rows and by regrouping
agents with the same routing priorities into a single group.public void writeResult(String outputFileName)
optimize(int)
should be called first.outputFileName
- the filename of the output filepublic void optimize(int maxSwaps)
writeResult(java.lang.String)
to export the solution
after this method is finished.maxSwaps
- the maximum number of skill set swaps to make a solution
feasible, at each iteration of the optimization. See method improveSolution(int)
.public void optimize(int maxSwaps, String outputFn)
optimize(int)
, then writeResult(java.lang.String)
to export
the solution to a new call center parameter file.maxSwaps
- see the parameter of optimize(int)
outputFn
- the filename of the output file that will contain the solutionpublic static void main(String[] args) throws Exception
args
- see the descriptionException