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 TypeMethodDescriptionvoidaccept(ModelVisitor visitor) Accepts the given model visitor.booleanacceptDelta(Assignment delta, Assignment deltadelta) voidAfter accepting a neighbor during local search.booleanThis method is called when a solution is found.voidAfter accepting an unchecked neighbor during local search.voidafterDecision(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.voidBefore applying the decision.booleanThis method is called when a valid solution is found.voidJust when the failure occurs.voidBefore the initial propagation.voidBefore calling DecisionBuilder::Next.voiddelete()voidendFail()After completing the backtrack.voidAfter the initial propagation.voidAfter calling DecisionBuilder::Next, along with the returned decision.voidBeginning of the search.voidEnd of the search.protected voidfinalize()static longgetCPtr(SearchMonitor obj) voidinstall()Registers itself on the solver such that it gets notified of the search
and propagation events.booleanReturns true if the limit of solutions has been reached including
unchecked solutions.voidbooleanWhen a local optimum is reached.voidWhen the search tree is finished.voidPeriodic call to check limits in long running methods.intReturns a percentage representing the propress of the search before
reaching limits.voidBefore refuting the decision.voidRestart the search.solver()protected voidstatic longswigRelease(SearchMonitor obj) voidvoidMethods 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:
finalizein classBaseObject
-
delete
public void delete()- Overrides:
deletein 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
-