Class SearchMonitor
java.lang.Object
com.google.ortools.constraintsolver.BaseObject
com.google.ortools.constraintsolver.SearchMonitor
- Direct Known Subclasses:
LocalSearchMonitor,OptimizeVar,PropagationMonitor,SearchLimit,SearchLog,SolutionCollector
public class SearchMonitor extends BaseObject
A search monitor is a simple set of callbacks to monitor all search events
-
Field Summary
Fields Modifier and Type Field Description static intkNoProgressFields inherited from class com.google.ortools.constraintsolver.BaseObject
swigCMemOwn -
Constructor Summary
Constructors Modifier Constructor Description protectedSearchMonitor(long cPtr, boolean cMemoryOwn)SearchMonitor(Solver s) -
Method Summary
Modifier and Type Method Description voidaccept(ModelVisitor visitor)Accepts the given model visitor.booleanacceptDelta(Assignment delta, Assignment deltadelta)voidacceptNeighbor()After accepting a neighbor during local search.booleanacceptSolution()This method is called when a solution is found.voidAcceptUncheckedNeighbor()After 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.voidapplyDecision(Decision d)Before applying the decision.booleanatSolution()This method is called when a valid solution is found.voidbeginFail()Just when the failure occurs.voidbeginInitialPropagation()Before the initial propagation.voidbeginNextDecision(DecisionBuilder b)Before calling DecisionBuilder::Next.voiddelete()voidendFail()After completing the backtrack.voidendInitialPropagation()After the initial propagation.voidendNextDecision(DecisionBuilder b, Decision d)After calling DecisionBuilder::Next, along with the returned decision.voidenterSearch()Beginning of the search.voidexitSearch()End of the search.protected voidfinalize()protected static longgetCPtr(SearchMonitor obj)voidinstall()Registers itself on the solver such that it gets notified of the search
and propagation events.booleanIsUncheckedSolutionLimitReached()Returns true if the limit of solutions has been reached including
unchecked solutions.booleanlocalOptimum()When a local optimum is reached.voidnoMoreSolutions()When the search tree is finished.voidperiodicCheck()Periodic call to check limits in long running methods.intprogressPercent()Returns a percentage representing the propress of the search before
reaching limits.voidrefuteDecision(Decision d)Before refuting the decision.voidrestartSearch()Restart the search.Solversolver()protected voidswigDirectorDisconnect()voidswigReleaseOwnership()voidswigTakeOwnership()Methods inherited from class com.google.ortools.constraintsolver.BaseObject
getCPtr, toStringMethods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Field Details
-
kNoProgress
public static final int kNoProgress
-
-
Constructor Details
-
SearchMonitor
protected SearchMonitor(long cPtr, boolean cMemoryOwn) -
SearchMonitor
-
-
Method Details
-
getCPtr
-
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() -
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. -
solver
-
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.
-