public class StochFluidStaffingDelayLPSc extends Object
The user can choose different scenario generator with the parameter scenario mode. The current possible scenario generators are: (1) independent generator, (2) Erlang C generator and (3) Erlang A generator.
LP: Round the binary variables iteratively. Solve LP, round and fix some binary variables, re-solve LP, and iterate until all binary variables are fixed. Quick rounding uses a binary search to solve the pricing variable.
Sc: Binary variables for scenarios only. (instead of per scenario and call type)
Ver2: Don't generate the problem in the initialization.
Constructor and Description |
---|
StochFluidStaffingDelayLPSc(CallCenter cc,
int numScenario,
double delayTarget,
DelayScenarioGenerator scenGen)
Constructs and initializes the stochastic fluid staffing optimizer.
|
Modifier and Type | Method and Description |
---|---|
void |
addBinConstraints(boolean quickGlobalRound)
Add the binary constraints to the problem.
|
void |
createLinearProblem(boolean quickGlobalRound)
Create the linear problem solver.
|
Solver |
generateSolver()
Returns a new instance of the default Solver used by the optimizer.
|
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.
|
void |
initBinFixSetHeuristic(double highRatio,
double lowRatio)
Heuristic to reduce the number of binary variables to solve.
|
static void |
main(String[] args)
Runs the optimization with the entered parameters files.
|
void |
optimize(boolean quickGlobalRound)
Execute the optimization.
|
protected double[] |
optimizeLP(double step,
int searchSize)
Execute the optimization.
|
protected double[] |
optimizeQuickGlobal()
Execute the 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 StochFluidStaffingDelayLPSc(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.public void createLinearProblem(boolean quickGlobalRound)
quickGlobalRound
- set to true if using quick global round algorithmprotected 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(boolean quickGlobalRound)
quickGlobalRound
- set to true to round the problem by
optimizing the binary penalty cost such that it minimizes the number of
rounding iteration. Set to false to use iterative rounding
for all binary variables.protected double[] optimizeLP(double step, int searchSize)
step
- the step size when reducing the rounding range.searchSize
- the number of candidates to search at each iteration. Select the candidate
with minimum score.protected double[] optimizeQuickGlobal()
public void addBinConstraints(boolean quickGlobalRound)
quickGlobalRound
- set to true if using quick global round algorithm.public void initBinFixSetHeuristic(double highRatio, double lowRatio)
highRatio
- the ratio of highest volume scenario binary variables to be rounded to 0.lowRatio
- the ratio of lowest volume scenario binary variables to be rounded to 1.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.