Class FindAndProve<V extends Variable>

  • Type Parameters:
    V -

    public class FindAndProve<V extends Variable>
    extends AbstractStrategy<V>
    Enables to switch from one heuristic to another once a solution has been found
    Since:
    07/11/13
    Author:
    Jean-Guillaume Fages
    • Constructor Detail

      • FindAndProve

        public FindAndProve​(V[] vars,
                            AbstractStrategy<V> heurToFindASol,
                            AbstractStrategy<V> heurToProveOpt)
        Heuristic which switches from one heuristic (heurToFindASol) to another (heurToProveOpt) once a solution has been found
        Parameters:
        vars - variables to branch on
        heurToFindASol - a heuristic to branch on vars, to find a (good) solution easily
        heurToProveOpt - a heuristic to branch on vars, to prove the optimality of the solution
    • Method Detail

      • init

        public boolean init()
        Description copied from class: AbstractStrategy
        Prepare this to be used in a search loop The initialization can detect inconsistency, in that case, it returns false
        Overrides:
        init in class AbstractStrategy<V extends Variable>
      • getDecision

        public Decision<V> getDecision()
        Description copied from class: AbstractStrategy
        Provides access to the current decision in the strategy. If there are no more decision to provide, it returns null.
        Specified by:
        getDecision in class AbstractStrategy<V extends Variable>
        Returns:
        the current decision
      • computeDecision

        public Decision<V> computeDecision​(V variable)
        Description copied from class: AbstractStrategy
        Computes a decision to be applied to variable var This method should be implemented in order to use search patterns
        Overrides:
        computeDecision in class AbstractStrategy<V extends Variable>
        Parameters:
        variable - a variable
        Returns:
        a decision to be applied to variable var