Class AwAstarSolver<T>

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

public final class AwAstarSolver<T> extends Object implements Solver
Anytime Weighted A* solver implementation for no-layer decision-diagram based optimization models.

The solver behaves like AStarSolver but orders subproblems using a weighted f = g + weight * h value, trading optimality guarantees for the ability to find and progressively refine solutions faster.

  • Constructor Details

    • AwAstarSolver

      public AwAstarSolver(AwAstarModel<T> model)
      Creates a new Anytime Weighted A* solver for the given model.
      Parameters:
      model - the model to solve
  • Method Details

    • minimize

      public Solution minimize(Predicate<SearchStatistics> limit, BiConsumer<List<Integer>,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 List<Integer> bestSolution()
      Description copied from interface: Solver
      Returns the ordered list of labels leading to the best solution from the initial state.
      Specified by:
      bestSolution in interface Solver
      Returns:
      the ordered list of labels leading to the best solution from the initial state