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

Detailed Description

Usual limit based on wall_time, number of explored branches and number of failures in the search tree

Definition at line 4763 of file constraint_solver.h.

#include <constraint_solver.h>

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

Public Member Functions

 RegularLimit (Solver *s, absl::Duration time, int64_t branches, int64_t failures, int64_t solutions, bool smart_time_check, bool cumulative)
 --— Regular Limit --—
 ~RegularLimit () override
void Copy (const SearchLimit *limit) override
SearchLimitMakeClone () const override
 Allocates a clone of the limit.
RegularLimitMakeIdenticalClone () const
bool CheckWithOffset (absl::Duration offset) override
void Init () override
 This method is called when the search limit is initialized.
void ExitSearch () override
 End of the search.
void UpdateLimits (absl::Duration time, int64_t branches, int64_t failures, int64_t solutions)
absl::Duration duration_limit () const
int64_t wall_time () const
int64_t branches () const
int64_t failures () const
int64_t solutions () const
bool IsUncheckedSolutionLimitReached () override
int ProgressPercent () override
std::string DebugString () const override
void Install () override
 A search monitors adds itself on the active search.
absl::Time AbsoluteSolverDeadline () const
void Accept (ModelVisitor *visitor) const override
 Accepts the given model visitor.
Public Member Functions inherited from operations_research::SearchLimit
 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 ()
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 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.
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 ()=default

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)

Constructor & Destructor Documentation

◆ RegularLimit()

operations_research::RegularLimit::RegularLimit ( Solver * s,
absl::Duration time,
int64_t branches,
int64_t failures,
int64_t solutions,
bool smart_time_check,
bool cumulative )

--— Regular Limit --—

Definition at line 4522 of file search.cc.

◆ ~RegularLimit()

operations_research::RegularLimit::~RegularLimit ( )
override

Definition at line 4541 of file search.cc.

Member Function Documentation

◆ AbsoluteSolverDeadline()

absl::Time operations_research::RegularLimit::AbsoluteSolverDeadline ( ) const
inline

Definition at line 4791 of file constraint_solver.h.

◆ Accept()

void operations_research::RegularLimit::Accept ( ModelVisitor * visitor) const
overridevirtual

Accepts the given model visitor.

Reimplemented from operations_research::SearchMonitor.

Definition at line 4636 of file search.cc.

◆ branches()

int64_t operations_research::RegularLimit::branches ( ) const
inline

Definition at line 4783 of file constraint_solver.h.

◆ CheckWithOffset()

bool operations_research::RegularLimit::CheckWithOffset ( absl::Duration offset)
overridevirtual

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

Warning limits might be kint64max, do not move the offset to the rhs

Implements operations_research::SearchLimit.

Definition at line 4570 of file search.cc.

◆ Copy()

void operations_research::RegularLimit::Copy ( const SearchLimit * limit)
overridevirtual

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.

Implements operations_research::SearchLimit.

Definition at line 4551 of file search.cc.

◆ DebugString()

std::string operations_research::RegularLimit::DebugString ( ) const
overridevirtual

Reimplemented from operations_research::BaseObject.

Definition at line 4628 of file search.cc.

◆ duration_limit()

absl::Duration operations_research::RegularLimit::duration_limit ( ) const
inline

Definition at line 4777 of file constraint_solver.h.

◆ ExitSearch()

void operations_research::RegularLimit::ExitSearch ( )
overridevirtual

End of the search.

Reduce the limits by the amount consumed during this search

Reimplemented from operations_research::SearchMonitor.

Definition at line 4602 of file search.cc.

◆ failures()

int64_t operations_research::RegularLimit::failures ( ) const
inline

Definition at line 4784 of file constraint_solver.h.

◆ Init()

void operations_research::RegularLimit::Init ( )
overridevirtual

This method is called when the search limit is initialized.

Implements operations_research::SearchLimit.

Definition at line 4591 of file search.cc.

◆ Install()

void operations_research::RegularLimit::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 4543 of file search.cc.

◆ IsUncheckedSolutionLimitReached()

bool operations_research::RegularLimit::IsUncheckedSolutionLimitReached ( )
overridevirtual

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

Reimplemented from operations_research::SearchMonitor.

Definition at line 4622 of file search.cc.

◆ MakeClone()

SearchLimit * operations_research::RegularLimit::MakeClone ( ) const
overridevirtual

Allocates a clone of the limit.

Implements operations_research::SearchLimit.

Definition at line 4562 of file search.cc.

◆ MakeIdenticalClone()

RegularLimit * operations_research::RegularLimit::MakeIdenticalClone ( ) const

Definition at line 4564 of file search.cc.

◆ ProgressPercent()

int operations_research::RegularLimit::ProgressPercent ( )
overridevirtual

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

Reimplemented from operations_research::SearchMonitor.

Definition at line 4578 of file search.cc.

◆ solutions()

int64_t operations_research::RegularLimit::solutions ( ) const
inline

Definition at line 4785 of file constraint_solver.h.

◆ UpdateLimits()

void operations_research::RegularLimit::UpdateLimits ( absl::Duration time,
int64_t branches,
int64_t failures,
int64_t solutions )

Definition at line 4613 of file search.cc.

◆ wall_time()

int64_t operations_research::RegularLimit::wall_time ( ) const
inline

Definition at line 4778 of file constraint_solver.h.


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