Class Solvers

java.lang.Object
org.ddolib.nolayer.modeling.Solvers

public class Solvers extends Object
The Solvers class acts as a unified entry point for running different optimization algorithms within the no-layer Decision Diagram Optimization (DDO) framework.

Unlike Solvers, the problems solved here don't require a fixed, known number of variables up front: termination is detected via Problem.isTarget(Object) instead. It provides static methods to solve problems using various strategies:

  • DDO (Decision Diagram Optimization) — Builds restricted or relaxed decision diagrams to approximate or find exact solutions.
  • A* — Uses a best-first search guided by an admissible lower bound heuristic to guarantee optimality.
  • ACS (Anytime Column Search) — An iterative improvement algorithm that progressively refines solutions over time using bounded-width decision diagrams.
  • Anytime Weighted A* — A variant of the A* algorithm that progressively refines a solution using a weighted heuristic function.
See Also:
  • Method Details

    • minimizeDdo

      public static <T> Solution minimizeDdo(DdoModel<T> model)
      Solves the given model using the DDO (Decision Diagram Optimization) algorithm with default stopping criteria and no solution callback.
      Type Parameters:
      T - the type of the state
      Parameters:
      model - the DDO model to solve
      Returns:
      a solution to the related problem with search statistics summarizing the solver's performance
    • minimizeDdo

      public static <T> Solution minimizeDdo(DdoModel<T> model, Predicate<SearchStatistics> limit)
      Solves the given model using DDO, stopping when the provided limit condition becomes true.
      Type Parameters:
      T - the type of the state
      Parameters:
      model - the DDO model to solve
      limit - a predicate defining the stopping criterion (e.g., max iterations, time limit)
      Returns:
      a solution to the related problem with search statistics summarizing the solver's performance
    • minimizeDdo

      public static <T> Solution minimizeDdo(DdoModel<T> model, BiConsumer<List<Integer>,SearchStatistics> onSolution)
      Solves the given model using DDO and triggers a callback each time a new incumbent solution is found.
      Type Parameters:
      T - the type of the state
      Parameters:
      model - the DDO model to solve
      onSolution - callback executed when a new best solution is discovered
      Returns:
      a solution to the related problem with search statistics summarizing the solver's performance
    • minimizeDdo

      public static <T> Solution minimizeDdo(DdoModel<T> model, Predicate<SearchStatistics> limit, BiConsumer<List<Integer>,SearchStatistics> onSolution)
      Core method for solving a DDO model with a custom stop condition and a solution callback.

      It automatically builds the solver configuration from the given model and delegates the actual solving to a DdoSolver.

      Type Parameters:
      T - the type of the state
      Parameters:
      model - the DDO model to solve
      limit - a predicate defining when the solver should stop
      onSolution - a callback invoked whenever a new best solution is found
      Returns:
      a solution to the related problem with search statistics summarizing the solver's performance
    • minimizeAstar

      public static <T> Solution minimizeAstar(Model<T> model)
      Solves the given model using the A* search algorithm with default parameters.
      Type Parameters:
      T - the type of the state
      Parameters:
      model - the model to solve
      Returns:
      a solution to the related problem with search statistics summarizing the solver's performance
    • minimizeAstar

      public static <T> Solution minimizeAstar(Model<T> model, Predicate<SearchStatistics> limit)
      Solves the given model using A* with a specified stop condition.
      Type Parameters:
      T - the type of the state
      Parameters:
      model - the model to solve
      limit - predicate defining the termination condition
      Returns:
      a solution to the related problem with search statistics summarizing the solver's performance
    • minimizeAstar

      public static <T> Solution minimizeAstar(Model<T> model, BiConsumer<List<Integer>,SearchStatistics> onSolution)
      Solves the given model using A* and calls back when new incumbent solutions are found.
      Type Parameters:
      T - the type of the state
      Parameters:
      model - the model to solve
      onSolution - callback triggered for each new best solution
      Returns:
      a solution to the related problem with search statistics summarizing the solver's performance
    • minimizeAstar

      public static <T> Solution minimizeAstar(Model<T> model, Predicate<SearchStatistics> limit, BiConsumer<List<Integer>,SearchStatistics> onSolution)
      Core method for solving a model with the A* search algorithm, with custom limit and callback.

      It automatically builds the solver configuration from the given model and delegates the actual solving to an AStarSolver.

      Type Parameters:
      T - the type of the state
      Parameters:
      model - the model to solve
      limit - stopping condition for the search
      onSolution - callback invoked when a new best solution is found
      Returns:
      a solution to the related problem with search statistics summarizing the solver's performance
    • minimizeAcs

      public static <T> Solution minimizeAcs(AcsModel<T> model)
      Solves the given model using the Anytime Column Search (ACS) algorithm.
      Type Parameters:
      T - the type of the state
      Parameters:
      model - the ACS model to solve
      Returns:
      a solution to the related problem with search statistics summarizing the solver's performance
    • minimizeAcs

      public static <T> Solution minimizeAcs(AcsModel<T> model, Predicate<SearchStatistics> limit)
      Solves the given model using ACS, stopping when the limit condition is satisfied.
      Type Parameters:
      T - the type of the state
      Parameters:
      model - the ACS model to solve
      limit - predicate defining the stopping criterion
      Returns:
      a solution to the related problem with search statistics summarizing the solver's performance
    • minimizeAcs

      public static <T> Solution minimizeAcs(AcsModel<T> model, BiConsumer<List<Integer>,SearchStatistics> onSolution)
      Solves the given model using ACS and calls the callback when a new incumbent is found.
      Type Parameters:
      T - the type of the state
      Parameters:
      model - the ACS model to solve
      onSolution - callback executed on discovery of a new best solution
      Returns:
      a solution to the related problem with search statistics summarizing the solver's performance
    • minimizeAcs

      public static <T> Solution minimizeAcs(AcsModel<T> model, Predicate<SearchStatistics> limit, BiConsumer<List<Integer>,SearchStatistics> onSolution)
      Core method for solving an ACS model with custom stopping condition and solution callback.

      It automatically builds the solver configuration from the given model and delegates the actual solving to an AcsSolver.

      Type Parameters:
      T - the type of the state
      Parameters:
      model - the ACS model to solve
      limit - predicate defining the stopping condition
      onSolution - callback invoked when new incumbent solutions are found
      Returns:
      a solution to the related problem with search statistics summarizing the solver's performance
    • minimizeAwAstar

      public static <T> Solution minimizeAwAstar(AwAstarModel<T> model)
      Solves the given model using the Anytime Weighted A* (AWA*) algorithm with default parameters.
      Type Parameters:
      T - the type of the state
      Parameters:
      model - the AWA* model to solve
      Returns:
      a solution to the related problem with search statistics summarizing the solver's performance
    • minimizeAwAstar

      public static <T> Solution minimizeAwAstar(AwAstarModel<T> model, Predicate<SearchStatistics> limit)
      Solves the given model using AWA*, stopping when the limit condition is satisfied.
      Type Parameters:
      T - the type of the state
      Parameters:
      model - the AWA* model to solve
      limit - predicate defining the stopping criterion
      Returns:
      a solution to the related problem with search statistics summarizing the solver's performance
    • minimizeAwAstar

      public static <T> Solution minimizeAwAstar(AwAstarModel<T> model, BiConsumer<List<Integer>,SearchStatistics> onSolution)
      Solves the given model using AWA* and calls the callback when a new incumbent is found.
      Type Parameters:
      T - the type of the state
      Parameters:
      model - the AWA* model to solve
      onSolution - callback executed on discovery of a new best solution
      Returns:
      a solution to the related problem with search statistics summarizing the solver's performance
    • minimizeAwAstar

      public static <T> Solution minimizeAwAstar(AwAstarModel<T> model, Predicate<SearchStatistics> limit, BiConsumer<List<Integer>,SearchStatistics> onSolution)
      Core method for solving a model with the Anytime Weighted A* search algorithm, with a custom limit and callback.

      It automatically builds the solver configuration from the given model and delegates the actual solving to an AwAstarSolver.

      Type Parameters:
      T - the type of the state
      Parameters:
      model - the AWA* model to solve
      limit - stopping condition for the search
      onSolution - callback invoked when a new best solution is found
      Returns:
      a solution to the related problem with search statistics summarizing the solver's performance