Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| OptaPlanner distribution 6.2.0.Beta3
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.optaplanner.core.api.solver.event
Class BestSolutionChangedEvent<SolutionG extends Solution>

    java.lang.Object
      java.util.EventObject
          org.optaplanner.core.api.solver.event.BestSolutionChangedEvent<SolutionG>

All Implemented Interfaces:
  Serializable

    public class BestSolutionChangedEvent<SolutionG extends Solution>

extends EventObject

Delivered when the best `Solution` changes during solving. Delivered in the solver thread (which is the thread that calls `Solver.solve(Solution)`.

See Also:
  Serialized Form

Field Summary

Fields inherited from class java.util.EventObject
`source`

Constructor Summary
`BestSolutionChangedEvent(Solver solver, long timeMillisSpent, SolutionG newBestSolution, int newUninitializedVariableCount)`

Method Summary
`SolutionG` | `getNewBestSolution()` Note that: In real-time planning, not all `ProblemFactChange`s might be processed: check `isEveryProblemFactChangeProcessed()` this `Solution` might be uninitialized: check `isNewBestSolutionInitialized()` this `Solution` might be infeasible: check `FeasibilityScore.isFeasible()`
`long` | `getTimeMillisSpent()`
`boolean` | `isEveryProblemFactChangeProcessed()`
`boolean` | `isNewBestSolutionInitialized()`

Methods inherited from class java.util.EventObject
`getSource, toString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### BestSolutionChangedEvent

    public BestSolutionChangedEvent(Solver solver,
                                    long timeMillisSpent,
                                    SolutionG newBestSolution,
                                    int newUninitializedVariableCount)

Parameters:
  `solver` - never null
  `timeMillisSpent` - >= 0L
  `newBestSolution` - never null
  `newUninitializedVariableCount` - >= 0

Method Detail

### getTimeMillisSpent

    public long getTimeMillisSpent()

  Returns:
    >= 0, the amount of millis spent since the `Solver` started until `getNewBestSolution()` was found

### getNewBestSolution

    public SolutionG getNewBestSolution()

  Note that:
  - In real-time planning, not all `ProblemFactChange`s might be processed: check `isEveryProblemFactChangeProcessed()`
  - this `Solution` might be uninitialized: check `isNewBestSolutionInitialized()`
  - this `Solution` might be infeasible: check `FeasibilityScore.isFeasible()`

  Returns:
    never null

### isEveryProblemFactChangeProcessed

    public boolean isEveryProblemFactChangeProcessed()

  See Also:
    `Solver.isEveryProblemFactChangeProcessed()`

### isNewBestSolutionInitialized

    public boolean isNewBestSolutionInitialized()

  Returns:
    true if all the planning entities have planning variables that are initialized.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| OptaPlanner distribution 6.2.0.Beta3
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006-2014 JBoss by Red Hat. All Rights Reserved.