Module ojalgo

Class ModelStrategy

    • Field Detail

      • myIndices

        private final int[] myIndices
        One entry per integer variable, the entry is the global index of that integer variable
      • myWorkerPriorities

        private final java.util.List<java.util.Comparator<NodeKey>> myWorkerPriorities
      • cutting

        protected boolean cutting
        Indicates if cut generation is turned on, or not. On by default. Algorithms can turn off when/if no longer useful.
    • Method Detail

      • getGapTolerance

        public NumberContext getGapTolerance()
        Description copied from interface: IntegerStrategy
        The MIP gap is the difference between the best integer solution found so far and a node's relaxed non-integer solution. The relative MIP gap is that difference divided by the optimal value (approximated by the currently best integer solution). If the gap (absolute or relative) is too small, then the corresponding branch is terminated as it is deemed unlikely or too "expensive" to find better integer solutions there.
        Specified by:
        getGapTolerance in interface IntegerStrategy
        Returns:
        The tolerance context used to determine if the gap is too small or not
      • getWorkerPriorities

        public java.util.List<java.util.Comparator<NodeKey>> getWorkerPriorities()
        Description copied from interface: IntegerStrategy
        There will be 1 worker thread per item in the returned List. The Comparator instances need not be unique. Used to prioritise among the nodes waiting to be evaluated.
        Specified by:
        getWorkerPriorities in interface IntegerStrategy
      • toString

        public final java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • countIntegerVariables

        protected int countIntegerVariables()
      • getIndex

        protected int getIndex​(int idx)
      • isCutRatherThanBranch

        protected abstract boolean isCutRatherThanBranch​(NodeKey nodeKey,
                                                         int branchIntegerIndex,
                                                         double variableValue,
                                                         double nodeValue,
                                                         Optimisation.Result bestResultSoFar)
        Decide if cuts should be attempted at this node.
      • isGoodEnough

        protected boolean isGoodEnough​(Optimisation.Result bestResultSoFar,
                                       double relaxedNodeValue)
      • markInfeasible

        protected abstract void markInfeasible​(NodeKey key,
                                               boolean found,
                                               double incumbentValue)
      • onCutFailure

        protected abstract void onCutFailure()
        Called when cut generation produced no cuts (default: disable further cutting).
      • onCutSuccess

        protected abstract void onCutSuccess​(NodeKey nodeKey)
        Called when cut generation added at least one cut (default: no-op).
      • onNodeSolved

        protected abstract void onNodeSolved​(NodeKey key,
                                             Optimisation.Result child,
                                             double childObj,
                                             boolean minimisation)
        Hook to update pseudo-costs after a node is solved.
      • scoreBranch

        protected abstract double scoreBranch​(int idx,
                                              double distanceDown,
                                              double distanceUp,
                                              boolean found)
      • scoreBranchDown

        protected abstract double scoreBranchDown​(int idx,
                                                  double distanceDown,
                                                  boolean found)
      • scoreBranchUp

        protected abstract double scoreBranchUp​(int idx,
                                                double distanceUp,
                                                boolean found)
      • isMinimisation

        boolean isMinimisation()