14#ifndef OR_TOOLS_SAT_UTIL_H_
15#define OR_TOOLS_SAT_UTIL_H_
20#include "absl/random/bit_gen_ref.h"
21#include "absl/random/random.h"
28#if !defined(__PORTABLE_PLATFORM__)
29#include "google/protobuf/descriptor.h"
48 :
absl::BitGenRef(deterministic_random_) {
50 deterministic_random_.seed(params.random_seed());
51 if (params.use_absl_random()) {
52 absl_random_ = absl::BitGen(absl::SeedSeq({params.random_seed()}));
53 absl::BitGenRef::operator=(absl::BitGenRef(absl_random_));
66 absl::BitGen absl_random_;
77template <
typename URBG>
101 int relevant_prefix_size,
102 std::vector<Literal>* literals);
108template <
typename URBG>
111#if !defined(__PORTABLE_PLATFORM__)
113 const google::protobuf::EnumDescriptor* order_d =
117 order_d->value(absl::Uniform(*random, 0, order_d->value_count()))
121 const google::protobuf::EnumDescriptor* polarity_d =
124 polarity_d->value(absl::Uniform(*random, 0, polarity_d->value_count()))
140 : average_(initial_average) {}
144 void Reset(
double reset_value);
149 void AddData(
double new_record);
152 double average_ = 0.0;
153 int64_t num_records_ = 0;
163 : decaying_factor_(decaying_factor) {
174 void AddData(
double new_record);
177 double average_ = 0.0;
178 int64_t num_records_ = 0;
179 const double decaying_factor_;
192 explicit Percentile(
int record_limit) : record_limit_(record_limit) {}
203 std::deque<double> records_;
204 const int record_limit_;
214void CompressTuples(absl::Span<const int64_t> domain_sizes, int64_t any_value,
215 std::vector<std::vector<int64_t>>* tuples);
#define DCHECK_LE(val1, val2)
#define DCHECK_GE(val1, val2)
A simple class to enforce both an elapsed time limit and a deterministic time limit in the same threa...
void AddData(double new_record)
int64_t NumRecords() const
ExponentialMovingAverage(double decaying_factor)
double CurrentAverage() const
void AddData(double new_record)
int64_t NumRecords() const
IncrementalAverage(double initial_average)
double CurrentAverage() const
void Reset(double reset_value)
Class that owns everything related to a particular optimization model.
ModelRandomGenerator(Model *model)
ModelSharedTimeLimit(Model *model)
double GetPercentile(double percent)
int64_t NumRecords() const
Percentile(int record_limit)
void AddRecord(double record)
void set_random_polarity_ratio(double value)
void set_initial_polarity(::operations_research::sat::SatParameters_Polarity value)
static const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor * Polarity_descriptor()
void set_preferred_variable_order(::operations_research::sat::SatParameters_VariableOrder value)
void set_random_branches_ratio(double value)
static const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor * VariableOrder_descriptor()
void set_use_phase_saving(bool value)
int MoveOneUnprocessedLiteralLast(const std::set< LiteralIndex > &processed, int relevant_prefix_size, std::vector< Literal > *literals)
void CompressTuples(absl::Span< const int64_t > domain_sizes, int64_t any_value, std::vector< std::vector< int64_t > > *tuples)
SatParameters_VariableOrder
void RandomizeDecisionHeuristic(URBG *random, SatParameters *parameters)
Collection of objects used to extend the Constraint Solver library.
std::mt19937 random_engine_t