public class StochSolution extends Object implements Comparable<StochSolution>
The scenario index starts at 0, and the number of scenarios is taken from the length of the recourse matrix.
Constructor and Description |
---|
StochSolution(int[] staffing,
int[][] rPlus,
int[][] rMinus,
double cost)
Constructs the instance that will holds the solution.
|
StochSolution(int[] staffing,
int[][] rPlus,
int[][] rMinus,
double cost,
List<Integer> coveredScenarios)
Constructs the instance that will holds the solution.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(StochSolution s)
Executes a natural ordering (ascending order) based on the cost of the solution.
|
double |
getCost()
Returns the cost of this stochastic staffing with recourse solution.
|
List<Integer> |
getCoveredScenarios()
Returns the list that contains the scenarios that are explicitly covered by
this stochastic solution.
|
int[] |
getEffectiveStaffing(int scenario)
Returns the effective staffing of the selected scenario number (index starting at 0).
|
List<Integer> |
getNonCoveredScenarios()
Returns the list that contains the scenarios that are not covered by the
stochastic solution.
|
int |
getNumGroups()
Returns the number of agent groups.
|
int |
getNumScenarios()
Returns the number of scenarios.
|
int[][] |
getRMinus()
Returns the recourse solution of removing agents, with indices
[group][scenario] . |
int[][] |
getRPlus()
Returns the recourse solution of adding agents, with indices
[group][scenario] . |
int[] |
getStaffing()
Returns the staffing vector (the non-recourse variables).
|
static StochSolution |
newInstance(StochSolution sol)
Duplicates this instance.
|
String |
toString()
Returns the solution in a String form.
|
public StochSolution(int[] staffing, int[][] rPlus, int[][] rMinus, double cost)
staffing
- the staffing solution with index [group]
rPlus
- the recourse of adding agents with indices [group][scenario]
rMinus
- the recourse of removing agents with indices [group][scenario]
cost
- the cost of this solutionpublic StochSolution(int[] staffing, int[][] rPlus, int[][] rMinus, double cost, List<Integer> coveredScenarios)
staffing
- the staffing solution with index [group]
rPlus
- the recourse of adding agents with indices [group][scenario]
rMinus
- the recourse of removing agents with indices [group][scenario]
cost
- the cost of this solutioncoveredScenarios
- a list that contains the indices of the scenarios
that are covered by this solution.
Note that the solution rPlus, rMinus
can have values for the non-covered scenarios.public static StochSolution newInstance(StochSolution sol)
sol
- the solution to duplicatepublic int[] getStaffing()
public int[][] getRPlus()
[group][scenario]
.public int[][] getRMinus()
[group][scenario]
.public double getCost()
public List<Integer> getCoveredScenarios()
public List<Integer> getNonCoveredScenarios()
public int getNumGroups()
public int getNumScenarios()
public int compareTo(StochSolution s)
compareTo
in interface Comparable<StochSolution>
s
- the solution to compare tos
, 1 if this cost
is greater than the cost of s
, and 0 otherwisepublic int[] getEffectiveStaffing(int scenario)
scenario
- the scenario indexpublic String toString()