Package org.ojalgo.optimisation.integer
Class ModelStrategy.DefaultStrategy
- java.lang.Object
-
- org.ojalgo.optimisation.integer.ModelStrategy
-
- org.ojalgo.optimisation.integer.ModelStrategy.DefaultStrategy
-
- All Implemented Interfaces:
IntegerStrategy
- Enclosing class:
- ModelStrategy
static final class ModelStrategy.DefaultStrategy extends ModelStrategy
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.ojalgo.optimisation.integer.ModelStrategy
ModelStrategy.AbstractStrategy, ModelStrategy.DefaultStrategy
-
Nested classes/interfaces inherited from interface org.ojalgo.optimisation.integer.IntegerStrategy
IntegerStrategy.ConfigurableStrategy, IntegerStrategy.GMICutConfiguration
-
-
Field Summary
Fields Modifier and Type Field Description private Access1D<?>
myIterationPoint
The latest found integer solution.private double[]
mySignificances
Try to keep track of how different values of integer variables relates to the objective function value.private static NumberContext
ROUGHLY
-
Fields inherited from class org.ojalgo.optimisation.integer.ModelStrategy
cutting
-
Fields inherited from interface org.ojalgo.optimisation.integer.IntegerStrategy
DEFAULT
-
-
Constructor Summary
Constructors Constructor Description DefaultStrategy(ExpressionsBasedModel model, IntegerStrategy strategy)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
addSignificance(int idx, double significance)
protected ModelStrategy
initialise(MultiaryFunction.TwiceDifferentiable<java.lang.Double> function, Access1D<?> point)
Initialise the integer significances, based on the objective function gradient.protected boolean
isCutRatherThanBranch(double displacement, boolean found)
protected boolean
isDirect(NodeKey node, boolean found)
This method will be called twice when branching – once for each of the new nodes created by branching.protected void
markInfeasible(NodeKey key, boolean found)
Called everytime a node/subproblem is found to be infeasibleprotected void
markInteger(NodeKey key, Optimisation.Result result)
Update the integer significances, based on new integer solution found.protected double
toComparable(int idx, double displacement, boolean found)
If not yet found integer solution then compare the remaining/reversed (larger) fraction, otherwise the fraction scaled by the significance.-
Methods inherited from class org.ojalgo.optimisation.integer.ModelStrategy
countIntegerVariables, getGapTolerance, getGMICutConfiguration, getIndex, getIntegralityTolerance, getWorkerPriorities, isGoodEnough, newModelStrategy, toString
-
-
-
-
Field Detail
-
ROUGHLY
private static final NumberContext ROUGHLY
-
myIterationPoint
private Access1D<?> myIterationPoint
The latest found integer solution.
-
mySignificances
private final double[] mySignificances
Try to keep track of how different values of integer variables relates to the objective function value.
-
-
Constructor Detail
-
DefaultStrategy
DefaultStrategy(ExpressionsBasedModel model, IntegerStrategy strategy)
-
-
Method Detail
-
addSignificance
private void addSignificance(int idx, double significance)
-
initialise
protected ModelStrategy initialise(MultiaryFunction.TwiceDifferentiable<java.lang.Double> function, Access1D<?> point)
Initialise the integer significances, based on the objective function gradient.- Specified by:
initialise
in classModelStrategy
-
isCutRatherThanBranch
protected boolean isCutRatherThanBranch(double displacement, boolean found)
- Specified by:
isCutRatherThanBranch
in classModelStrategy
-
isDirect
protected boolean isDirect(NodeKey node, boolean found)
Description copied from class:ModelStrategy
This method will be called twice when branching – once for each of the new nodes created by branching. In most cases you only want to return true for (at most) one of those new branches. Always returning true for both the new nodes will cause excessive memory consumption.- Specified by:
isDirect
in classModelStrategy
- Parameters:
node
- The node to checkfound
- Is an integer solution already found?- Returns:
- true if this node should be evaluated directly (not deferred)
-
markInfeasible
protected void markInfeasible(NodeKey key, boolean found)
Description copied from class:ModelStrategy
Called everytime a node/subproblem is found to be infeasible- Specified by:
markInfeasible
in classModelStrategy
-
markInteger
protected void markInteger(NodeKey key, Optimisation.Result result)
Update the integer significances, based on new integer solution found.- Specified by:
markInteger
in classModelStrategy
-
toComparable
protected double toComparable(int idx, double displacement, boolean found)
If not yet found integer solution then compare the remaining/reversed (larger) fraction, otherwise the fraction scaled by the significance.- Specified by:
toComparable
in classModelStrategy
- Parameters:
idx
- Integer variable indexdisplacement
- variable's fractional valuefound
- Is an integer solution already found?- Returns:
- Value used to compare variables when determining which to branch on. Larger value means more likelyn to branch on this.
- See Also:
ModelStrategy.toComparable(int, double, boolean)
-
-