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
  • Field Details

    • 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 Details

  • 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 class ModelStrategy
    • isCutRatherThanBranch

      protected boolean isCutRatherThanBranch(double displacement, boolean found)
      Specified by:
      isCutRatherThanBranch in class ModelStrategy
    • 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 class ModelStrategy
      Parameters:
      node - The node to check
      found - 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 class ModelStrategy
    • markInteger

      protected void markInteger(NodeKey key, Optimisation.Result result)
      Update the integer significances, based on new integer solution found.
      Specified by:
      markInteger in class ModelStrategy
    • 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 class ModelStrategy
      Parameters:
      idx - Integer variable index
      displacement - variable's fractional value
      found - 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: