Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::SearchLimit Class Referenceabstract

Base class of all search limits. More...

#include <constraint_solver.h>

Inheritance diagram for operations_research::SearchLimit:
operations_research::SearchMonitor operations_research::BaseObject operations_research::ImprovementSearchLimit operations_research::RegularLimit

Public Member Functions

 SearchLimit (Solver *const s)
 
 SearchLimit (const SearchLimit &)=delete
 This type is neither copyable nor movable.
 
SearchLimitoperator= (const SearchLimit &)=delete
 
 ~SearchLimit () override
 -------— Search Limits -------—
 
bool crossed () const
 Returns true if the limit has been crossed.
 
bool Check ()
 
virtual bool CheckWithOffset (absl::Duration offset)=0
 
virtual void Init ()=0
 This method is called when the search limit is initialized.
 
virtual void Copy (const SearchLimit *limit)=0
 
virtual SearchLimitMakeClone () const =0
 Allocates a clone of the limit.
 
void EnterSearch () override
 Internal methods.
 
void BeginNextDecision (DecisionBuilder *b) override
 Before calling DecisionBuilder::Next.
 
void PeriodicCheck () override
 Periodic call to check limits in long running methods.
 
void RefuteDecision (Decision *d) override
 Before refuting the decision.
 
std::string DebugString () const override
 
void Install () override
 A search monitors adds itself on the active search.
 
- Public Member Functions inherited from operations_research::SearchMonitor
 SearchMonitor (Solver *const s)
 
 SearchMonitor (const SearchMonitor &)=delete
 This type is neither copyable nor movable.
 
SearchMonitoroperator= (const SearchMonitor &)=delete
 
 ~SearchMonitor () override
 
virtual void RestartSearch ()
 Restart the search.
 
virtual void ExitSearch ()
 End of the search.
 
virtual void EndNextDecision (DecisionBuilder *b, Decision *d)
 After calling DecisionBuilder::Next, along with the returned decision.
 
virtual void ApplyDecision (Decision *d)
 Before applying the decision.
 
virtual void AfterDecision (Decision *d, bool apply)
 
virtual void BeginFail ()
 Just when the failure occurs.
 
virtual void EndFail ()
 After completing the backtrack.
 
virtual void BeginInitialPropagation ()
 Before the initial propagation.
 
virtual void EndInitialPropagation ()
 After the initial propagation.
 
virtual bool AcceptSolution ()
 
virtual bool AtSolution ()
 
virtual void NoMoreSolutions ()
 When the search tree is finished.
 
virtual bool LocalOptimum ()
 
virtual bool AcceptDelta (Assignment *delta, Assignment *deltadelta)
 
virtual void AcceptNeighbor ()
 After accepting a neighbor during local search.
 
virtual void AcceptUncheckedNeighbor ()
 After accepting an unchecked neighbor during local search.
 
virtual bool IsUncheckedSolutionLimitReached ()
 
virtual int ProgressPercent ()
 
virtual void Accept (ModelVisitor *visitor) const
 Accepts the given model visitor.
 
Solversolver () const
 
- Public Member Functions inherited from operations_research::BaseObject
 BaseObject ()
 
 BaseObject (const BaseObject &)=delete
 This type is neither copyable nor movable.
 
BaseObjectoperator= (const BaseObject &)=delete
 
virtual ~BaseObject ()
 

Additional Inherited Members

- Static Public Attributes inherited from operations_research::SearchMonitor
static constexpr int kNoProgress = -1
 
- Protected Member Functions inherited from operations_research::SearchMonitor
void ListenToEvent (Solver::MonitorEvent event)
 

Detailed Description

Base class of all search limits.

Definition at line 4613 of file constraint_solver.h.

Constructor & Destructor Documentation

◆ SearchLimit() [1/2]

operations_research::SearchLimit::SearchLimit ( Solver *const s)
inlineexplicit

Definition at line 4615 of file constraint_solver.h.

◆ SearchLimit() [2/2]

operations_research::SearchLimit::SearchLimit ( const SearchLimit & )
delete

This type is neither copyable nor movable.

◆ ~SearchLimit()

operations_research::SearchLimit::~SearchLimit ( )
override

-------— Search Limits -------—

--— Base Class --—

Definition at line 4309 of file search.cc.

Member Function Documentation

◆ BeginNextDecision()

void operations_research::SearchLimit::BeginNextDecision ( DecisionBuilder * b)
overridevirtual

Before calling DecisionBuilder::Next.

Reimplemented from operations_research::SearchMonitor.

Definition at line 4323 of file search.cc.

◆ Check()

bool operations_research::SearchLimit::Check ( )
inline

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.

Definition at line 4631 of file constraint_solver.h.

◆ CheckWithOffset()

virtual bool operations_research::SearchLimit::CheckWithOffset ( absl::Duration offset)
pure virtual

Same as Check() but adds the 'offset' value to the current time when time is considered in the limit.

Implemented in operations_research::ImprovementSearchLimit, and operations_research::RegularLimit.

◆ Copy()

virtual void operations_research::SearchLimit::Copy ( const SearchLimit * limit)
pure virtual

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.

Implemented in operations_research::ImprovementSearchLimit, and operations_research::RegularLimit.

◆ crossed()

bool operations_research::SearchLimit::crossed ( ) const
inline

Returns true if the limit has been crossed.

Definition at line 4625 of file constraint_solver.h.

◆ DebugString()

std::string operations_research::SearchLimit::DebugString ( ) const
inlineoverridevirtual

Reimplemented from operations_research::BaseObject.

Definition at line 4651 of file constraint_solver.h.

◆ EnterSearch()

void operations_research::SearchLimit::EnterSearch ( )
overridevirtual

Internal methods.

Reimplemented from operations_research::SearchMonitor.

Definition at line 4318 of file search.cc.

◆ Init()

virtual void operations_research::SearchLimit::Init ( )
pure virtual

This method is called when the search limit is initialized.

Implemented in operations_research::ImprovementSearchLimit, and operations_research::RegularLimit.

◆ Install()

void operations_research::SearchLimit::Install ( )
overridevirtual

A search monitors adds itself on the active search.

Registers itself on the solver such that it gets notified of the search and propagation events. Override to incrementally install listeners for specific events.

Reimplemented from operations_research::SearchMonitor.

Definition at line 4311 of file search.cc.

◆ MakeClone()

virtual SearchLimit * operations_research::SearchLimit::MakeClone ( ) const
pure virtual

Allocates a clone of the limit.

Implemented in operations_research::ImprovementSearchLimit, and operations_research::RegularLimit.

◆ operator=()

SearchLimit & operations_research::SearchLimit::operator= ( const SearchLimit & )
delete

◆ PeriodicCheck()

void operations_research::SearchLimit::PeriodicCheck ( )
overridevirtual

Periodic call to check limits in long running methods.

Reimplemented from operations_research::SearchMonitor.

Definition at line 4333 of file search.cc.

◆ RefuteDecision()

void operations_research::SearchLimit::RefuteDecision ( Decision * d)
overridevirtual

Before refuting the decision.

Reimplemented from operations_research::SearchMonitor.

Definition at line 4328 of file search.cc.


The documentation for this class was generated from the following files: