Class BestSolutionChangedEvent<Solution_>
java.lang.Object
java.util.EventObject
org.optaplanner.core.api.solver.event.BestSolutionChangedEvent<Solution_>
- Type Parameters:
 Solution_- the solution type, the class with thePlanningSolutionannotation
- All Implemented Interfaces:
 Serializable
Delivered when the 
best solution changes during solving.
 Delivered in the solver thread (which is the thread that calls Solver.solve(Solution_)).- See Also:
 
- 
Field Summary
Fields inherited from class java.util.EventObject
source - 
Constructor Summary
ConstructorsConstructorDescriptionBestSolutionChangedEvent(Solver<Solution_> solver, long timeMillisSpent, Solution_ newBestSolution, Score newBestScore)  - 
Method Summary
Modifier and TypeMethodDescriptionReturns theScoreof thegetNewBestSolution().Note that: In real-time planning, not allProblemChanges might be processed: checkisEveryProblemFactChangeProcessed(). thisPlanningSolutionmight be uninitialized: checkScore.isSolutionInitialized(). thisPlanningSolutionmight be infeasible: checkScore.isFeasible().longbooleanbooleanDeprecated, for removal: This API element is subject to removal in a future version.Methods inherited from class java.util.EventObject
getSource, toString 
- 
Constructor Details
 - 
Method Details
- 
getTimeMillisSpent
public long getTimeMillisSpent()- Returns:
 >= 0, the amount of millis spent since theSolverstarted untilgetNewBestSolution()was found
 - 
getNewBestSolution
Note that:- In real-time planning, not all 
ProblemChanges might be processed: checkisEveryProblemFactChangeProcessed(). - this 
PlanningSolutionmight be uninitialized: checkScore.isSolutionInitialized(). - this 
PlanningSolutionmight be infeasible: checkScore.isFeasible(). 
- Returns:
 - never null
 
 - In real-time planning, not all 
 - 
getNewBestScore
Returns theScoreof thegetNewBestSolution().This is useful for generic code, which doesn't know the type of the
PlanningSolutionto retrieve theScorefrom thegetNewBestSolution()easily.- Returns:
 - never null, because at this point it's always already calculated
 
 - 
isEveryProblemFactChangeProcessed
Deprecated, for removal: This API element is subject to removal in a future version.PreferisEveryProblemChangeProcessed().This method is deprecated.- Returns:
 - As defined by 
Solver.isEveryProblemFactChangeProcessed() - See Also:
 
 - 
isEveryProblemChangeProcessed
public boolean isEveryProblemChangeProcessed()- Returns:
 - As defined by 
Solver.isEveryProblemChangeProcessed() - See Also:
 
 
 - 
 
isEveryProblemChangeProcessed().