Class Solvers
Solvers class acts as a unified entry point for running different optimization
algorithms within the Decision Diagram Optimization (DDO) framework.
It provides static methods to solve problems using various strategies:
- DDO (Decision Diagram Optimization) — Builds restricted or relaxed decision diagrams layer by layer 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 A* algorithm that progressively refines 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<int[], 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<int[], 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<int[], 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<int[], 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.static <T> SolutionminimizeAwAStar(AwAstarModel<T> model, BiConsumer<int[], 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<int[], SearchStatistics> onSolution) Core method for solving a model with the Anytime Weighted A* search algorithm, with 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<int[], 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<int[], SearchStatistics> onSolution) Core method for solving a DDO model with a custom stop condition and a solution callback.static <T> SolutionminimizeExact(ExactModel<T> model) Solves the given model using the Exact DDO algorithm.static <T> SolutionminimizeExact(ExactModel<T> model, BiConsumer<int[], SearchStatistics> onSolution) Core method for solving an DDO model with solution callback.static <T> SolutionminimizeLns(LnsModel<T> model) Runs a Large Neighborhood Search (LNS) on the specified model without any termination condition and without processing intermediate solutions.static <T> SolutionminimizeLns(LnsModel<T> model, Predicate<SearchStatistics> limit) Runs a Large Neighborhood Search (LNS) on the specified model with a termination condition but without processing intermediate solutions.static <T> SolutionminimizeLns(LnsModel<T> model, Predicate<SearchStatistics> limit, BiConsumer<int[], SearchStatistics> onSolution) Runs a Large Neighborhood Search (LNS) on the specified model with a given termination condition and a callback for each solution found.static <T> SolutionrelaxedDdo(DdoModel<T> model) Solves the given model by compiling a single relaxed decision diagram, with default stopping criteria and no solution callback.static <T> SolutionrelaxedDdo(DdoModel<T> model, BiConsumer<int[], SearchStatistics> onSolution) Solves the given model by compiling a single relaxed decision diagram and triggers a callback each time a new incumbent solution is found.static <T> SolutionrelaxedDdo(DdoModel<T> model, Predicate<SearchStatistics> limit) Solves the given model by compiling a single relaxed decision diagram, stopping when the provided limit condition becomes true.static <T> SolutionrelaxedDdo(DdoModel<T> model, Predicate<SearchStatistics> limit, BiConsumer<int[], SearchStatistics> onSolution) Core method for solving a model by compiling a single relaxed decision diagram, with a custom stop condition and a solution callback.static <T> SolutionrestrictedDdo(DdoModel<T> model) Solves the given model by compiling a single restricted decision diagram, with default stopping criteria and no solution callback.static <T> SolutionrestrictedDdo(DdoModel<T> model, BiConsumer<int[], SearchStatistics> onSolution) Solves the given model by compiling a single restricted decision diagram and triggers a callback each time a new incumbent solution is found.static <T> SolutionrestrictedDdo(DdoModel<T> model, Predicate<SearchStatistics> limit) Solves the given model by compiling a single restricted decision diagram, stopping when the provided limit condition becomes true.static <T> SolutionrestrictedDdo(DdoModel<T> model, Predicate<SearchStatistics> limit, BiConsumer<int[], SearchStatistics> onSolution) Core method for solving a model by compiling a single restricted decision diagram, 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<int[], 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 solver's performance
-
minimizeDdo
public static <T> Solution minimizeDdo(DdoModel<T> model, Predicate<SearchStatistics> limit, BiConsumer<int[], 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
SequentialSolver.- 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 solver's performance
-
relaxedDdo
Solves the given model by compiling a single relaxed decision diagram, with default stopping criteria and no solution callback.This is mainly used internally and for testing the lower bound produced by a relaxation.
- 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
-
relaxedDdo
Solves the given model by compiling a single relaxed decision diagram, 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- Returns:
- a solution to the related problem with search statistics summarizing the solver's performance
-
relaxedDdo
public static <T> Solution relaxedDdo(DdoModel<T> model, BiConsumer<int[], SearchStatistics> onSolution) Solves the given model by compiling a single relaxed decision diagram 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
-
relaxedDdo
public static <T> Solution relaxedDdo(DdoModel<T> model, Predicate<SearchStatistics> limit, BiConsumer<int[], SearchStatistics> onSolution) Core method for solving a model by compiling a single relaxed decision diagram, with a custom stop condition and a solution callback.This is mainly used internally and for testing the lower bound produced by a relaxation.
- 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
-
restrictedDdo
Solves the given model by compiling a single restricted decision diagram, with default stopping criteria and no solution callback.This is mainly used internally and for testing purposes.
- 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
-
restrictedDdo
Solves the given model by compiling a single restricted decision diagram, 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- Returns:
- a solution to the related problem with search statistics summarizing the solver's performance
-
restrictedDdo
public static <T> Solution restrictedDdo(DdoModel<T> model, BiConsumer<int[], SearchStatistics> onSolution) Solves the given model by compiling a single restricted decision diagram 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
-
restrictedDdo
public static <T> Solution restrictedDdo(DdoModel<T> model, Predicate<SearchStatistics> limit, BiConsumer<int[], SearchStatistics> onSolution) Core method for solving a model by compiling a single restricted decision diagram, with a custom stop condition and a solution callback.This is mainly used internally and for testing purposes.
- 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 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 solver's performance
-
minimizeAstar
public static <T> Solution minimizeAstar(Model<T> model, BiConsumer<int[], 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 solver's performance
-
minimizeAstar
public static <T> Solution minimizeAstar(Model<T> model, Predicate<SearchStatistics> limit, BiConsumer<int[], SearchStatistics> onSolution) Core method for solving a model with the A* search algorithm, with custom limit and callback.- 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 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 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 solver's performance
-
minimizeAcs
public static <T> Solution minimizeAcs(AcsModel<T> model, BiConsumer<int[], 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 solver's performance
-
minimizeAcs
public static <T> Solution minimizeAcs(AcsModel<T> model, Predicate<SearchStatistics> limit, BiConsumer<int[], SearchStatistics> onSolution) Core method for solving an ACS model with custom stopping condition and solution callback.The method configures and delegates the solving process 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 solver's performance
-
minimizeAwAStar
public static <T> Solution minimizeAwAStar(AwAstarModel<T> model, Predicate<SearchStatistics> limit, BiConsumer<int[], SearchStatistics> onSolution) Core method for solving a model with the Anytime Weighted A* search algorithm, with custom limit and callback.- 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 solver's performance
-
minimizeAwAStar
Solves the given model using the Anytime Weighted A* (AWA*) algorithm.- 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 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 solver's performance
-
minimizeAwAStar
public static <T> Solution minimizeAwAStar(AwAstarModel<T> model, BiConsumer<int[], 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 solver's performance
-
minimizeExact
Solves the given model using the Exact DDO algorithm.Warning: Using only exact MDDs can consume a significant amount of memory. It is recommended to use this solver for small instances or for testing your model. For larger instances or more advanced strategies, consider using
minimizeDdo(DdoModel).- 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 solver's performance
-
minimizeExact
public static <T> Solution minimizeExact(ExactModel<T> model, BiConsumer<int[], SearchStatistics> onSolution) Core method for solving an DDO model with solution callback.The method configures and delegates the solving process to an
ExactSolver.Warning: Using only exact MDDs can consume a significant amount of memory. It is recommended to use this solver for small instances or for testing your model. For larger instances or more advanced strategies, consider using
minimizeDdo(DdoModel, Predicate, BiConsumer))}.- Type Parameters:
T- the type of the state- Parameters:
model- the DDO model to solveonSolution- callback invoked when new incumbent solutions are found- Returns:
- a solution to the related problem with search statistics summarizing solver's performance
-
minimizeLns
public static <T> Solution minimizeLns(LnsModel<T> model, Predicate<SearchStatistics> limit, BiConsumer<int[], SearchStatistics> onSolution) Runs a Large Neighborhood Search (LNS) on the specified model with a given termination condition and a callback for each solution found.- Type Parameters:
T- the type of state used in the problem- Parameters:
model- theLnsModeldescribing the problem and search heuristicslimit- aPredicateonSearchStatisticsdefining when to stop the search The search stops whenlimit.test(stat)returnstrue.onSolution- aBiConsumercalled each time a new solution is found The first argument is the solution (array of variable assignments), and the second argument is the current search statistics.- Returns:
- the best
Solutionfound during the search
-
minimizeLns
Runs a Large Neighborhood Search (LNS) on the specified model without any termination condition and without processing intermediate solutions.Equivalent to calling
minimizeLns(LnsModel, Predicate, BiConsumer)withlimitalways false and an empty callback. -
minimizeLns
Runs a Large Neighborhood Search (LNS) on the specified model with a termination condition but without processing intermediate solutions.Equivalent to calling
minimizeLns(LnsModel, Predicate, BiConsumer)with the givenlimitand an empty callback.- Type Parameters:
T- the type of state used in the problem- Parameters:
model- theLnsModeldescribing the problem and search heuristicslimit- aPredicateonSearchStatisticsdefining when to stop the search- Returns:
- the best
Solutionfound during the search
-