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
 
 public class BestSolutionChangedEvent<Solution_> extends EventObject Delivered when thebest solutionchanges during solving. Delivered in the solver thread (which is the thread that callsSolver.solve(Solution_)).- See Also:
- Serialized Form
 
- 
- 
Field Summary- 
Fields inherited from class java.util.EventObjectsource
 
- 
 - 
Constructor SummaryConstructors Constructor Description BestSolutionChangedEvent(Solver<Solution_> solver, long timeMillisSpent, Solution_ newBestSolution, Score newBestScore)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description ScoregetNewBestScore()Returns theScoreof thegetNewBestSolution().Solution_getNewBestSolution()Note that: In real-time planning, not allProblemFactChanges might be processed: checkisEveryProblemFactChangeProcessed(). thisPlanningSolutionmight be uninitialized: checkScore.isSolutionInitialized(). thisPlanningSolutionmight be infeasible: checkScore.isFeasible().longgetTimeMillisSpent()booleanisEveryProblemFactChangeProcessed()- 
Methods inherited from class java.util.EventObjectgetSource, toString
 
- 
 
- 
- 
- 
Method Detail- 
getTimeMillisSpentpublic long getTimeMillisSpent() - Returns:
- >= 0, the amount of millis spent since the- Solverstarted until- getNewBestSolution()was found
 
 - 
getNewBestSolutionpublic Solution_ getNewBestSolution() Note that:- In real-time planning, not all ProblemFactChanges 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 
 - 
getNewBestScorepublic Score 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
 
 - 
isEveryProblemFactChangeProcessedpublic boolean isEveryProblemFactChangeProcessed() - Returns:
- As defined by Solver.isEveryProblemFactChangeProcessed()
- See Also:
- Solver.isEveryProblemFactChangeProcessed()
 
 
- 
 
-