public class LiftedCoverInequalitySeparator extends Object
The algorithms used to separate violated inequalities are provided in:
Nemhauser, G.L., Wolsey, L.A., Integer and combinatorial optimization. 1999, John Wiley & Sons
Given a knapsack constraint: \sum_i a_i x_i <= b
where x_i
are binary variables, b
a positive integer and a_i
integer coefficients.
Let N
be the set of variables in the knapsack constraint.
For a given assignment of values to the variables, this class computes two types of violated cover inequalities:
\sum_{j\in C} \leq |C|-1
, where C\subseteq N, \sum_{j\in C} a_i >b
\sum_{j\in N\setminus C} \alpha_jx_j + \sum_{j\in C2} \gamma_jx_j + \sum_{j\in C1} x_j \leq |C1|-1+\sum_{j\in C2}\gamma_j
, where
C1 \cap C2= \emptyset
, C1 \cup C2= C
, C
a minimal cover as defined above.C2=\emptyset
. If we can't find such an inequality, we set C2
to:
C2={k}, k=arg max_{j\in C}a_j variableValue[j]
, and C1=C\setminus C2
, and retry.Modifier and Type | Field and Description |
---|---|
static double |
PRECISION
Rounding precision
|
Constructor and Description |
---|
LiftedCoverInequalitySeparator(KnapsackAlgorithm knapsackAlgorithm)
Creates a new separator
|
Modifier and Type | Method and Description |
---|---|
boolean |
coverInequalityExists()
Indicates whether a cover inequality exists, i.e returns whether
\sum_i a_i > b . |
int[] |
getLiftedCoverCoefficients()
Returns an array of alpha coefficients of the lifted cover inequality
|
double |
getLiftedCoverLHS()
Returns evaluation of the LHS of the cover.
|
int |
getLiftedCoverRHS()
Returns the RHS of the lifted cover inequality
|
Set<Integer> |
getMinimalCover()
Returns C: the variables that are in the minimal cover
|
double |
getMinimalCoverLHS()
Returns evaluation of the LHS of the cover.
|
boolean[] |
getMinimalCoverMask()
Returns an boolean array indicating which variables belong to the minimal cover inequality C: x_i <= |C|-1}, i.e.
|
int |
getMinimalCoverRHS()
returns the RHS of the minimal cover inequality
|
boolean |
isLiftedCoverViolated()
Returns true if the lifted cover inequality is violated
|
boolean |
isMinimalCoverViolated()
Returns true if the cover inequality x_i <= |C|-1} is violated
|
void |
separateLiftedCover(int nrVars,
int[] knapsackCoefficients,
int b,
double[] variableValues,
boolean performDownLifting)
Given a knapsack constraint:
\sum_{i=0}^n a_ix_i \leq b This method separates Lifted Cover Inequalities, i.e it will search for a valid lifted cover inequality
\sum_{j\in N\setminus C} \alpha_jx_j + \sum_{j\in C2} \gamma_jx_j + \sum_{j\in C1} x_j \leq |C1|-1+\sum_{j\in C2}\gamma_j which is violated by the current
variable values, where C1 \cap C2= \emptyset, C1 \cup C2= C, C a minimal cover |
void |
separateMinimalCover(int nrVars,
int[] knapsackCoefficients,
int b,
double[] variableValues)
Given a knapsack constraint:
\sum_{i=0}^n a_ix_i \leq b This method separates minimal Cover Inequalities, i.e it will search for a valid cover
\sum_{i\in C} x_i \leq |C|-1 which is violated by the current variable values |
public static final double PRECISION
public LiftedCoverInequalitySeparator(KnapsackAlgorithm knapsackAlgorithm)
knapsackAlgorithm
- This separator requires an algorithm to solve knapsack problemspublic void separateMinimalCover(int nrVars, int[] knapsackCoefficients, int b, double[] variableValues)
\sum_{i=0}^n a_ix_i \leq b
This method separates minimal Cover Inequalities, i.e it will search for a valid cover
\sum_{i\in C} x_i \leq |C|-1
which is violated by the current variable valuesnrVars
- number of variables in the knapsack constraintknapsackCoefficients
- a_ib
- right hand side of the knapsack constraintvariableValues
- values of the x_i variablespublic void separateLiftedCover(int nrVars, int[] knapsackCoefficients, int b, double[] variableValues, boolean performDownLifting)
\sum_{i=0}^n a_ix_i \leq b
This method separates Lifted Cover Inequalities, i.e it will search for a valid lifted cover inequality
\sum_{j\in N\setminus C} \alpha_jx_j + \sum_{j\in C2} \gamma_jx_j + \sum_{j\in C1} x_j \leq |C1|-1+\sum_{j\in C2}\gamma_j
which is violated by the current
variable values, where C1 \cap C2= \emptyset, C1 \cup C2= C, C
a minimal covernrVars
- number of variables in the knapsack constraintknapsackCoefficients
- a_ib
- right hand side of the knapsack constraintvariableValues
- values of the x_i variablesperformDownLifting
- When set to true, additional effort is performed to find a violated Lifted Cover AbstractInequality. When this value is false, C2 will be an empty set.public boolean coverInequalityExists()
\sum_i a_i > b
. You should NOT ask for a minimal or lifted cover if this function returns false!\sum_i a_i > b
. You should NOT ask for a minimal or lifted cover if this function returns false!public Set<Integer> getMinimalCover()
public boolean[] getMinimalCoverMask()
public boolean isMinimalCoverViolated()
public double getMinimalCoverLHS()
LHS>RHS
LHS>RHS
public int getMinimalCoverRHS()
public int[] getLiftedCoverCoefficients()
public double getLiftedCoverLHS()
LHS>RHS
LHS>RHS
public int getLiftedCoverRHS()
public boolean isLiftedCoverViolated()
Copyright © 2016. All rights reserved.