public class TwoStep extends Object
CuttingPlaneOptimizer
.
The first step consists to find the optimal staffing vectors of each
scenario (without recourse) independently.
The second step is to find the stochastic solution with recourse actions,
that will cover the required staffing of all the scenarios found in step 1.
This stochastic algorithm is not iterative (unlike StochCP
because
the stochastic solution is guaranteed to be feasible, assuming the same simulator is used
(that is, using common random.numbers).
The recourse variables can be enabled by setting the parameter ScenariosParams.useRecourse
to true
(default value).
Note: if the simulator uses the parameter RepSimParams
,
then the call center must have only 1 period.
Modifier and Type | Class and Description |
---|---|
static class |
TwoStep.WithLog
This subprogram allows the execution of the program
TwoStep and log of the output to a file. |
Modifier and Type | Field and Description |
---|---|
protected StochSolution |
bestSolution
The best stochastic solution found.
|
protected CallCenter |
cc
The call center model.
|
protected int |
currPeriod
The current period to optimize.
|
protected List<CuttingPlaneParams> |
cutpList
The list of cutting-plane parameters, for each scenario.
|
protected int |
numGroups
The number of agent groups.
|
protected int |
numScenarios
The number of scenarios.
|
protected int |
numTypes
The number of call types.
|
protected ScenariosParams |
scenParams
The scenario parameters.
|
protected List<SimParams> |
simpList
The list of simulation parameters, one for each scenario.
|
protected TwoStepParams |
tsParams
The parameters of the Two-step algorithm.
|
Constructor and Description |
---|
TwoStep(TwoStepParams tsParams,
ScenariosParams scenParams,
List<SimParams> simpList,
List<CuttingPlaneParams> cutpList)
Instantiates the Two-step optimization object with the given parameters.
|
Modifier and Type | Method and Description |
---|---|
protected List<? extends CallCenterSim> |
createListSimulator()
Creates a list of simulators for each scenario.
|
StochSolution |
getBestSolution()
Returns the best solution found for the stochastic staffing problem.
|
int |
getStaffingPeriod()
Returns the staffing period to be optimized.
|
TwoStepParams |
getTwoStepParams()
Returns the parameter object
TwoStepParams of this instance. |
protected void |
localSearch(double[] staffCost,
List<? extends CallCenterSim> simList,
int maxCPUSec)
Executes the local search on the best solution.
|
static void |
main(String[] args)
Optimizes the stochastic staffing problem with recourse by a Two-step method.
|
void |
optimize()
Executes the Two-step stochastic staffing optimization.
|
protected List<CuttingPlaneOptimizer> |
optimizeScenarios(int numCPU,
List<? extends CallCenterSim> simList)
Optimizes each scenario individually and returns the list of
CuttingPlaneOptimizer
instance ordered by scenario index. |
protected static CuttingPlaneOptimizer |
optOneScenario(CallCenterSim sim,
CuttingPlaneParams cutParams)
Executes the cutting-plane algorithm
CuttingPlaneOptimizer ,
and not CuttingPlaneOnly , because
only the staffing solution is needed by the stochastic staffing optimizer. |
protected void |
verbosePrint(String s)
Calls the method
System.out.print(s) , where s is the argument,
if the verbose parameter TwoStepParams.verbose is
set to true . |
protected void |
verbosePrintln(String s)
Calls the method
System.out.println(s) , where s is the argument,
if the verbose parameter TwoStepParams.verbose is
set to true . |
protected TwoStepParams tsParams
protected ScenariosParams scenParams
protected List<SimParams> simpList
protected List<CuttingPlaneParams> cutpList
protected CallCenter cc
protected final int numGroups
protected final int numTypes
protected StochSolution bestSolution
protected final int numScenarios
protected final int currPeriod
RepSimParams
, then there must be only 1 period, and
this parameter must be set to 0.
If the user is using BatchSimParams
, then this value is read from
the cutting-plane parameter CuttingPlaneParams.currentPeriod
.public TwoStep(TwoStepParams tsParams, ScenariosParams scenParams, List<SimParams> simpList, List<CuttingPlaneParams> cutpList)
tsParams
- the Two-step optimization parametersscenParams
- the scenario parameters for the stochastic problemsimpList
- the simulator parameters for each scenariocutpList
- the cutting-plane parameters for each scenariopublic TwoStepParams getTwoStepParams()
TwoStepParams
of this instance.public void optimize() throws ilog.concert.IloException
TwoStepParams.useLocalSearch
is
set to true
.ilog.concert.IloException
- if an error occurred with Cplexprotected List<? extends CallCenterSim> createListSimulator()
protected List<CuttingPlaneOptimizer> optimizeScenarios(int numCPU, List<? extends CallCenterSim> simList)
CuttingPlaneOptimizer
instance ordered by scenario index.
This is step-1.numCPU
- the number of CPU to run in parallelsimList
- a list of simulators, one for each scenarioCuttingPlaneOptimizer
instance, ordered by scenario indexprotected static CuttingPlaneOptimizer optOneScenario(CallCenterSim sim, CuttingPlaneParams cutParams) throws Exception
CuttingPlaneOptimizer
,
and not CuttingPlaneOnly
, because
only the staffing solution is needed by the stochastic staffing optimizer.
The user should allow the execution of the local search within CuttingPlaneOptimizer
.
It returns the cutting-plane object used to optimize this scenario.sim
- the call center simulator for this scenariocutParams
- the cutting-plane parameters for this scenarioException
public StochSolution getBestSolution()
IllegalStateException
- if the optimization has not been executedprotected void localSearch(double[] staffCost, List<? extends CallCenterSim> simList, int maxCPUSec)
staffCost
- the cost vector of the staffing (no recourse)simList
- the list of simulators, one for each scenariomaxCPUSec
- the maximum CPU time allocated for the local searchprotected void verbosePrint(String s)
System.out.print(s)
, where s
is the argument,
if the verbose parameter TwoStepParams.verbose
is
set to true
.s
- the string to printprotected void verbosePrintln(String s)
System.out.println(s)
, where s
is the argument,
if the verbose parameter TwoStepParams.verbose
is
set to true
.s
- the string to printpublic int getStaffingPeriod()
public static void main(String[] args) throws Exception
args
- see the descriptionException