Class PartitionSolver<Solution_>
- java.lang.Object
- 
- org.optaplanner.core.impl.solver.AbstractSolver<Solution_>
- 
- org.optaplanner.core.impl.partitionedsearch.PartitionSolver<Solution_>
 
 
- 
- Type Parameters:
- Solution_- the solution type, the class with the- PlanningSolutionannotation
 - All Implemented Interfaces:
- Solver<Solution_>
 
 public class PartitionSolver<Solution_> extends AbstractSolver<Solution_> 
- 
- 
Field SummaryFields Modifier and Type Field Description protected SolverScope<Solution_>solverScope- 
Fields inherited from class org.optaplanner.core.impl.solver.AbstractSolverbestSolutionRecaller, logger, phaseLifecycleSupport, phaseList, solverEventSupport, termination
 
- 
 - 
Constructor SummaryConstructors Constructor Description PartitionSolver(BestSolutionRecaller<Solution_> bestSolutionRecaller, Termination<Solution_> termination, List<Phase<Solution_>> phaseList, SolverScope<Solution_> solverScope)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddProblemFactChange(ProblemFactChange<Solution_> problemFactChange)Schedules aProblemFactChangeto be processed.booleanaddProblemFactChanges(List<ProblemFactChange<Solution_>> problemFactChanges)Schedules multipleProblemFactChanges to be processed.longgetScoreCalculationCount()booleanisEveryProblemFactChangeProcessed()Checks if all scheduledProblemFactChanges have been processed.booleanisSolving()This method is thread-safe.booleanisTerminateEarly()This method is thread-safe.Solution_solve(Solution_ problem)Solves the planning problem and returns the best solution encountered (which might or might not be optimal, feasible or even initialized).voidsolvingEnded(SolverScope<Solution_> solverScope)voidsolvingStarted(SolverScope<Solution_> solverScope)booleanterminateEarly()Notifies the solver that it should stop at its earliest convenience.- 
Methods inherited from class org.optaplanner.core.impl.solver.AbstractSolveraddEventListener, addPhaseLifecycleListener, removeEventListener, removePhaseLifecycleListener, runPhases
 
- 
 
- 
- 
- 
Field Detail- 
solverScopeprotected final SolverScope<Solution_> solverScope 
 
- 
 - 
Constructor Detail- 
PartitionSolverpublic PartitionSolver(BestSolutionRecaller<Solution_> bestSolutionRecaller, Termination<Solution_> termination, List<Phase<Solution_>> phaseList, SolverScope<Solution_> solverScope) 
 
- 
 - 
Method Detail- 
isSolvingpublic boolean isSolving() Description copied from interface:SolverThis method is thread-safe.- Returns:
- true if the Solver.solve(Solution_)method is still running.
 
 - 
terminateEarlypublic boolean terminateEarly() Description copied from interface:SolverNotifies the solver that it should stop at its earliest convenience. This method returns immediately, but it takes an undetermined time for theSolver.solve(Solution_)to actually return.If the solver is running in daemon mode, this is the only way to terminate it normally. This method is thread-safe. It can only be called from a different thread because the original thread is still calling Solver.solve(Object).- Returns:
- true if successful, false if was already terminating or terminated
- See Also:
- Solver.isTerminateEarly(),- Future.cancel(boolean)
 
 - 
isTerminateEarlypublic boolean isTerminateEarly() Description copied from interface:SolverThis method is thread-safe.- Returns:
- true if terminateEarly has been called since the Solverstarted.
- See Also:
- Future.isCancelled()
 
 - 
addProblemFactChangepublic boolean addProblemFactChange(ProblemFactChange<Solution_> problemFactChange) Description copied from interface:SolverSchedules aProblemFactChangeto be processed.As a side-effect, this restarts the Solver, effectively resetting allTerminations, but notSolver.terminateEarly().This method is thread-safe. Follows specifications of BlockingQueue.add(Object)with by default a capacity ofInteger.MAX_VALUE.- Parameters:
- problemFactChange- never null
- Returns:
- true (as specified by Collection.add(E))
- See Also:
- Solver.addProblemFactChanges(List)
 
 - 
addProblemFactChangespublic boolean addProblemFactChanges(List<ProblemFactChange<Solution_>> problemFactChanges) Description copied from interface:SolverSchedules multipleProblemFactChanges to be processed.As a side-effect, this restarts the Solver, effectively resetting allTerminations, but notSolver.terminateEarly().This method is thread-safe. Follows specifications of Collection.addAll(Collection)with by default a capacity ofInteger.MAX_VALUE.- Parameters:
- problemFactChanges- never null
- Returns:
- true (as specified by Collection.add(E))
- See Also:
- Solver.addProblemFactChange(ProblemFactChange)
 
 - 
isEveryProblemFactChangeProcessedpublic boolean isEveryProblemFactChangeProcessed() Description copied from interface:SolverChecks if all scheduledProblemFactChanges have been processed.This method is thread-safe. - Returns:
- true if there are no ProblemFactChanges left to do
 
 - 
solvepublic Solution_ solve(Solution_ problem) Description copied from interface:SolverSolves the planning problem and returns the best solution encountered (which might or might not be optimal, feasible or even initialized).It can take seconds, minutes, even hours or days before this method returns, depending on the Terminationconfiguration. To terminate aSolverearly, callSolver.terminateEarly().- Parameters:
- problem- never null, a- PlanningSolution, usually its planning variables are uninitialized
- Returns:
- never null, but it can return the original, uninitialized PlanningSolutionwith a nullScore.
- See Also:
- Solver.terminateEarly()
 
 - 
solvingStartedpublic void solvingStarted(SolverScope<Solution_> solverScope) - Overrides:
- solvingStartedin class- AbstractSolver<Solution_>
 
 - 
solvingEndedpublic void solvingEnded(SolverScope<Solution_> solverScope) - Overrides:
- solvingEndedin class- AbstractSolver<Solution_>
 
 - 
getScoreCalculationCountpublic long getScoreCalculationCount() 
 
- 
 
-