14#ifndef OR_TOOLS_MATH_OPT_STORAGE_LINEAR_EXPRESSION_DATA_H_
15#define OR_TOOLS_MATH_OPT_STORAGE_LINEAR_EXPRESSION_DATA_H_
17#include "absl/container/flat_hash_map.h"
45 const int num_terms =
static_cast<int>(
coeffs.terms().size());
59 for (
int i = 0; i < expr_proto.
ids_size(); ++i) {
double coefficients(int index) const
void add_coefficients(double value)
::google::protobuf::RepeatedField<::int64_t > *PROTOBUF_NONNULL mutable_ids()
::int64_t ids(int index) const
void add_ids(::int64_t value)
int ids_size() const
repeated int64 ids = 1;
::google::protobuf::RepeatedField< double > *PROTOBUF_NONNULL mutable_coefficients()
void set_offset(double value)
bool set(VariableId id, double coeff)
Returns true if the stored value changes.
An object oriented wrapper for quadratic constraints in ModelStorage.
ElementId< ElementType::kVariable > VariableId
std::vector< K > SortedMapKeys(const absl::flat_hash_map< K, V > &in_map)
static LinearExpressionData FromProto(const LinearExpressionProto &expr_proto)
LinearExpressionProto Proto() const
Inline implementations.
SparseCoefficientMap coeffs