14 #ifndef OR_TOOLS_SAT_UTIL_H_
15 #define OR_TOOLS_SAT_UTIL_H_
19 #include "absl/random/random.h"
25 #if !defined(__PORTABLE_PLATFORM__)
26 #include "google/protobuf/descriptor.h"
27 #endif // __PORTABLE_PLATFORM__
39 seed(
model->GetOrCreate<SatParameters>()->random_seed());
44 template <
typename URBG>
68 int relevant_prefix_size,
69 std::vector<Literal>* literals);
75 template <
typename URBG>
78 #if !defined(__PORTABLE_PLATFORM__)
80 const google::protobuf::EnumDescriptor* order_d =
81 SatParameters::VariableOrder_descriptor();
83 static_cast<SatParameters::VariableOrder
>(
84 order_d->value(absl::Uniform(*random, 0, order_d->value_count()))
88 const google::protobuf::EnumDescriptor* polarity_d =
89 SatParameters::Polarity_descriptor();
90 parameters->set_initial_polarity(
static_cast<SatParameters::Polarity
>(
91 polarity_d->value(absl::Uniform(*random, 0, polarity_d->value_count()))
93 #endif // __PORTABLE_PLATFORM__
95 parameters->set_use_phase_saving(absl::Bernoulli(*random, 0.5));
96 parameters->set_random_polarity_ratio(absl::Bernoulli(*random, 0.5) ? 0.01
98 parameters->set_random_branches_ratio(absl::Bernoulli(*random, 0.5) ? 0.01
107 : average_(initial_average) {}
111 void Reset(
double reset_value);
116 void AddData(
double new_record);
119 double average_ = 0.0;
120 int64 num_records_ = 0;
130 : decaying_factor_(decaying_factor) {
141 void AddData(
double new_record);
144 double average_ = 0.0;
145 int64 num_records_ = 0;
146 const double decaying_factor_;
159 explicit Percentile(
int record_limit) : record_limit_(record_limit) {}
170 std::deque<double> records_;
171 const int record_limit_;
182 std::vector<std::vector<int64>>* tuples);
187 #endif // OR_TOOLS_SAT_UTIL_H_