21 #include "absl/base/log_severity.h"
22 #include "absl/container/flat_hash_set.h"
25 #include "ortools/math_opt/callback.pb.h"
26 #include "ortools/math_opt/sparse_containers.pb.h"
33 CHECK_EQ(sparse_vector.ids_size(), sparse_vector.values_size());
40 if (!(
value == 0.0)) {
41 sparse_vector.set_ids(
next,
id);
48 sparse_vector.mutable_ids()->Truncate(
next);
49 sparse_vector.mutable_values()->Truncate(
next);
53 const SparseVectorFilterProto& filter)
60 const auto& ids = filter_.filtered_ids();
61 CHECK(std::adjacent_find(ids.begin(), ids.end(),
62 std::greater_equal<int64_t>()) == ids.end())
63 <<
"The input filter.filtered_ids must be strictly increasing.";
67 absl::flat_hash_set<CallbackEventProto>
EventSet(
68 const CallbackRegistrationProto& callback_registration) {
72 absl::flat_hash_set<CallbackEventProto> events;
73 for (
int i = 0; i < callback_registration.request_registration_size(); ++i) {
74 events.emplace(callback_registration.request_registration(i));
#define CHECK_EQ(val1, val2)
SparseVectorFilterPredicate(const SparseVectorFilterProto &filter)
SparseVectorView< T > MakeView(absl::Span< const int64_t > ids, const Collection &values)
absl::flat_hash_set< CallbackEventProto > EventSet(const CallbackRegistrationProto &callback_registration)
void RemoveSparseDoubleVectorZeros(SparseDoubleVectorProto &sparse_vector)
Collection of objects used to extend the Constraint Solver library.