public class StochFluidStaffingDelaySc extends Object
Sc: Binary variables per scenario only. This approach is more realistic because the states reflect a more FAIR routing policy. Solve the binary variable as integer (no relaxation).
Constructor and Description |
---|
StochFluidStaffingDelaySc(CallCenter cc,
int numScenario,
double delayTarget,
DelayScenarioGenerator scenGen)
Constructs and initializes the stochastic fluid staffing optimizer.
|
Modifier and Type | Method and Description |
---|---|
Solver |
generateSolver()
Returns a new instance of the default Solver used by the optimizer.
|
static double[][] |
getAvgCallGroupAlloc(double[][][] flowAllocation)
Compute the average of the agents allocation for each call type over all scenarios from
the given allocation matrix.
|
static double[][] |
getCallGroupAllocRatio(double[][] callGroupAlloc)
Return the ratio of agents for each call type based on the given allocation.
|
static double[][] |
getGroupCallAllocRatio(double[][] callGroupAlloc)
Return the ratio of calls per type for each agent group based on the given allocation.
|
protected int |
getHashMapBinLambdaIndex(int scenario)
Get the variable index of the binary lambda of this scenario.
|
protected int |
getHashMapFlowIndex(int type,
int group,
int scenario)
Get the variable index of the flow of call type to the agent group for the scenario.
|
protected int |
getHashMapLambdaIndex(int type,
int scenario)
Get the variable index of the lambda of call type for the scenario.
|
protected int |
getHashMapStaffingIndex(int group)
Get the variable index from HashMap of the group.
|
double[][][] |
getOptimalFlowAllocation()
Return the optimal (call,group,scenario) flow allocations.
|
double |
getOptimalObjective()
Returns the objective value of the optimal staffing vector (integer number of agents).
|
int[] |
getOptimalStaffing()
Returns the staffing solution found by the optimizer.
|
double |
getStaffingCost(int[] staffing)
Return the cost of the staffing.
|
void |
init(CallCenter cc)
Reads the call center parameters.
|
static void |
main(String[] args)
Runs the optimization with the entered parameters files.
|
void |
optimize()
Execute the optimization.
|
protected double[] |
optimizeLP()
Execute the cutting-plane optimization.
|
protected void |
printNumAgents(int[] staffing) |
protected void |
printNumAgents(int[] staffing,
boolean print) |
void |
setDefaultSolver(Class c)
Sets the default Solver to be used by the optimizer.
|
protected boolean |
setHashMapBinLambdaIndex(int scenario,
int index)
Set the variable index of the binary lambda for this scenario.
|
protected boolean |
setHashMapFlowIndex(int type,
int group,
int scenario,
int index)
Set the variable index of the flow for call type to agent group for the scenario.
|
protected boolean |
setHashMapLambdaIndex(int type,
int scenario,
int index)
Set the variable index of the lambda for call type for the scenario.
|
protected boolean |
setHashMapStaffingIndex(int group,
int index)
Set the group variable index if not present in HashMap.
|
protected double[] |
solverSolve()
Internal use.
|
public StochFluidStaffingDelaySc(CallCenter cc, int numScenario, double delayTarget, DelayScenarioGenerator scenGen)
init
implicitly.cc
- the call center parameters.numScenario
- the number of scenarios to generate.delayTarget
- the delay target.scenGen
- the scenario generator, it must be have been created with this problem.public static void main(String[] args) throws Exception
Exception
public Solver generateSolver()
setDefaultSolver(java.lang.Class)
.public void setDefaultSolver(Class c)
c
- the class of the new solver to be used by default.public void init(CallCenter cc)
cc
- the call center parameter.protected double[] solverSolve() throws SolverException
Solver.solve()
function of the Solver and also updates the solutions.SolverException
- if an error occurred while solving the MIP.public void optimize()
public static double[][] getAvgCallGroupAlloc(double[][][] flowAllocation)
getOptimalFlowAllocation()
to
get the average of the optimal allocation.flowAllocation
- the allocation must be per call type, per agent group and per scenario.
The matrix must be of size : [number of call types]x[number of agent groups]x[number of scenarios].public static double[][] getCallGroupAllocRatio(double[][] callGroupAlloc)
getAvgCallGroupAlloc(double[][][])
to
compute the ratio of average allocations.
The returned ratio matrix has : first index is the call type, second index is the agent group.callGroupAlloc
- the allocation to convert to ratio, must be a rectangular matrix of size
[number of call types]x[number of agent groups].public static double[][] getGroupCallAllocRatio(double[][] callGroupAlloc)
getAvgCallGroupAlloc(double[][][])
to
compute the ratio of average allocations.
The returned ratio matrix has : first index is the agent group, second index is the call type.callGroupAlloc
- the allocation to convert to ratio, must be a rectangular matrix of size
[number of call types]x[number of agent groups].protected double[] optimizeLP()
public int[] getOptimalStaffing()
public double getOptimalObjective()
public double[][][] getOptimalFlowAllocation()
public double getStaffingCost(int[] staffing)
staffing
- find the total cost of this staffing vector.protected void printNumAgents(int[] staffing)
protected void printNumAgents(int[] staffing, boolean print)
protected int getHashMapStaffingIndex(int group)
group
- retrieve the variable index of this group.protected boolean setHashMapStaffingIndex(int group, int index)
group
- the group to insert in HashMap.index
- the variable index to be associate with this group.protected int getHashMapFlowIndex(int type, int group, int scenario)
type
- the call type.group
- the agent group.scenario
- the scenario.protected boolean setHashMapFlowIndex(int type, int group, int scenario, int index)
type
- the call type.group
- the agent group.scenario
- the scenario.index
- the variable index.protected int getHashMapLambdaIndex(int type, int scenario)
type
- the call type.scenario
- the scenario.protected boolean setHashMapLambdaIndex(int type, int scenario, int index)
type
- the call type.scenario
- the scenario.index
- the variable index.protected int getHashMapBinLambdaIndex(int scenario)
scenario
- the scenario.protected boolean setHashMapBinLambdaIndex(int scenario, int index)
scenario
- the scenario.index
- the variable index.