public abstract class AbstractLocalSearchSingle extends Object implements LocalSearchSingle
LocalSearchSingle.Solution
Modifier and Type | Field and Description |
---|---|
protected LocalSearchSingle.Solution |
bestSolution
The best solution found.
|
protected List<Set<Integer>> |
callGroups
This list contains, for each call type, the set of groups that can serve it.
|
protected CallCenter |
cc
The call center model.
|
protected int |
currPeriod
The period to optimize.
|
protected double |
incrSimFactor
The simulation length increase factor.
|
protected int |
maxIncrSim
The maximum number of times the simulation length can be increased.
|
protected int |
numGroups
The number of agent groups.
|
protected int |
numTypes
The number of call types.
|
protected double[] |
rMinusCost
The recourse cost for removing one agent, for each group.
|
protected double[] |
rPlusCost
The recourse cost for adding one agent, for each group.
|
protected double[][] |
serviceRates
The service rates for each group and call type, with indices
[type][group] . |
protected CallCenterSim |
sim
The call center simulator.
|
protected List<Set<Integer>> |
skillSetList
This list contains the skill set of each group.
|
protected double[] |
staffCost
The cost vector per agent per group.
|
protected boolean |
verbose
Sets to
true to print program output to screen. |
Constructor and Description |
---|
AbstractLocalSearchSingle(CallCenterSim sim,
double[] staffCost,
double[] rPlusCost,
double[] rMinusCost)
Instantiates the parameters for the local search.
|
Modifier and Type | Method and Description |
---|---|
double |
computeCost(int[] staffing,
int[] rPlus,
int[] rMinus)
Computes the cost of this solution, without multiplying by the
probability mass of the scenario.
|
DoubleMatrix2D |
evalSL(int[] realStaffing)
Performs the simulation of the given staffing and returns the service level measures.
|
DoubleMatrix2D |
evalSL(int[] staffing,
int[] rPlus,
int[] rMinus)
Performs the simulation of the given staffing and returns the service level measures.
|
LocalSearchSingle.Solution |
getBestSolution()
Returns the best solution found or
null if
the local search has not been executed yet. |
boolean |
getVerbose()
Returns the value of the verbose parameter.
|
protected boolean |
isFeasible(DoubleMatrix2D sl)
Checks if all the service level targets are met.
|
protected boolean |
isFeasible(DoubleMatrix2D sl,
double tol)
Checks if all the service level targets are met, with a tolerance gap of
tol . |
protected static boolean |
isStaffingNonNegative(int[] staffing,
int[] rPlus,
int[] rMinus)
Checks if the staffing and recourse values are valid, that is there are no negative values.
|
abstract LocalSearchSingle.Solution |
optimize(int[] staffInit,
int[] rPlusInit,
int[] rMinusInit,
int maxIter,
int maxCPUSec)
Executes the local search for this scenario.
|
void |
printSolution(int[] staffing,
int[] rPlus,
int[] rMinus,
double cost)
Prints the staffing, rPlus and rMinus vectors, followed by the cost.
|
void |
setVerbose(boolean verbose)
Sets verbose to
true to print program output to screen, else
sets to false to print less information. |
protected void |
verbosePrint(String s)
Calls the method
System.out.print(s) , where s is the argument,
if the verbose parameter is set to true . |
protected void |
verbosePrintln(String s)
Calls the method
System.out.println(s) , where s is the argument,
if the verbose parameter is set to true . |
protected boolean verbose
true
to print program output to screen.protected LocalSearchSingle.Solution bestSolution
protected final CallCenter cc
protected final int currPeriod
RepSimParams
, then this
value must be 0.protected double incrSimFactor
protected int maxIncrSim
protected final int numGroups
protected final int numTypes
protected final double[][] serviceRates
[type][group]
.protected final CallCenterSim sim
protected final List<Set<Integer>> skillSetList
protected final List<Set<Integer>> callGroups
protected final double[] staffCost
protected final double[] rMinusCost
protected final double[] rPlusCost
public AbstractLocalSearchSingle(CallCenterSim sim, double[] staffCost, double[] rPlusCost, double[] rMinusCost)
sim
- the call center simulatorstaffCost
- the staffing cost per agent for each group (non-recourse)rPlusCost
- the recourse cost vector for adding one agent per grouprMinusCost
- the recourse cost vector for removing one agent per groupprotected static boolean isStaffingNonNegative(int[] staffing, int[] rPlus, int[] rMinus)
staffing
- the staffing vector (non-recourse)rPlus
- the recourse variables for adding agentsrMinus
- the recourse variables for removing agentspublic void printSolution(int[] staffing, int[] rPlus, int[] rMinus, double cost)
staffing
- the staffing vector before recourse actionsrPlus
- the recourse vector for adding agentsrMinus
- the recourse vector for removing agentscost
- the cost of this solutionpublic double computeCost(int[] staffing, int[] rPlus, int[] rMinus)
computeCost
in interface LocalSearchSingle
staffing
- the staffing vectorrPlus
- the recourse vector for adding agentsrMinus
- the recourse vector for removing agentspublic DoubleMatrix2D evalSL(int[] realStaffing)
evalSL
in interface LocalSearchSingle
realStaffing
- the staffing vector simulate.
Use int[], int[])
to get the real staffing vector.public DoubleMatrix2D evalSL(int[] staffing, int[] rPlus, int[] rMinus)
int[], int[])
to get
the effective staffing vector (with recourse), then it calls
evalSL(int[])
.evalSL
in interface LocalSearchSingle
staffing
- the non-recourse staffing vectorrPlus
- the recourse variables for adding agentsrMinus
- the recourse variables for removing agentspublic LocalSearchSingle.Solution getBestSolution()
null
if
the local search has not been executed yet.getBestSolution
in interface LocalSearchSingle
null
if
the local search has not been executed yetprotected boolean isFeasible(DoubleMatrix2D sl)
double)
with a tolerance level of 0.sl
- the service level matrix to check for feasibilitytrue
if the given service levels meet all their targets, otherwise false
protected boolean isFeasible(DoubleMatrix2D sl, double tol)
tol
.
Set tol
to a positive value to lower the service level targets during the check.
Or set tol
to a negative value to increase the targets.sl
- the service level measures to check the feasibilitytol
- the tolerance level on the SL target. A positive value means more
tolerance, hence it will lower the target. A negative value means less tolerance,
and it will increase the SL target.true
if the given service level measures satisfy all their targets with
the given tolerance level, for the current periodpublic abstract LocalSearchSingle.Solution optimize(int[] staffInit, int[] rPlusInit, int[] rMinusInit, int maxIter, int maxCPUSec)
optimize
in interface LocalSearchSingle
staffInit
- the initial staffing variables (non-recourse)rPlusInit
- the initial recourse variables for adding agentsrMinusInit
- the initial recourse variables for removing agentsmaxIter
- maximum number of iterationsmaxCPUSec
- maximum CPU time in secondspublic void setVerbose(boolean verbose)
LocalSearchSingle
true
to print program output to screen, else
sets to false
to print less information.setVerbose
in interface LocalSearchSingle
verbose
- true
to print program output to screen, else
false
to print less information.public boolean getVerbose()
LocalSearchSingle
getVerbose
in interface LocalSearchSingle
protected void verbosePrint(String s)
System.out.print(s)
, where s
is the argument,
if the verbose parameter is set to true
.s
- the string to printprotected void verbosePrintln(String s)
System.out.println(s)
, where s
is the argument,
if the verbose parameter is set to true
.s
- the string to print