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
-
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
FieldsModifier and TypeFieldDescriptionprivate Access1D
<?> The latest found integer solution.private final double[]
Try to keep track of how different values of integer variables relates to the objective function value.private static final NumberContext
Fields inherited from class org.ojalgo.optimisation.integer.ModelStrategy
cutting
Fields inherited from interface org.ojalgo.optimisation.integer.IntegerStrategy
DEFAULT
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
addSignificance
(int idx, double significance) protected ModelStrategy
initialise
(MultiaryFunction.TwiceDifferentiable<Double> function, Access1D<?> point) Initialise the integer significances, based on the objective function gradient.protected boolean
isCutRatherThanBranch
(double displacement, boolean found) protected boolean
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 Details
-
ROUGHLY
-
myIterationPoint
The latest found integer solution. -
mySignificances
private final double[] mySignificancesTry to keep track of how different values of integer variables relates to the objective function value.
-
-
Constructor Details
-
DefaultStrategy
DefaultStrategy(ExpressionsBasedModel model, IntegerStrategy strategy)
-
-
Method Details
-
addSignificance
private void addSignificance(int idx, double significance) -
initialise
protected ModelStrategy initialise(MultiaryFunction.TwiceDifferentiable<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
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
Description copied from class:ModelStrategy
Called everytime a node/subproblem is found to be infeasible- Specified by:
markInfeasible
in classModelStrategy
-
markInteger
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:
-