public class SimCorrector extends Object
RandomizedSearch
using only a simulator.
The optimization methods are:
getFeasible(int[], umontreal.iro.lecuyer.ccoptim.rs.SimCorrector.SimFeasiblePriority)
to initialize and find a sim-feasible solution, and
removeAgents(int[])
and switchAgents(int[])
methods to reduce the staffing cost.
This class is mainly used to correct the solution returned by RandomizedSearch
that
is based on approximation like LossDelayApprox
.
The suggested order of calls is:
getFeasible(int[], umontreal.iro.lecuyer.ccoptim.rs.SimCorrector.SimFeasiblePriority)
, removeAgents(int[])
, and finally switchAgents(int[])
.
As the switch method requires more execution time, it should be seen as optional.
Note that this algorithm can take considerable CPU time since it uses simulation as the call center evaluator.
Modifier and Type | Class and Description |
---|---|
static class |
SimCorrector.SimFeasiblePriority
Defines the priority mode of the service level target
to satisfy (global or per call type first) in the
procedure
umontreal.iro.lecuyer.ccoptim.rs.SimCorrector.SimFeasiblePriority, int) . |
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_MAX_CPU_SEC
The default maximum CPU time limit in seconds when calling the methods:
umontreal.iro.lecuyer.ccoptim.rs.SimCorrector.SimFeasiblePriority) ,
removeAgents(int[]) or switchAgents(int[]) . |
Constructor and Description |
---|
SimCorrector(ContactCenterEval simulator,
CallCenter cc,
double[] agentCost,
int currentPeriod)
Constructs the optimization object.
|
SimCorrector(ContactCenterEval simulator,
CallCenter cc,
double premiumCost,
int currentPeriod)
Constructs the optimization object.
|
Modifier and Type | Method and Description |
---|---|
double[] |
getAgentCosts()
Returns the cost per agent per group vector.
|
int |
getCurrentPeriod()
Returns the period number to be optimized.
|
int[] |
getFeasible(int[] staffing,
SimCorrector.SimFeasiblePriority priority)
If the staffing vector is not feasible (service levels are below their targets),
then it increases the staffing until it becomes feasible (according to simulation).
|
int[] |
getFeasible(int[] staffing,
SimCorrector.SimFeasiblePriority priority,
int maxCPUsec)
If the staffing vector is not feasible (service levels under their targets),
then it increases the staffing until it becomes feasible (according to simulation).
|
long |
getGetFeasibleTimeSec()
Returns the time spent (in seconds) in the function
getFeasible(int[], umontreal.iro.lecuyer.ccoptim.rs.SimCorrector.SimFeasiblePriority) . |
long |
getRemoveAgentsTimeSec()
Returns the time spent (in seconds) in the function
removeAgents(int[]) . |
int |
getSimTimeSec()
Returns the total time (in seconds) spent doing simulations.
|
ContactCenterEval |
getSimulator()
Returns the simulator used to evaluate the staffing solutions.
|
double |
getStaffingCost(int[] staffing)
Returns the total staffing cost of the given staffing vector.
|
long |
getSwitchAgentsTimeSec()
Returns the time spent (in seconds) in the function
switchAgents(int[]) . |
static int |
getTotalAgents(int[] staffing)
Returns the total number of agents in the staffing vector.
|
int |
getTotalNumSim()
Returns the total number of simulation calls.
|
boolean |
getVerbose()
Returns the verbose parameter.
|
static void |
main(String[] args)
Optimizes the staffing of a call center
using the correction by simulation only.
|
int[] |
removeAgents(int[] staffing)
Decreases the staffing cost by decrementing
the staffing vector until it becomes infeasible,
and then it returns the last feasible solution.
|
int[] |
removeAgents(int[] staffing,
int maxCPUSec)
Decreases the staffing cost by decrementing
the staffing vector until it becomes infeasible,
and then it returns the last feasible solution.
|
void |
setVerbose(boolean v)
Prints the output otherwise prints nothing.
|
protected void |
simEval(int[] staffing)
Evaluates the staffing vector with the simulator given to the constructor
and returned by
getSimulator() . |
int[] |
switchAgents(int[] staffing)
Switches agents from one group to another in order to reduce the cost while staying feasible.
|
int[] |
switchAgents(int[] staffing,
int maxCPUsec)
Switches agents from one group to another in order to reduce the cost
while staying feasible.
|
int[] |
switchAgents(int[] staffing,
int maxCPUsec,
int maxIterNoImpr)
Switches agents from one group to another in order to reduce the cost
while staying feasible.
|
public static int DEFAULT_MAX_CPU_SEC
umontreal.iro.lecuyer.ccoptim.rs.SimCorrector.SimFeasiblePriority)
,
removeAgents(int[])
or switchAgents(int[])
.
This value corresponds to 365 days.public SimCorrector(ContactCenterEval simulator, CallCenter cc, double[] agentCost, int currentPeriod)
simulator
- the call center simulator to be usedcc
- the call center modelagentCost
- the cost per agent vector for each agent group If null
,
then it will take AgentGroupManager.getBusyCost()
from the call center model cc
.currentPeriod
- the period to be optimizedpublic SimCorrector(ContactCenterEval simulator, CallCenter cc, double premiumCost, int currentPeriod)
simulator
- the call center simulator to be usedcc
- the call center modelpremiumCost
- the premium cost per extra skill (base cost is 1),
that is if an agent has only one skill then his cost is 1, and add this
premiumCost
value for each extra skill.
Set a negative value (less than 0)
to use AgentGroupManager.getBusyCost()
from the call center modelcurrentPeriod
- the period to be optimizedprotected void simEval(int[] staffing)
getSimulator()
.staffing
- the staffing vector to evaluatepublic int[] getFeasible(int[] staffing, SimCorrector.SimFeasiblePriority priority)
umontreal.iro.lecuyer.ccoptim.rs.SimCorrector.SimFeasiblePriority, int)
with the default CPU time limit DEFAULT_MAX_CPU_SEC
.staffing
- the staffing vector to get feasible. A deep copy is done, so this
input vector will stay unchanged.priority
- sets the priority to first satisfy the global SL target or per
call type targetpublic int[] getFeasible(int[] staffing, SimCorrector.SimFeasiblePriority priority, int maxCPUsec)
staffing
- the staffing vector to get feasible. A deep copy is done, so this
input vector will stay unchanged.priority
- sets the priority to first satisfy the global SL target or per
call type targetmaxCPUsec
- the maximum time in seconds allocated for this method.
When the time limit has been reached,
it returns the incumbent solution that may be still infeasible.public int[] removeAgents(int[] staffing)
DEFAULT_MAX_CPU_SEC
.staffing
- the staffing vector to decrement. Deep copy is done, so
this input vector remains unchanged.public int[] removeAgents(int[] staffing, int maxCPUSec)
staffing
- the staffing vector to decrement. Deep copy done, so
this input vector remains unchanged.maxCPUSec
- the maximum CPU time limit in seconds allocated for this method. If
the time is exceeded, it returns the incumbent solution.public int[] switchAgents(int[] staffing)
staffing
- the starting staffing vector. Deep copy is done, so the input vector
remains unchanged).public int[] switchAgents(int[] staffing, int maxCPUsec)
int, int)
with parameter
maxIterNoImpr
equals to Integer.MAX_VALUE
.staffing
- the starting staffing vector. Deep copy is done, so the input vector
remains unchanged).maxCPUsec
- the maximum time in seconds allocated for this method. If the
time is exceeded, it returns the incumbent staffing solution.public int[] switchAgents(int[] staffing, int maxCPUsec, int maxIterNoImpr)
staffing
- the starting staffing vector. Deep copy is done, so the input vector
remains unchanged).maxCPUsec
- the maximum time in seconds allocated for this method. If the
time is exceeded, it returns the incumbent staffing solution.maxIterNoImpr
- consecutive iterations (pivots) without improvement on the staffing cost.public static int getTotalAgents(int[] staffing)
staffing
- the staffing vectorpublic double getStaffingCost(int[] staffing)
getAgentCosts()
.staffing
- the staffing vectorpublic void setVerbose(boolean v)
v
- set true
to print the output.public boolean getVerbose()
true
is verbose is on, else false
.public ContactCenterEval getSimulator()
public int getCurrentPeriod()
public double[] getAgentCosts()
public int getSimTimeSec()
public int getTotalNumSim()
public long getGetFeasibleTimeSec()
getFeasible(int[], umontreal.iro.lecuyer.ccoptim.rs.SimCorrector.SimFeasiblePriority)
.public long getRemoveAgentsTimeSec()
removeAgents(int[])
.public long getSwitchAgentsTimeSec()
switchAgents(int[])
.public static void main(String[] args) throws Exception
The arguments are:
AgentGroupManager.getBusyCost()
.
Exception