Class AwAstarSolver<T>
java.lang.Object
org.ddolib.layered.solving.awastar.core.solver.AwAstarSolver<T>
- Type Parameters:
T- the type of states in a problem
- All Implemented Interfaces:
Solver
Implementation of an Anytime Weighted A* search (AWA*) solver for decision diagram-based
optimization problems.
The solver uses a combination of a lower bound, dominance rules to explore the search space efficiently. It adds a weight to the heuristic function of the A* algorithm. This weight speed-up reaching feasible solution.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionAwAstarSolver(AwAstarModel<T> model) Constructs a solver via aAwAstarModel. -
Method Summary
Modifier and TypeMethodDescriptionReturns the set of decisions that lead to the best solution found by this solver, if any.Returns the value of the best solution found so far by this solver, if any.minimize(Predicate<SearchStatistics> limit, BiConsumer<int[], SearchStatistics> onSolution) Minimizes the objective function according to the solver strategy.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.ddolib.layered.solver.Solver
constructSolution
-
Constructor Details
-
AwAstarSolver
Constructs a solver via aAwAstarModel.- Parameters:
model- provides all parameters needed to configure the solver- Throws:
IllegalArgumentException- if the weight associated to the heuristic function is < 1
-
-
Method Details
-
minimize
public Solution minimize(Predicate<SearchStatistics> limit, BiConsumer<int[], SearchStatistics> onSolution) Minimizes the objective function according to the solver strategy.When the memory runs out, either because the JVM throws an
OutOfMemoryErroror because the frontier reaches the size given toStopCriterion.maxFrontierSize(int), the search stops and returns the best solution found so far with the statusSearchStatus.MEMOUT.- Specified by:
minimizein interfaceSolver- Parameters:
limit- aPredicatethat can limit or stop the search based on currentSearchStatisticsonSolution- aBiConsumerinvoked on each new solution found; receives the solution array and current statistics- Returns:
- the statistics of the search after completion
-
bestValue
Description copied from interface:SolverReturns the value of the best solution found so far by this solver, if any. -
bestSolution
Description copied from interface:SolverReturns the set of decisions that lead to the best solution found by this solver, if any.- Specified by:
bestSolutionin interfaceSolver- Returns:
- an
Optionalcontaining the set ofDecisionobjects representing the best solution, or empty if no solution exists
-