public class LocalSearchNoRecourse extends AbstractLocalSearchStoch
The user must give the stochastic solution StochSolution
which will include the scenarios to be covered (satisfy the service
level targets).
This local search only has methods add(umontreal.iro.lecuyer.ccoptim.stochcp.StochSolution)
to add
agents when the solution
does not cover all the required scenarios, and remove(umontreal.iro.lecuyer.ccoptim.stochcp.StochSolution)
to reduce the number of agents and the cost.
The algorithm assumes that all the recourse variables are 0.
This program can use multiple CPU to simulate the scenarios in parallel.
As this local search is simulation-based, it cannot start from an all-0 solution. The initial solution must contain at least 1 agent.
Modifier and Type | Field and Description |
---|---|
protected List<Set<Integer>> |
callGroups
This list contains, for each call type, the set of groups that can serve it.
|
protected double |
incrSimFactor
The simulation length increase factor.
|
protected double[][] |
serviceRates
The service rates for each group and call type, with indices
[type][group] . |
protected List<Set<Integer>> |
skillSetList
This list contains the skill set of each group.
|
bestSolution, currPeriod, numCPU, numGroups, numScenarios, numTypes, rMinusCost, rPlusCost, scenParams, simList, simpList, staffCost, verbose
Constructor and Description |
---|
LocalSearchNoRecourse(ScenariosParams scenParams,
double[] staffCost,
List<? extends CallCenterSim> simList) |
LocalSearchNoRecourse(ScenariosParams scenParams,
List<SimParams> simpList,
double[] staffCost) |
Modifier and Type | Method and Description |
---|---|
protected StochSolution |
add(StochSolution initSol)
Adds one agent at a time until the staffing vector becomes feasible
(satisfies all the service level targets).
|
protected List<DoubleMatrix2D> |
evalSL(int[] realStaffing,
List<Integer> scenList)
Evaluates the service levels by simulation with the given staffing and for
the given list of scenarios.
|
protected double[][] |
getBusyFrac(DoubleMatrix2D served,
double[][] serviceRates)
Returns a matrix that contains a crude estimation of the fraction of time
spent by each agent group working on each call type.
|
protected List<double[][]> |
getBusyFrac(List<DoubleMatrix2D> servedList,
double[][] serviceRates)
Returns a list of matrices that contains a crude estimation of the fractions of time
spent by each agent group working on each call type.
|
protected boolean |
isFeasible(List<DoubleMatrix2D> slList)
Verifies if all the service level measures contained in the list
satisfy their targets.
|
StochSolution |
optimize(StochSolution initSol,
int maxIter,
int maxCPUSec)
Executes the local search starting from the given initial stochastic solution.
|
void |
printSolution(int[] staffing,
double cost)
Prints the staffing vector and the cost (the recourse vectors are unchanged).
|
protected StochSolution |
remove(StochSolution initSol)
Removes one agent at a time to reduce the solution cost,
while keeping all the must-be-covered scenarios feasible
(defined by
StochSolution.getCoveredScenarios() . |
protected boolean |
updateBestSolution(StochSolution sol)
Tests and replaces the current best solution, stored in
AbstractLocalSearchStoch.bestSolution ,
if the given solution has a lower cost. |
getBestSolution, getNumCPU, getVerbose, setNumCPU, setVerbose, verbosePrint, verbosePrintln
protected double incrSimFactor
protected final double[][] serviceRates
[type][group]
.protected final List<Set<Integer>> skillSetList
public LocalSearchNoRecourse(ScenariosParams scenParams, List<SimParams> simpList, double[] staffCost)
public LocalSearchNoRecourse(ScenariosParams scenParams, double[] staffCost, List<? extends CallCenterSim> simList)
protected StochSolution add(StochSolution initSol)
initSol
- the starting solution for the adding methodprotected StochSolution remove(StochSolution initSol)
StochSolution.getCoveredScenarios()
.
If the initial solution initSol
is not feasible,
then this method does nothing.
initSol
- the initial stochastic solutionprotected List<double[][]> getBusyFrac(List<DoubleMatrix2D> servedList, double[][] serviceRates)
[group][type]
.
This method calls double[][])
for each PerformanceMeasureType.SERVEDRATES
matrix and put the returned
matrix in the list to be returned.servedList
- a list of the served rates PerformanceMeasureType.SERVEDRATES
serviceRates
- the service ratesprotected double[][] getBusyFrac(DoubleMatrix2D served, double[][] serviceRates)
[group][type]
.
These time ratios are computed with the service rates and the
served rates PerformanceMeasureType.SERVEDRATES
.
served
- the served rates PerformanceMeasureType.SERVEDRATES
serviceRates
- the service ratespublic StochSolution optimize(StochSolution initSol, int maxIter, int maxCPUSec)
LocalSearchStoch
LocalSearchStoch.setNumCPU(int)
.optimize
in interface LocalSearchStoch
optimize
in class AbstractLocalSearchStoch
initSol
- the initial stochastic solutionmaxIter
- the maximum number of iterations for each local search executionmaxCPUSec
- the maximum CPU time in secondsprotected List<DoubleMatrix2D> evalSL(int[] realStaffing, List<Integer> scenList)
scenList
.realStaffing
- the effective staffing vector to simulatescenList
- the list of scenarios to simulateprotected boolean isFeasible(List<DoubleMatrix2D> slList)
slList
- the list service level measurestrue
if all the service level measures in the list
satisfy their targets, else false
protected boolean updateBestSolution(StochSolution sol)
AbstractLocalSearchStoch.bestSolution
,
if the given solution has a lower cost.
This function assumes the given solution is feasible.
This function returns true
if the best solution has changed, else
it returns false
.sol
- the solution to test and possibly to replace the current best solutiontrue
if the best solution has changed, else
it returns false
(no change)public void printSolution(int[] staffing, double cost)