 |
OR-Tools
8.1
|
Go to the documentation of this file.
16 #include "absl/strings/str_cat.h"
19 "If true, rely on the user time in the TimeLimit class. This is "
20 "only recommended for benchmarking on a non-isolated environment.");
22 ABSL_FLAG(
bool, time_limit_use_instruction_count,
false,
23 "If true, measures the number of instructions executed");
32 std::string buffer = absl::StrCat(
38 for (
const auto& counter : deterministic_counters_) {
39 const std::string& counter_name = counter.first;
40 const double counter_value = counter.second;
41 absl::StrAppend(&buffer,
"\n", counter_name,
": ", (counter_value));
48 double limit_in_seconds,
49 double deterministic_limit)
51 time_limit_(std::
min(base_time_limit_->GetTimeLeft(), limit_in_seconds),
52 std::
min(base_time_limit_->GetDeterministicTimeLeft(),
53 deterministic_limit)) {
54 if (base_time_limit_->external_boolean_as_limit_ !=
nullptr) {
56 base_time_limit_->external_boolean_as_limit_);
static const double kSafetyBufferSeconds
The vehicle routing library lets one model and solve generic vehicle routing problems ranging from th...
double GetDeterministicTimeLeft() const
Returns the remaining deterministic time before LimitReached() returns true due to the deterministic ...
A simple class to enforce both an elapsed time limit and a deterministic time limit in the same threa...
std::string DebugString() const
Returns information about the time limit object in a human-readable form.
NestedTimeLimit(TimeLimit *base_time_limit, double limit_in_seconds, double deterministic_limit)
Creates the nested time limit.
double GetTimeLeft() const
Returns the time left on this limit, or 0 if the limit was reached (it never returns a negative value...
void RegisterExternalBooleanAsLimit(std::atomic< bool > *external_boolean_as_limit)
Registers the external Boolean to check when LimitReached() is called.
void AdvanceDeterministicTime(double deterministic_duration)
Advances the deterministic time.
ABSL_FLAG(bool, time_limit_use_usertime, false, "If true, rely on the user time in the TimeLimit class. This is " "only recommended for benchmarking on a non-isolated environment.")
double GetElapsedTime() const
Returns the time elapsed in seconds since the construction of this object.
static const int kHistorySize
double GetElapsedDeterministicTime() const
Returns the elapsed deterministic time since the construction of this object.
~NestedTimeLimit()
Updates elapsed deterministic time in the base time limit object.