Module org.maxicp

Interface SearchMethod

All Known Implementing Classes:
AbstractConcurrentSearchMethod, AbstractSearchMethod, BestFirstSearch, ConcurrentDFSearch, DFSearch, RunnableSearchMethod, SymbolicSearchMethod

public interface SearchMethod
  • Method Details

    • onSolution

      void onSolution(Consumer<SearchStatistics> listener)
      Adds a listener that is called on each solution.
      Parameters:
      listener - the closure to be called whenever a solution is found
    • onSolution

      default void onSolution(Runnable listener)
      Adds a listener that is called on each solution.
      Parameters:
      listener - the closure to be called whenever a solution is found
    • onFailure

      void onFailure(Consumer<SearchStatistics> listener)
      Adds a listener that is called whenever a failure occurs and the search backtracks. This happens when a InconsistencyException is thrown when executing the closure generated by the branching.
      Parameters:
      listener - the closure to be called whenever a failure occurs and the search need to backtrack
    • onFailure

      default void onFailure(Runnable listener)
      Adds a listener that is called whenever a failure occurs and the search backtracks. This happens when a InconsistencyException is thrown when executing the closure generated by the branching.
      Parameters:
      listener - the closure to be called whenever a failure occurs and the search need to backtrack
    • solve

      Start the solving process
      Returns:
      an object with the statistics on the search
    • solve

      Start the solving process with a given predicate called at each node to stop the search when it becomes true.
      Parameters:
      limit - a predicate called at each node that stops the search when it becomes true
      Returns:
      an object with the statistics on the search
    • solveSubjectTo

      SearchStatistics solveSubjectTo(Predicate<SearchStatistics> limit, Runnable subjectTo)
      Start the solving process with a given predicate called at each node to stop the search when it becomes true. The state manager saves the state before executing the closure and restores it after the search. Any InconsistencyException that may be throw when executing the closure is also catched.
      Parameters:
      limit - a predicate called at each node that stops the search when it becomes true
      subjectTo - the closure to execute prior to the search starts
      Returns:
      an object with the statistics on the search
    • optimize

      SearchStatistics optimize(Objective obj)
      Start the solving process with a given objective.
      Parameters:
      obj - the objective to optimize that is tightened each time a new solution is found
      Returns:
      an object with the statistics on the search
    • optimize

    • optimize

      SearchStatistics optimize(Objective obj)
    • optimize

      SearchStatistics optimize(Objective toTighten, Predicate<SearchStatistics> limit)
      Start the solving process with a given objective and with a given predicate called at each node to stop the search when it becomes true.
      Parameters:
      toTighten - the objective to optimize that is tightened each time a new solution is found
      limit - a predicate called at each node that stops the search when it becomes true
      Returns:
      an object with the statistics on the search
    • optimizeSubjectTo

      SearchStatistics optimizeSubjectTo(Objective objToTighten, Predicate<SearchStatistics> limit, Runnable subjectTo)
      Executes a closure prior to effectively starting a branch and bound depth first search with a given objective to optimize and a given predicate called at each node to stop the search when it becomes true. The state manager saves the state before executing the closure and restores it after the search. Any InconsistencyException that may be thrown when executing the closure is also catched.
      Parameters:
      objToTighten - the objective to optimize that is tightened each time a new solution is found
      limit - a predicate called at each node that stops the search when it becomes true
      subjectTo - the closure to execute prior to the search starts
      Returns:
      an object with the statistics on the search
    • optimizeSubjectTo

      SearchStatistics optimizeSubjectTo(Objective objToTighten, Predicate<SearchStatistics> limit, Runnable subjectTo)