Class AStarSolver<T>

java.lang.Object
org.ddolib.layered.solving.astar.core.solver.AStarSolver<T>
Type Parameters:
T - type of states handled by the model
All Implemented Interfaces:
Solver

public final class AStarSolver<T> extends Object implements Solver
A* solver implementation for decision-diagram based optimization models.

The solver explores subproblems ordered by their f = g + h value, where g is the accumulated cost and h is a fast lower bound on the residual problem. It maintains open/closed sets and updates incumbents whenever a better complete assignment is discovered.

  • Constructor Details

    • AStarSolver

      public AStarSolver(Model<T> model)
      Creates a new A* solver for the given model.
      Parameters:
      model - the model to solve
  • 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 OutOfMemoryError or because the frontier reaches the size given to StopCriterion.maxFrontierSize(int), the search stops and returns the best solution found so far with the status SearchStatus.MEMOUT.

      Specified by:
      minimize in interface Solver
      Parameters:
      limit - a Predicate that can limit or stop the search based on current SearchStatistics
      onSolution - a BiConsumer invoked on each new solution found; receives the solution array and current statistics
      Returns:
      the statistics of the search after completion
    • bestValue

      public Optional<Double> bestValue()
      Description copied from interface: Solver
      Returns the value of the best solution found so far by this solver, if any.
      Specified by:
      bestValue in interface Solver
      Returns:
      the value of the best solution in this decision diagram if there is one
    • bestSolution

      public Optional<Set<Decision>> bestSolution()
      Description copied from interface: Solver
      Returns the set of decisions that lead to the best solution found by this solver, if any.
      Specified by:
      bestSolution in interface Solver
      Returns:
      an Optional containing the set of Decision objects representing the best solution, or empty if no solution exists