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

A search monitor is a simple set of callbacks to monitor all search events. More...

#include <constraint_solver.h>

Inheritance diagram for operations_research::SearchMonitor:
operations_research::BaseObject operations_research::LocalSearchMonitor operations_research::ObjectiveMonitor operations_research::PropagationMonitor operations_research::SearchLimit operations_research::SearchLog operations_research::SolutionCollector operations_research::SymmetryManager operations_research::LocalSearchMonitorPrimary operations_research::LocalSearchProfiler operations_research::OptimizeVar operations_research::DemonProfiler operations_research::Trace operations_research::ImprovementSearchLimit operations_research::RegularLimit

Public Member Functions

 SearchMonitor (Solver *const s)
 
 SearchMonitor (const SearchMonitor &)=delete
 This type is neither copyable nor movable.
 
SearchMonitoroperator= (const SearchMonitor &)=delete
 
 ~SearchMonitor () override
 
virtual void EnterSearch ()
 Beginning of the search.
 
virtual void RestartSearch ()
 Restart the search.
 
virtual void ExitSearch ()
 End of the search.
 
virtual void BeginNextDecision (DecisionBuilder *b)
 Before calling DecisionBuilder::Next.
 
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 RefuteDecision (Decision *d)
 Before refuting 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 void PeriodicCheck ()
 Periodic call to check limits in long running methods.
 
virtual int ProgressPercent ()
 
virtual void Accept (ModelVisitor *visitor) const
 Accepts the given model visitor.
 
virtual void Install ()
 A search monitors adds itself on the active search.
 
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 ()
 
virtual std::string DebugString () const
 

Static Public Attributes

static constexpr int kNoProgress = -1
 

Protected Member Functions

void ListenToEvent (Solver::MonitorEvent event)
 

Detailed Description

A search monitor is a simple set of callbacks to monitor all search events.

Definition at line 3901 of file constraint_solver.h.

Constructor & Destructor Documentation

◆ SearchMonitor() [1/2]

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

Definition at line 3905 of file constraint_solver.h.

◆ SearchMonitor() [2/2]

operations_research::SearchMonitor::SearchMonitor ( const SearchMonitor & )
delete

This type is neither copyable nor movable.

◆ ~SearchMonitor()

operations_research::SearchMonitor::~SearchMonitor ( )
inlineoverride

Definition at line 3912 of file constraint_solver.h.

Member Function Documentation

◆ Accept()

void operations_research::SearchMonitor::Accept ( ModelVisitor * visitor) const
virtual

Accepts the given model visitor.

Reimplemented in operations_research::ObjectiveMonitor, and operations_research::RegularLimit.

Definition at line 2904 of file constraint_solver.cc.

◆ AcceptDelta()

bool operations_research::SearchMonitor::AcceptDelta ( Assignment * delta,
Assignment * deltadelta )
virtual

Reimplemented in operations_research::ObjectiveMonitor.

Definition at line 2897 of file constraint_solver.cc.

◆ AcceptNeighbor()

void operations_research::SearchMonitor::AcceptNeighbor ( )
virtual

After accepting a neighbor during local search.

Definition at line 2901 of file constraint_solver.cc.

◆ AcceptSolution()

bool operations_research::SearchMonitor::AcceptSolution ( )
virtual

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.

Reimplemented in operations_research::OptimizeVar.

Definition at line 2893 of file constraint_solver.cc.

◆ AcceptUncheckedNeighbor()

void operations_research::SearchMonitor::AcceptUncheckedNeighbor ( )
virtual

After accepting an unchecked neighbor during local search.

Reimplemented in operations_research::SearchLog.

Definition at line 2902 of file constraint_solver.cc.

◆ AfterDecision()

void operations_research::SearchMonitor::AfterDecision ( Decision * d,
bool apply )
virtual

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.

Definition at line 2887 of file constraint_solver.cc.

◆ ApplyDecision()

void operations_research::SearchMonitor::ApplyDecision ( Decision * d)
virtual

Before applying the decision.

Reimplemented in operations_research::SearchLog.

Definition at line 2885 of file constraint_solver.cc.

◆ AtSolution()

bool operations_research::SearchMonitor::AtSolution ( )
virtual

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.

Reimplemented in operations_research::ImprovementSearchLimit, operations_research::ObjectiveMonitor, operations_research::OptimizeVar, and operations_research::SearchLog.

Definition at line 2894 of file constraint_solver.cc.

◆ BeginFail()

void operations_research::SearchMonitor::BeginFail ( )
virtual

Just when the failure occurs.

Reimplemented in operations_research::DemonProfiler, and operations_research::SearchLog.

