23 #include "absl/container/flat_hash_set.h" 24 #include "ortools/math_opt/callback.pb.h" 26 #include "ortools/math_opt/sparse_containers.pb.h" 32 CHECK_EQ(sparse_vector.ids_size(), sparse_vector.values_size());
39 if (!(
value == 0.0)) {
40 sparse_vector.set_ids(
next,
id);
47 sparse_vector.mutable_ids()->Truncate(
next);
48 sparse_vector.mutable_values()->Truncate(
next);
52 const SparseVectorFilterProto& filter)
59 const auto& ids = filter_.filtered_ids();
60 CHECK(std::adjacent_find(ids.begin(), ids.end(),
61 std::greater_equal<int64_t>()) == ids.end())
62 <<
"The input filter.filtered_ids must be strictly increasing.";
66 absl::flat_hash_set<CallbackEventProto>
EventSet(
67 const CallbackRegistrationProto& callback_registration) {
71 absl::flat_hash_set<CallbackEventProto> events;
72 for (
int i = 0; i < callback_registration.request_registration_size(); ++i) {
73 events.emplace(callback_registration.request_registration(i));
SparseVectorView< T > MakeView(absl::Span< const int64_t > ids, const Collection &values)
SparseVectorFilterPredicate(const SparseVectorFilterProto &filter)
#define CHECK_EQ(val1, val2)
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.