Solution_
- the solution type, the class with the PlanningSolution
annotationProblemId_
- the ID type of a submitted problem, such as Long
or UUID
.public interface SolverJob<Solution_,ProblemId_>
problem
that has been submitted to solve on the SolverManager
.Modifier and Type | Method and Description |
---|---|
Solution_ |
getFinalBestSolution()
Waits if necessary for the solver to complete and then returns the final best
PlanningSolution . |
ProblemId_ |
getProblemId() |
SolverStatus |
getSolverStatus()
Returns whether the
Solver is scheduled to solve, actively solving or not. |
Duration |
getSolvingDuration()
Returns the
Duration spent solving since the last start. |
void |
terminateEarly()
Terminates the solver or cancels the solver job if it hasn't (re)started yet.
|
ProblemId_ getProblemId()
SolverManager.solve(Object, Function, Consumer)
or SolverManager.solveAndListen(Object, Function, Consumer)
SolverStatus getSolverStatus()
Solver
is scheduled to solve, actively solving or not.
Returns SolverStatus.NOT_SOLVING
if the solver already terminated.
void terminateEarly()
Does nothing if the solver already terminated.
Waits for the termination or cancellation to complete before returning.
During termination, a bestSolutionConsumer
could still be called (on a consumer thread),
before this method returns.
Solution_ getFinalBestSolution() throws InterruptedException, ExecutionException
PlanningSolution
.InterruptedException
- if the current thread was interrupted while waitingExecutionException
- if the computation threw an exceptionDuration getSolvingDuration()
Duration
spent solving since the last start.
If it hasn't started it yet, it returns Duration.ZERO
.
If it hasn't ended yet, it returns the time between the last start and now.
If it has ended already, it returns the time between the last start and the ending.Duration
spent solving since the last (re)start, at least 0Copyright © 2006–2021 JBoss by Red Hat. All rights reserved.