org.optaplanner.core.api.solver.event

## Interface SolverEventListener<Solution_>

- Type Parameters:
    `Solution_` - the solution type, the class with the `PlanningSolution` annotation
  All Superinterfaces:
    EventListener
  Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

      @FunctionalInterface
      public interface SolverEventListener<Solution_>
      extends EventListener

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `bestSolutionChanged(BestSolutionChangedEvent<Solution_> event)` Called once every time when a better `PlanningSolution` is found.

- - ### Method Detail

    - #### bestSolutionChanged

          void bestSolutionChanged(BestSolutionChangedEvent<Solution_> event)

      Called once every time when a better `PlanningSolution` is found. The `PlanningSolution` is guaranteed to be initialized. Early in the solving process it's usually called more frequently than later on.

      Called from the solver thread. Should return fast, because it steals time from the `Solver`.

      In real-time planning If `Solver.addProblemFactChange(ProblemFactChange)` has been called once or more, all `ProblemFactChange`s in the queue will be processed and this method is called only once. In that case, the former best `PlanningSolution` is considered stale, so it doesn't matter whether the new `Score` is better than that or not.

      Parameters:
        `event` - never null

Copyright © 2006–2020 JBoss by Red Hat. All rights reserved.