Class SearchMonitor
java.lang.Object
com.google.ortools.constraintsolver.BaseObject
com.google.ortools.constraintsolver.SearchMonitor
- Direct Known Subclasses:
BaseObjectiveMonitor
,LocalSearchMonitor
,PropagationMonitor
,SearchLimit
,SearchLog
,SolutionCollector
A search monitor is a simple set of callbacks to monitor all search events
-
Field Summary
FieldsFields inherited from class com.google.ortools.constraintsolver.BaseObject
swigCMemOwn
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(ModelVisitor visitor) Accepts the given model visitor.boolean
acceptDelta
(Assignment delta, Assignment deltadelta) void
After accepting a neighbor during local search.boolean
This method is called when a solution is found.void
After accepting an unchecked neighbor during local search.void
afterDecision
(Decision d, boolean apply) Just after refuting or applying the decision, apply is true after Apply.
This is called only if the Apply() or Refute() methods have not failed.void
Before applying the decision.boolean
This method is called when a valid solution is found.void
Just when the failure occurs.void
Before the initial propagation.void
Before calling DecisionBuilder::Next.void
delete()
void
endFail()
After completing the backtrack.void
After the initial propagation.void
After calling DecisionBuilder::Next, along with the returned decision.void
Beginning of the search.void
End of the search.protected void
finalize()
static long
getCPtr
(SearchMonitor obj) void
install()
Registers itself on the solver such that it gets notified of the search
and propagation events.boolean
Returns true if the limit of solutions has been reached including
unchecked solutions.void
boolean
When a local optimum is reached.void
When the search tree is finished.void
Periodic call to check limits in long running methods.int
Returns a percentage representing the propress of the search before
reaching limits.void
Before refuting the decision.void
Restart the search.solver()
protected void
static long
swigRelease
(SearchMonitor obj) void
void
Methods inherited from class com.google.ortools.constraintsolver.BaseObject
getCPtr, swigRelease, toString
-
Field Details
-
kNoProgress
public static final int kNoProgress
-
-
Constructor Details
-
SearchMonitor
public SearchMonitor(long cPtr, boolean cMemoryOwn) -
SearchMonitor
-
-
Method Details
-
getCPtr
-
swigRelease
-
finalize
protected void finalize()- Overrides:
finalize
in classBaseObject
-
delete
public void delete()- Overrides:
delete
in classBaseObject
-
swigDirectorDisconnect
protected void swigDirectorDisconnect() -
swigReleaseOwnership
public void swigReleaseOwnership() -
swigTakeOwnership
public void swigTakeOwnership() -
keepAliveDecisionBuilder
-
enterSearch
public void enterSearch()Beginning of the search. -
restartSearch
public void restartSearch()Restart the search. -
exitSearch
public void exitSearch()End of the search. -
beginNextDecision
Before calling DecisionBuilder::Next. -
endNextDecision
After calling DecisionBuilder::Next, along with the returned decision. -
applyDecision
Before applying the decision. -
refuteDecision
Before refuting the decision. -
afterDecision
Just after refuting or applying the decision, apply is true after Apply.
This is called only if the Apply() or Refute() methods have not failed. -
beginFail
public void beginFail()Just when the failure occurs. -
endFail
public void endFail()After completing the backtrack. -
beginInitialPropagation
public void beginInitialPropagation()Before the initial propagation. -
endInitialPropagation
public void endInitialPropagation()After the initial propagation. -
acceptSolution
public boolean acceptSolution()This method is called when a solution is found. It asserts whether the
solution is valid. A value of false indicates that the solution
should be discarded. -
atSolution
public boolean atSolution()This method is called when a valid solution is found. If the
return value is true, then search will resume after. If the result
is false, then search will stop there. -
noMoreSolutions
public void noMoreSolutions()When the search tree is finished. -
localOptimum
public boolean localOptimum()When a local optimum is reached. If 'true' is returned, the last solution
is discarded and the search proceeds with the next one. -
acceptDelta
-
acceptNeighbor
public void acceptNeighbor()After accepting a neighbor during local search. -
AcceptUncheckedNeighbor
public void AcceptUncheckedNeighbor()After accepting an unchecked neighbor during local search. -
IsUncheckedSolutionLimitReached
public boolean IsUncheckedSolutionLimitReached()Returns true if the limit of solutions has been reached including
unchecked solutions. -
periodicCheck
public void periodicCheck()Periodic call to check limits in long running methods. -
progressPercent
public int progressPercent()Returns a percentage representing the propress of the search before
reaching limits. -
accept
Accepts the given model visitor. -
install
public void install()Registers itself on the solver such that it gets notified of the search
and propagation events. Override to incrementally install listeners for
specific events. -
solver
-