Package org.ddolib.nolayer.modeling
Class Solvers
java.lang.Object
org.ddolib.nolayer.modeling.Solvers
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 Summary
Modifier and TypeMethodDescriptionstatic <T> SolutionminimizeAcs(AcsModel<T> model) Solves the given model using the Anytime Column Search (ACS) algorithm.static <T> SolutionminimizeAcs(AcsModel<T> model, BiConsumer<List<Integer>, SearchStatistics> onSolution) Solves the given model using ACS and calls the callback when a new incumbent is found.static <T> SolutionminimizeAcs(AcsModel<T> model, Predicate<SearchStatistics> limit) Solves the given model using ACS, stopping when the limit condition is satisfied.static <T> SolutionminimizeAcs(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.static <T> SolutionminimizeAstar(Model<T> model) Solves the given model using the A* search algorithm with default parameters.static <T> SolutionminimizeAstar(Model<T> model, BiConsumer<List<Integer>, SearchStatistics> onSolution) Solves the given model using A* and calls back when new incumbent solutions are found.static <T> SolutionminimizeAstar(Model<T> model, Predicate<SearchStatistics> limit) Solves the given model using A* with a specified stop condition.static <T> SolutionminimizeAstar(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.static <T> SolutionminimizeAwAstar(AwAstarModel<T> model) Solves the given model using the Anytime Weighted A* (AWA*) algorithm with default parameters.static <T> SolutionminimizeAwAstar(AwAstarModel<T> model, BiConsumer<List<Integer>, SearchStatistics> onSolution) Solves the given model using AWA* and calls the callback when a new incumbent is found.static <T> SolutionminimizeAwAstar(AwAstarModel<T> model, Predicate<SearchStatistics> limit) Solves the given model using AWA*, stopping when the limit condition is satisfied.static <T> SolutionminimizeAwAstar(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.static <T> SolutionminimizeDdo(DdoModel<T> model) Solves the given model using the DDO (Decision Diagram Optimization) algorithm with default stopping criteria and no solution callback.static <T> SolutionminimizeDdo(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.static <T> SolutionminimizeDdo(DdoModel<T> model, Predicate<SearchStatistics> limit) Solves the given model using DDO, stopping when the provided limit condition becomes true.static <T> SolutionminimizeDdo(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.
-
Method Details
-
minimizeDdo
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
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 solvelimit- 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 solveonSolution- 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 solvelimit- a predicate defining when the solver should stoponSolution- 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
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
Solves the given model using A* with a specified stop condition.- Type Parameters:
T- the type of the state- Parameters:
model- the model to solvelimit- 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 solveonSolution- 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 solvelimit- stopping condition for the searchonSolution- 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
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
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 solvelimit- 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 solveonSolution- 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 solvelimit- predicate defining the stopping conditiononSolution- callback invoked when new incumbent solutions are found- Returns:
- a solution to the related problem with search statistics summarizing the solver's performance
-
minimizeAwAstar
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 solvelimit- 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 solveonSolution- 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 solvelimit- stopping condition for the searchonSolution- callback invoked when a new best solution is found- Returns:
- a solution to the related problem with search statistics summarizing the solver's performance
-