Definition at line 2889 of file constraint_solver.cc.

◆ BeginInitialPropagation()

void operations_research::SearchMonitor::BeginInitialPropagation ( )
virtual

Before the initial propagation.

Reimplemented in operations_research::SearchLog.

Definition at line 2891 of file constraint_solver.cc.

◆ BeginNextDecision()

void operations_research::SearchMonitor::BeginNextDecision ( DecisionBuilder * b)
virtual

Before calling DecisionBuilder::Next.

Reimplemented in operations_research::OptimizeVar, and operations_research::SearchLimit.

Definition at line 2883 of file constraint_solver.cc.

◆ EndFail()

void operations_research::SearchMonitor::EndFail ( )
virtual

After completing the backtrack.

Definition at line 2890 of file constraint_solver.cc.

◆ EndInitialPropagation()

void operations_research::SearchMonitor::EndInitialPropagation ( )
virtual

After the initial propagation.

Reimplemented in operations_research::SearchLog.

Definition at line 2892 of file constraint_solver.cc.

◆ EndNextDecision()

void operations_research::SearchMonitor::EndNextDecision ( DecisionBuilder * b,
Decision * d )
virtual

After calling DecisionBuilder::Next, along with the returned decision.

Reimplemented in operations_research::SymmetryManager.

Definition at line 2884 of file constraint_solver.cc.

◆ EnterSearch()

void operations_research::SearchMonitor::EnterSearch ( )
virtual

Beginning of the search.

-------— Search Monitor -------—

Reimplemented in operations_research::ObjectiveMonitor, operations_research::SearchLimit, operations_research::SearchLog, and operations_research::SolutionCollector.

Definition at line 2880 of file constraint_solver.cc.

◆ ExitSearch()

void operations_research::SearchMonitor::ExitSearch ( )
virtual

◆ Install()

void operations_research::SearchMonitor::Install ( )
virtual

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 in operations_research::DemonProfiler, operations_research::ImprovementSearchLimit, operations_research::LocalSearchMonitor, operations_research::LocalSearchMonitorPrimary, operations_research::LocalSearchProfiler, operations_research::PropagationMonitor, operations_research::RegularLimit, operations_research::SearchLimit, operations_research::SolutionCollector, and operations_research::Trace.

Definition at line 2907 of file constraint_solver.cc.

◆ IsUncheckedSolutionLimitReached()

virtual bool operations_research::SearchMonitor::IsUncheckedSolutionLimitReached ( )
inlinevirtual

Returns true if the limit of solutions has been reached including unchecked solutions.

Reimplemented in operations_research::RegularLimit.

Definition at line 3979 of file constraint_solver.h.

◆ ListenToEvent()

void operations_research::SearchMonitor::ListenToEvent ( Solver::MonitorEvent event)
protected

Definition at line 2914 of file constraint_solver.cc.

◆ LocalOptimum()

bool operations_research::SearchMonitor::LocalOptimum ( )
virtual

When a local optimum is reached. If 'true' is returned, the last solution is discarded and the search proceeds with the next one.

Definition at line 2896 of file constraint_solver.cc.

◆ NoMoreSolutions()

void operations_research::SearchMonitor::NoMoreSolutions ( )
virtual

When the search tree is finished.

Reimplemented in operations_research::SearchLog.

Definition at line 2895 of file constraint_solver.cc.

◆ operator=()

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

◆ PeriodicCheck()

void operations_research::SearchMonitor::PeriodicCheck ( )
virtual

Periodic call to check limits in long running methods.

Reimplemented in operations_research::SearchLimit.

Definition at line 2903 of file constraint_solver.cc.

◆ ProgressPercent()

virtual int operations_research::SearchMonitor::ProgressPercent ( )
inlinevirtual

Returns a percentage representing the propress of the search before reaching limits.

Reimplemented in operations_research::RegularLimit.

Definition at line 3986 of file constraint_solver.h.

◆ RefuteDecision()

void operations_research::SearchMonitor::RefuteDecision ( Decision * d)
virtual

◆ RestartSearch()

void operations_research::SearchMonitor::RestartSearch ( )
virtual

Restart the search.

Reimplemented in operations_research::DemonProfiler, and operations_research::LocalSearchProfiler.

Definition at line 2881 of file constraint_solver.cc.

◆ solver()

Solver * operations_research::SearchMonitor::solver ( ) const
inline

Definition at line 3996 of file constraint_solver.h.

Member Data Documentation

◆ kNoProgress

int operations_research::SearchMonitor::kNoProgress = -1
staticconstexpr

Definition at line 3903 of file constraint_solver.h.


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