Class SearchLimit
- java.lang.Object
-
- com.google.ortools.constraintsolver.BaseObject
-
- com.google.ortools.constraintsolver.SearchMonitor
-
- com.google.ortools.constraintsolver.SearchLimit
-
- Direct Known Subclasses:
ImprovementSearchLimit,RegularLimit
public class SearchLimit extends SearchMonitor
Base class of all search limits.
-
-
Field Summary
-
Fields inherited from class com.google.ortools.constraintsolver.SearchMonitor
kNoProgress
-
Fields inherited from class com.google.ortools.constraintsolver.BaseObject
swigCMemOwn
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedSearchLimit(long cPtr, boolean cMemoryOwn)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbeginNextDecision(DecisionBuilder b)Before calling DecisionBuilder::Next.booleancheck()This method is called to check the status of the limit.booleanCheckWithOffset(SWIGTYPE_p_absl__Duration offset)Same as Check() but adds the 'offset' value to the current time when time
is considered in the limit.voidcopy(SearchLimit limit)Copy a limit.booleancrossed()Returns true if the limit has been crossed.voiddelete()voidenterSearch()Internal methods.protected voidfinalize()protected static longgetCPtr(SearchLimit obj)voidinit()This method is called when the search limit is initialized.voidinstall()Registers itself on the solver such that it gets notified of the search
and propagation events.voidkeepAliveDecisionBuilder(DecisionBuilder db)SearchLimitmakeClone()Allocates a clone of the limit.voidperiodicCheck()Periodic call to check limits in long running methods.voidrefuteDecision(Decision d)Before refuting the decision.protected static longswigRelease(SearchLimit obj)java.lang.StringtoString()-
Methods inherited from class com.google.ortools.constraintsolver.SearchMonitor
accept, acceptDelta, acceptNeighbor, acceptSolution, AcceptUncheckedNeighbor, afterDecision, applyDecision, atSolution, beginFail, beginInitialPropagation, endFail, endInitialPropagation, endNextDecision, exitSearch, getCPtr, IsUncheckedSolutionLimitReached, localOptimum, noMoreSolutions, progressPercent, restartSearch, solver, swigDirectorDisconnect, swigRelease, swigReleaseOwnership, swigTakeOwnership
-
Methods inherited from class com.google.ortools.constraintsolver.BaseObject
getCPtr, swigRelease
-
-
-
-
Method Detail
-
getCPtr
protected static long getCPtr(SearchLimit obj)
-
swigRelease
protected static long swigRelease(SearchLimit obj)
-
finalize
protected void finalize()
- Overrides:
finalizein classSearchMonitor
-
delete
public void delete()
- Overrides:
deletein classSearchMonitor
-
keepAliveDecisionBuilder
public void keepAliveDecisionBuilder(DecisionBuilder db)
- Overrides:
keepAliveDecisionBuilderin classSearchMonitor
-
crossed
public boolean crossed()
Returns true if the limit has been crossed.
-
check
public boolean check()
This method is called to check the status of the limit. A return
value of true indicates that we have indeed crossed the limit. In
that case, this method will not be called again and the remaining
search will be discarded.
-
CheckWithOffset
public boolean CheckWithOffset(SWIGTYPE_p_absl__Duration offset)
Same as Check() but adds the 'offset' value to the current time when time
is considered in the limit.
-
init
public void init()
This method is called when the search limit is initialized.
-
copy
public void copy(SearchLimit limit)
Copy a limit. Warning: leads to a direct (no check) downcasting of 'limit'
so one needs to be sure both SearchLimits are of the same type.
-
makeClone
public SearchLimit makeClone()
Allocates a clone of the limit.
-
enterSearch
public void enterSearch()
Internal methods.- Overrides:
enterSearchin classSearchMonitor
-
beginNextDecision
public void beginNextDecision(DecisionBuilder b)
Description copied from class:SearchMonitorBefore calling DecisionBuilder::Next.- Overrides:
beginNextDecisionin classSearchMonitor
-
periodicCheck
public void periodicCheck()
Description copied from class:SearchMonitorPeriodic call to check limits in long running methods.- Overrides:
periodicCheckin classSearchMonitor
-
refuteDecision
public void refuteDecision(Decision d)
Description copied from class:SearchMonitorBefore refuting the decision.- Overrides:
refuteDecisionin classSearchMonitor
-
toString
public java.lang.String toString()
- Overrides:
toStringin classBaseObject
-
install
public void install()
Description copied from class:SearchMonitorRegisters itself on the solver such that it gets notified of the search
and propagation events. Override to incrementally install listeners for
specific events.- Overrides:
installin classSearchMonitor
-
-