Google OR-Tools v9.15
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 4786 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)
 ~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
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
SearchLimitoperator= (const SearchLimit &)=delete
 ~SearchLimit () override
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
Public Member Functions inherited from operations_research::SearchMonitor
 SearchMonitor (Solver *const s)
 SearchMonitor (const SearchMonitor &)=delete
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 AtLocalOptimum ()
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
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 )

Definition at line 4584 of file search.cc.

◆ ~RegularLimit()

operations_research::RegularLimit::~RegularLimit ( )
override

Definition at line 4603 of file search.cc.

Member Function Documentation

◆ AbsoluteSolverDeadline()

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

Definition at line 4814 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 4698 of file search.cc.

◆ branches()

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

Definition at line 4806 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.

Implements operations_research::SearchLimit.

Definition at line 4632 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 4613 of file search.cc.

◆ DebugString()

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

Reimplemented from operations_research::BaseObject.

Definition at line 4690 of file search.cc.

◆ duration_limit()

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

Definition at line 4800 of file constraint_solver.h.

◆ ExitSearch()

void operations_research::RegularLimit::ExitSearch ( )
overridevirtual

End of the search.

Reimplemented from operations_research::SearchMonitor.

Definition at line 4664 of file search.cc.

◆ failures()

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

Definition at line 4807 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 4653 of file search.cc.

◆ Install()

void operations_research::RegularLimit::Install ( )
overridevirtual

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 4605 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 4684 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 4624 of file search.cc.

◆ MakeIdenticalClone()

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

Definition at line 4626 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 4640 of file search.cc.

◆ solutions()

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

Definition at line 4808 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 4675 of file search.cc.

◆ wall_time()

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

Definition at line 4801 of file constraint_solver.h.


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