java.lang.Object
org.ddolib.layered.solving.startheuristic.DFS<T>
Type Parameters:
T - the type of state

public final class DFS<T> extends Object
Depth-first start heuristic returning the first feasible solution it encounters.

Its purpose is to quickly provide an upper bound to a complete search algorithm. The children of a node are explored by increasing g + h, where h is given by the model's FastLowerBound, so that the first dive follows the most promising decisions.

Since the search stops at the first solution, every node whose subtree has been fully explored is a dead end. States already explored at the same depth, or dominated (according to the model's DominanceChecker) by an explored state, are therefore skipped.

The returned statistics reuse AstarStats.

  • Constructor Details

    • DFS

      public DFS(Model<T> model)
      Creates the heuristic from a model. Only its problem, fast lower bound and dominance checker are used.
      Parameters:
      model - the model of the problem to solve
  • Method Details

    • findSolution

      public Solution findSolution()
      Searches the first feasible solution without any stopping criterion.
      Returns:
      the first solution found, or an empty solution with status UNSAT if the problem has none
    • findSolution

      public Solution findSolution(Predicate<SearchStatistics> limit)
      Searches the first feasible solution.
      Parameters:
      limit - stopping criterion tested at each iteration
      Returns:
      the first solution found (status SAT), an empty solution with status UNSAT if the problem has none, or an empty solution with status UNKNOWN if the limit was reached first, or an empty solution with status MEMOUT if the memory ran out (see StopCriterion.maxFrontierSize(int))