Google OR-Tools v9.11
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...

#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
 

Detailed Description

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

Definition at line 316 of file time_limit.h.

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 318 of file time_limit.h.

◆ ~SharedTimeLimit()

operations_research::SharedTimeLimit::~SharedTimeLimit ( )
inline

Definition at line 328 of file time_limit.h.

Member Function Documentation

◆ AdvanceDeterministicTime()

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

Definition at line 351 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 366 of file time_limit.h.

◆ GetElapsedDeterministicTime()

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

Definition at line 361 of file time_limit.h.

◆ GetTimeLeft()

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

Definition at line 356 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 334 of file time_limit.h.

◆ Stop()

void operations_research::SharedTimeLimit::Stop ( )
inline

Definition at line 341 of file time_limit.h.

◆ UpdateLocalLimit()

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

Definition at line 346 of file time_limit.h.


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