public class BalanceFluidRouting extends Object
getOptimalFlowAllocation()
.
The staffing vector must be already be available. The staffing is taken from the call center parameter file and the staffing remains unchanged. The staffing can also be given as parameter.
This algorithm needs to have the same scenario sets from the stochastic fluid staffing programs. And it requires to have the set of scenarios that are satisfied. We solve this as a LP problem.
Constructor and Description |
---|
BalanceFluidRouting(CallCenter cc,
int[] staffing,
Set<Integer> satisfiedScen,
double[][] scenarioLambda)
Constructs and initializes the balance routing optimizer.
|
BalanceFluidRouting(CallCenter cc,
Set<Integer> satisfiedScen,
double[][] scenarioLambda)
Constructs and initializes the balance routing optimizer, the staffing
is taken from the call center parameters.
|
Modifier and Type | Method and Description |
---|---|
protected Solver |
generateSolver()
Returns a new instance of the default Solver used by the optimizer.
|
double |
getAvgOccuPenalty()
Returns the penalty cost for the maximum average occupancy difference.
|
double |
getBadScenarioPenalty()
Gets the penalty cost for each scenario that are not satisfied.
|
protected int |
getHashMapFlowIndex(int type,
int group,
int scenario)
Returns the variable index of the flow of call type to the agent group for the
specified scenario.
|
protected int |
getHashMapOccuMaxIndex(int scenario)
Returns the variable index corresponding to the max occupancy variable of
the specified scenario.
|
protected int |
getHashMapOccuMinIndex(int scenario)
Returns the variable index of the min occupancy variable, for the specified
scenario.
|
protected int |
getHashMapViolationIndex(int type,
int scenario)
Returns the hash map index of the violation variable of the call type and scenario.
|
double[][][] |
getOptimalFlowAllocation()
Returns the optimal flow allocations with indices
[call][group][scenario] . |
double |
getScenOccuPenalty()
Returns the penalty cost for the maximum occupancy difference for individual scenario.
|
boolean |
getUseScenOccuPenalty()
Checks if the routing optimization will use penalty cost on the occupancy difference
for individual scenario.
|
void |
optimize()
Executes the optimization to find the optimal allocation
of each group for each call type.
|
void |
setAvgOccuPenalty(double p)
Sets the penalty cost for the maximum average occupancy difference.
|
void |
setBadScenarioPenalty(double p)
Sets the penalty cost for the scenarios that are not satisfied.
|
void |
setDefaultSolver(Class c)
Sets the default Solver to be used by the optimizer.
|
protected boolean |
setHashMapFlowIndex(int type,
int group,
int scenario,
int index)
Sets the variable index of the flow for call type to agent group for the specified scenario.
|
protected boolean |
setHashMapOccuMaxIndex(int scenario,
int index)
Sets the variable index of the max occupancy variable, for the specified scenario.
|
protected boolean |
setHashMapOccuMinIndex(int scenario,
int index)
Sets the variable index of the min occupancy variable, for the specified scenario.
|
protected boolean |
setHashMapViolationIndex(int type,
int scenario,
int index)
Sets index of the variable for the violation of this call type and scenario.
|
void |
setScenOccuPenalty(double p)
Sets the penalty cost for the maximum occupancy difference of each scenario.
|
void |
setUseScenOccuPenalty(boolean s)
Set the routing optimizer to use penalty cost on the occupancy difference for individual
scenario.
|
protected double[] |
solverSolve()
Internal use: Calls the
Solver.solve() function of the Solver and also updates the solutions. |
public BalanceFluidRouting(CallCenter cc, int[] staffing, Set<Integer> satisfiedScen, double[][] scenarioLambda)
cc
- the call center parametersstaffing
- the staffing vector to use (it will remain fixed)satisfiedScen
- the set of index of the scenarios that are considered to be satisfied,
the rest are assumed to be not satisfiedscenarioLambda
- the scenario generator, it must be have been created
for this call center problem.
The scenarios must be the same as the scenarios used for the fluid staffing optimization.public BalanceFluidRouting(CallCenter cc, Set<Integer> satisfiedScen, double[][] scenarioLambda)
cc
- the call center parameterssatisfiedScen
- the set of index of the scenarios that are considered to be satisfied,
the rest are assumed to be not satisfied.scenarioLambda
- the scenario generator, it must be have been created for this
call center problem.
The scenarios must be the same as the scenarios used for the staffing optimization.protected Solver generateSolver()
setDefaultSolver(java.lang.Class)
.public void setDefaultSolver(Class c)
c
- the class of the new solver to be used by defaultprotected double[] solverSolve() throws SolverException
Solver.solve()
function of the Solver and also updates the solutions.SolverException
- if an error occurred while solving the MIPpublic void optimize()
public void setAvgOccuPenalty(double p)
optimize()
.p
- the penalty costpublic double getAvgOccuPenalty()
public void setScenOccuPenalty(double p)
setUseScenOccuPenalty(boolean)
set to true
.
This parameter must be set before calling optimize()
.p
- the penalty costpublic double getScenOccuPenalty()
public void setUseScenOccuPenalty(boolean s)
setScenOccuPenalty(double)
.s
- set to true
to use penalty cost on the occupancy
difference for individual scenariopublic boolean getUseScenOccuPenalty()
public void setBadScenarioPenalty(double p)
p
- the penalty cost for each unsatisfied scenariopublic double getBadScenarioPenalty()
public double[][][] getOptimalFlowAllocation()
[call][group][scenario]
.
If a group i
cannot serve call type k
,
then element at index [k][i][s] = 0
, for all scenarios.protected int getHashMapViolationIndex(int type, int scenario)
type
- the call type of the violation variablescenario
- the scenario of the violation variableprotected boolean setHashMapViolationIndex(int type, int scenario, int index)
type
- the call type of the violation variablescenario
- the scenario of the violation variableindex
- the variable index to be associate with this violationtrue
if this violation variable has been added to the hash map,
else false
if variable already existsprotected int getHashMapFlowIndex(int type, int group, int scenario)
type
- the call typegroup
- the agent groupscenario
- the scenarioprotected boolean setHashMapFlowIndex(int type, int group, int scenario, int index)
type
- the call typegroup
- the agent groupscenario
- the scenarioindex
- the variable indexprotected int getHashMapOccuMaxIndex(int scenario)
scenario
- the scenario to retrieve the maximum occupancy of this scenarioprotected boolean setHashMapOccuMaxIndex(int scenario, int index)
scenario
- the scenario where to set the maximum occupancyindex
- the index for this maximum occupancy variabletrue
if variable index for max occupancy is added, or false
if max occupancy variable already exists in the hash mapprotected int getHashMapOccuMinIndex(int scenario)
scenario
- the scenario where to get the minimum occupancy variable indexprotected boolean setHashMapOccuMinIndex(int scenario, int index)
scenario
- the scenario of the min occupancy variableindex
- the index for min occupancy variable.true
if variable index for min occupancy is added, or false
if min occupancy variable already exists in the hash map