- java.lang.Object
-
- org.ojalgo.optimisation.Presolvers
-
public abstract class Presolvers extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static ExpressionsBasedModel.PresolverINTEGERprivate static NumberContextLEVELstatic ExpressionsBasedModel.PresolverLINEAR_OBJECTIVEIf the expression is linear and contributes to the objective function, then the contributions are transferred to the variables and the weight of the expression set to null.(package private) static java.math.MathContextLOWERstatic ExpressionsBasedModel.PresolverREDUNDANT_CONSTRAINTCalculates the min and max value of this expression based on the variables' individual bounds.private static java.math.MathContextSIMILARITYstatic ExpressionsBasedModel.VariableAnalyserUNREFERENCEDVerifies that the variable is actually referenced/used in some expression.(package private) static java.math.MathContextUPPERstatic ExpressionsBasedModel.PresolverZERO_ONE_TWOLooks for constraint expressions with 0, 1 or 2 non-fixed variables.
-
Constructor Summary
Constructors Constructor Description Presolvers()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcheckFeasibility(Expression expression, java.util.Set<Structure1D.IntIndex> remaining, java.math.BigDecimal lower, java.math.BigDecimal upper, NumberContext precision, boolean relaxed)static booleancheckSimilarity(java.util.Collection<Expression> current, Expression potential)Checks if the potentialExpressionis similar to any in the current collection.(package private) static booleandoCase0(Expression expression, java.util.Set<Structure1D.IntIndex> remaining, java.math.BigDecimal lower, java.math.BigDecimal upper, NumberContext precision)This constraint expression has 0 remaining free variable.(package private) static booleandoCase1(Expression expression, java.util.Set<Structure1D.IntIndex> remaining, java.math.BigDecimal lower, java.math.BigDecimal upper, NumberContext precision)This constraint expression has 1 remaining free variable.(package private) static booleandoCase2(Expression expression, java.util.Set<Structure1D.IntIndex> remaining, java.math.BigDecimal lower, java.math.BigDecimal upper, NumberContext precision)Checks if bounds on either of the variables (together with the expressions's bounds) implies tighter bounds on the other variable.(package private) static booleandoCaseN(Expression expression, java.util.Set<Structure1D.IntIndex> remaining, java.math.BigDecimal lower, java.math.BigDecimal upper, NumberContext precision)Checks the sign of the limits and the sign of the expression parameters to deduce variables that in fact can only be zero.(package private) static java.math.BigDecimalfindCommonLevel(java.math.BigDecimal a, java.math.BigDecimal b)static booleanreduce(java.util.Collection<Expression> expressions)
-
-
-
Field Detail
-
INTEGER
public static final ExpressionsBasedModel.Presolver INTEGER
-
LINEAR_OBJECTIVE
public static final ExpressionsBasedModel.Presolver LINEAR_OBJECTIVE
If the expression is linear and contributes to the objective function, then the contributions are transferred to the variables and the weight of the expression set to null.
-
REDUNDANT_CONSTRAINT
public static final ExpressionsBasedModel.Presolver REDUNDANT_CONSTRAINT
Calculates the min and max value of this expression based on the variables' individual bounds. Then compares those with the expression's bounds.
-
UNREFERENCED
public static final ExpressionsBasedModel.VariableAnalyser UNREFERENCED
Verifies that the variable is actually referenced/used in some expression. If not then that variable can either be fixed or marked as unbounded.2019-02-15: Turned this off. Very slow for large models 2019-02-22: Turned this on again, different implementation
-
ZERO_ONE_TWO
public static final ExpressionsBasedModel.Presolver ZERO_ONE_TWO
Looks for constraint expressions with 0, 1 or 2 non-fixed variables. Transfers the constraints of the expressions to the variables and then (if possible) marks the expression as redundant.
-
LEVEL
private static final NumberContext LEVEL
-
SIMILARITY
private static final java.math.MathContext SIMILARITY
-
LOWER
static final java.math.MathContext LOWER
-
UPPER
static final java.math.MathContext UPPER
-
-
Method Detail
-
checkFeasibility
public static void checkFeasibility(Expression expression, java.util.Set<Structure1D.IntIndex> remaining, java.math.BigDecimal lower, java.math.BigDecimal upper, NumberContext precision, boolean relaxed)
-
checkSimilarity
public static boolean checkSimilarity(java.util.Collection<Expression> current, Expression potential)
Checks if the potentialExpressionis similar to any in the current collection. Only works for linear expressions. If the potential expression to check has any quadratic term, nothing more is checked, and false is returned.- Returns:
- true, if the potential
Expressionis found to be similar and marked as redundant by this method.
-
reduce
public static boolean reduce(java.util.Collection<Expression> expressions)
-
doCase0
static boolean doCase0(Expression expression, java.util.Set<Structure1D.IntIndex> remaining, java.math.BigDecimal lower, java.math.BigDecimal upper, NumberContext precision)
This constraint expression has 0 remaining free variable. It is entirely redundant.
-
doCase1
static boolean doCase1(Expression expression, java.util.Set<Structure1D.IntIndex> remaining, java.math.BigDecimal lower, java.math.BigDecimal upper, NumberContext precision)
This constraint expression has 1 remaining free variable. The lower/upper limits can be transferred to that variable, and the expression marked as redundant.
-
doCase2
static boolean doCase2(Expression expression, java.util.Set<Structure1D.IntIndex> remaining, java.math.BigDecimal lower, java.math.BigDecimal upper, NumberContext precision)
Checks if bounds on either of the variables (together with the expressions's bounds) implies tighter bounds on the other variable.
-
doCaseN
static boolean doCaseN(Expression expression, java.util.Set<Structure1D.IntIndex> remaining, java.math.BigDecimal lower, java.math.BigDecimal upper, NumberContext precision)
Checks the sign of the limits and the sign of the expression parameters to deduce variables that in fact can only be zero.
-
findCommonLevel
static java.math.BigDecimal findCommonLevel(java.math.BigDecimal a, java.math.BigDecimal b)
-
-