14#ifndef OR_TOOLS_SAT_UTIL_H_
15#define OR_TOOLS_SAT_UTIL_H_
22#if !defined(__PORTABLE_PLATFORM__)
23#include "google/protobuf/descriptor.h"
25#include "absl/container/btree_set.h"
26#include "absl/random/bit_gen_ref.h"
27#include "absl/random/random.h"
28#include "absl/types/span.h"
31#include "ortools/sat/sat_parameters.pb.h"
81 int64_t& x0, int64_t& y0);
105 int64_t base,
const std::vector<int64_t>& coeffs,
106 const std::vector<int64_t>& lbs,
const std::vector<int64_t>& ubs,
107 int64_t rhs, int64_t* new_rhs);
122 :
absl::BitGenRef(deterministic_random_) {
123 const auto& params = *
model->GetOrCreate<SatParameters>();
124 deterministic_random_.seed(params.random_seed());
125 if (params.use_absl_random()) {
126 absl_random_ = absl::BitGen(absl::SeedSeq({params.random_seed()}));
127 absl::BitGenRef::operator=(absl::BitGenRef(absl_random_));
140 absl::BitGen absl_random_;
175 const absl::btree_set<LiteralIndex>& processed,
int relevant_prefix_size,
176 std::vector<Literal>* literals);
187 : average_(initial_average) {}
191 void Reset(
double reset_value);
196 void AddData(
double new_record);
199 double average_ = 0.0;
200 int64_t num_records_ = 0;
210 : decaying_factor_(decaying_factor) {
221 void AddData(
double new_record);
224 double average_ = 0.0;
225 int64_t num_records_ = 0;
226 const double decaying_factor_;
239 explicit Percentile(
int record_limit) : record_limit_(record_limit) {}
250 std::deque<double> records_;
251 const int record_limit_;
261void CompressTuples(absl::Span<const int64_t> domain_sizes, int64_t any_value,
262 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 RandomizeDecisionHeuristic(absl::BitGenRef random, SatParameters *parameters)
int64_t ClosestMultiple(int64_t value, int64_t base)
void CompressTuples(absl::Span< const int64_t > domain_sizes, int64_t any_value, std::vector< std::vector< int64_t > > *tuples)
int64_t PositiveMod(int64_t x, int64_t m)
int64_t CeilSquareRoot(int64_t a)
bool SolveDiophantineEquationOfSizeTwo(int64_t &a, int64_t &b, int64_t &cte, int64_t &x0, int64_t &y0)
int64_t FloorSquareRoot(int64_t a)
int64_t ModularInverse(int64_t x, int64_t m)
int64_t ProductWithModularInverse(int64_t coeff, int64_t mod, int64_t rhs)
int MoveOneUnprocessedLiteralLast(const absl::btree_set< LiteralIndex > &processed, int relevant_prefix_size, std::vector< Literal > *literals)
bool LinearInequalityCanBeReducedWithClosestMultiple(int64_t base, const std::vector< int64_t > &coeffs, const std::vector< int64_t > &lbs, const std::vector< int64_t > &ubs, int64_t rhs, int64_t *new_rhs)
Collection of objects used to extend the Constraint Solver library.
std::mt19937 random_engine_t