algorithms fixup
This commit is contained in:
@@ -19,16 +19,17 @@
|
||||
#include <functional>
|
||||
#include <limits>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "ortools/base/murmur.h"
|
||||
#include "absl/base/log_severity.h"
|
||||
#include "absl/numeric/int128.h"
|
||||
#include "absl/random/distributions.h"
|
||||
#include "absl/random/random.h"
|
||||
#include "absl/strings/str_format.h"
|
||||
#include "absl/time/time.h"
|
||||
#include "benchmark/benchmark.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ortools/base/hash.h"
|
||||
|
||||
namespace operations_research {
|
||||
|
||||
@@ -208,10 +209,12 @@ TEST(BinarySearchTest, NonMonoticPredicateReachesLocalInflexionPoint_Double) {
|
||||
constexpr double kEps = std::numeric_limits<double>::epsilon();
|
||||
const int kNumAttempts = 100000;
|
||||
for (int attempt = 0; attempt < kNumAttempts; ++attempt) {
|
||||
const uint64_t hash_seed = random();
|
||||
std::function<bool(double)> non_monotonic_predicate =
|
||||
[](double x) {
|
||||
return util_hash::MurmurHash64(
|
||||
reinterpret_cast<const char*>(&x), sizeof(x)) & 1;
|
||||
[hash_seed](double x) {
|
||||
return fasthash64(reinterpret_cast<const char*>(&x), sizeof(x),
|
||||
hash_seed) &
|
||||
1;
|
||||
};
|
||||
// Pick a random [x_true, x_false] interval which verifies f(x_true) = true
|
||||
// and f(x_false) = false.
|
||||
|
||||
Reference in New Issue
Block a user