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

Wrapper around TimeLimit to make it thread safe and add Stop() support. More...

Detailed Description

Wrapper around TimeLimit to make it thread safe and add Stop() support.

Definition at line 325 of file time_limit.h.

#include <time_limit.h>

Inheritance diagram for operations_research::SharedTimeLimit:
operations_research::sat::ModelSharedTimeLimit

Public Member Functions

 SharedTimeLimit (TimeLimit *time_limit)
 ~SharedTimeLimit ()
bool LimitReached () const
void Stop ()
void UpdateLocalLimit (TimeLimit *local_limit)
void AdvanceDeterministicTime (double deterministic_duration)
double GetTimeLeft () const
double GetElapsedDeterministicTime () const
std::atomic< bool > * ExternalBooleanAsLimit () const

Constructor & Destructor Documentation

◆ SharedTimeLimit()

operations_research::SharedTimeLimit::SharedTimeLimit ( TimeLimit * time_limit)
inlineexplicit

We use the one already registered if present or ours otherwise.

Definition at line 327 of file time_limit.h.

◆ ~SharedTimeLimit()

operations_research::SharedTimeLimit::~SharedTimeLimit ( )
inline

Definition at line 337 of file time_limit.h.

Member Function Documentation

◆ AdvanceDeterministicTime()

void operations_research::SharedTimeLimit::AdvanceDeterministicTime ( double deterministic_duration)
inline

Definition at line 360 of file time_limit.h.

◆ ExternalBooleanAsLimit()

std::atomic< bool > * operations_research::SharedTimeLimit::ExternalBooleanAsLimit ( ) const
inline

We can simply return the "external bool" and remain thread-safe because it's wrapped in std::atomic.

Definition at line 375 of file time_limit.h.

◆ GetElapsedDeterministicTime()

double operations_research::SharedTimeLimit::GetElapsedDeterministicTime ( ) const
inline

Definition at line 370 of file time_limit.h.

◆ GetTimeLeft()

double operations_research::SharedTimeLimit::GetTimeLeft ( ) const
inline

Definition at line 365 of file time_limit.h.

◆ LimitReached()

bool operations_research::SharedTimeLimit::LimitReached ( ) const
inline

Note, time_limit_->LimitReached() is not const, and changes internal state of time_limit_, hence we need a writer's lock.

Definition at line 343 of file time_limit.h.

◆ Stop()

void operations_research::SharedTimeLimit::Stop ( )
inline

Definition at line 350 of file time_limit.h.

◆ UpdateLocalLimit()

void operations_research::SharedTimeLimit::UpdateLocalLimit ( TimeLimit * local_limit)
inline

Definition at line 355 of file time_limit.h.


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