public class RecourseProblem extends Object
Modifier and Type | Field and Description |
---|---|
protected CallCenter |
cc
The call center model.
|
protected ilog.cplex.IloCplex |
cplex
The Cplex instance that represents the recourse problem.
|
protected HashMap<String,ilog.concert.IloNumVar> |
flowVarMap
A hash map that contains the flow covering variables with key String
w:k,i,m where k is the call type number, i is
the group number and m is the scenario number. |
protected int |
numGroups
The number of agent groups.
|
protected int |
numScenarios
The number of scenarios, defined by
scenParams . |
protected int |
numTypes
The number of call types.
|
protected double[] |
rMinusCost
The recourse cost of the variables
rMinusVar for removing agents. |
protected ilog.concert.IloNumVar[][] |
rMinusVar
The recourse r- variables, with indices
[group][scenario] . |
protected double[] |
rPlusCost
The recourse cost of the variables
rPlusVar for adding more agents. |
protected ilog.concert.IloNumVar[][] |
rPlusVar
The recourse r+ variables, with indices
[group][scenario] . |
protected ScenariosParams |
scenParams
The scenario parameters.
|
protected boolean |
solveIP
Parameter that determines if this recourse problem must be solved by
integer programming (set to
true ) or relaxed to a linear problem. |
protected double[] |
staffCost
The staffing cost per agent for each group (for the variables
yVar . |
protected ilog.concert.IloNumVar[] |
yVar
The staffing variable, with index
[group] . |
Constructor and Description |
---|
RecourseProblem(CallCenter cc,
ScenariosParams scenParams,
List<CuttingPlaneOnly> cpList,
boolean solveIP)
Constructs the stochastic staffing problem with recourse.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addConstraints(int scenIndex,
CuttingPlaneOnly cp,
ArrayList<StochCP.VariableData> varList)
Adds the constraints from
CuttingPlaneOnly . |
protected void |
addFlowVariables()
Creates the flow covering variables.
|
ilog.cplex.IloCplex |
buildProblem(List<CuttingPlaneOnly> cpList)
Builds and returns the Cplex model, ready to be solved.
|
ilog.cplex.IloCplex |
getCplexModel()
Returns the Cplex model, ready to be solved, or returns
null
if buildProblem(java.util.List) has not been executed yet. |
protected void |
initIP()
Initializes the integer variables.
|
protected void |
initLP()
Initializes the continuous variables (but not the flow covering variables).
|
protected ArrayList<StochCP.VariableData> |
parseVariables(HashMap<String,Integer> varIndexMap)
Parses the index of variables used by the
CuttingPlaneOnly instances. |
protected final CallCenter cc
protected final ScenariosParams scenParams
protected final int numScenarios
scenParams
.protected final int numTypes
protected final int numGroups
protected final boolean solveIP
true
) or relaxed to a linear problem.protected ilog.cplex.IloCplex cplex
protected ilog.concert.IloNumVar[] yVar
[group]
.protected ilog.concert.IloNumVar[][] rPlusVar
[group][scenario]
.protected ilog.concert.IloNumVar[][] rMinusVar
[group][scenario]
.protected HashMap<String,ilog.concert.IloNumVar> flowVarMap
w:k,i,m
where k
is the call type number, i
is
the group number and m
is the scenario number.protected double[] staffCost
yVar
.protected double[] rPlusCost
rPlusVar
for adding more agents.protected double[] rMinusCost
rMinusVar
for removing agents.
This value must be positive, since the algorithm will subtract this cost from
the objective cost.public RecourseProblem(CallCenter cc, ScenariosParams scenParams, List<CuttingPlaneOnly> cpList, boolean solveIP)
cc
- a sample of the call center model (only used for some data)scenParams
- the scenario parameterscpList
- the list of cutting-plane solver used to optimize the scenarios individually.
Note that these instances must correspond to the scenario order in scenParams
.solveIP
- set to true
to create an MIP problem, or false
to create an LP problempublic ilog.cplex.IloCplex buildProblem(List<CuttingPlaneOnly> cpList) throws ilog.concert.IloException
getCplexModel()
.cpList
- the list of CuttingPlaneOnly
instances that were used to optimize
individually the scenarios.ilog.concert.IloException
protected ArrayList<StochCP.VariableData> parseVariables(HashMap<String,Integer> varIndexMap)
CuttingPlaneOnly
instances.
If only group > 0, then it is a staffing variable.
If both group > 0 and type > 0, then it is a flow covering variable.
The returned vector corresponds to the coefficient vector used by the CuttingPlaneOnly
instances.varIndexMap
- the hash map where the key is the name of the variable as a String
and the value is its index position in the coefficient array.
A staffing variable is named staff:X
where X
is replaced by its
group number.
A flow variable is named flow:K,G
where W
is replaced by
the call type number and G
is replaced by the group number.protected void initIP() throws ilog.concert.IloException
ilog.concert.IloException
protected void initLP() throws ilog.concert.IloException
ilog.concert.IloException
protected void addFlowVariables() throws ilog.concert.IloException
ilog.concert.IloException
protected void addConstraints(int scenIndex, CuttingPlaneOnly cp, ArrayList<StochCP.VariableData> varList) throws ilog.concert.IloException
CuttingPlaneOnly
.scenIndex
- the scenario index numbercp
- the CuttingPlaneOnly
instance used to optimize this scenariovarList
- the variable index translatorilog.concert.IloException
- an error occurred with Cplexpublic ilog.cplex.IloCplex getCplexModel()
null
if buildProblem(java.util.List)
has not been executed yet.null
if buildProblem(java.util.List)
has not been executed yet