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 the- PlanningSolutionannotation
- 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 SummaryFields inherited from class java.util.EventObjectsource
- 
Constructor SummaryConstructorsConstructorDescriptionBestSolutionChangedEvent(Solver<Solution_> solver, long timeMillisSpent, Solution_ newBestSolution, Score newBestScore) 
- 
Method SummaryModifier 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.EventObjectgetSource, toString
- 
Constructor Details
- 
Method Details- 
getTimeMillisSpentpublic long getTimeMillisSpent()- Returns:
- >= 0, the amount of millis spent since the- Solverstarted until- getNewBestSolution()was found
 
- 
getNewBestSolutionNote 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 
- 
getNewBestScoreReturns 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
 
- 
isEveryProblemFactChangeProcessedDeprecated, 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:
 
- 
isEveryProblemChangeProcessedpublic boolean isEveryProblemChangeProcessed()- Returns:
- As defined by Solver.isEveryProblemChangeProcessed()
- See Also:
 
 
- 
isEveryProblemChangeProcessed().