28 for (
const auto [var_id, coeff] : expr_data.
coeffs.
terms()) {
29 expr += coeff *
Variable(&storage, var_id);
36 for (
const auto [
var, coeff] : expression.
terms()) {
37 coeffs.
set(
var.typed_id(), coeff);
39 return {.coeffs = std::move(coeffs), .offset = expression.
offset()};
const VariableMap< double > & terms() const
Returns the terms in this expression.
bool set(VariableId id, double coeff)
Returns true if the stored value changes.
const absl::flat_hash_map< VariableId, double > & terms() const
An object oriented wrapper for quadratic constraints in ModelStorage.
LinearExpression ToLinearExpression(const ModelStorage &storage, const LinearExpressionData &expr_data)
LinearExpressionData FromLinearExpression(const LinearExpression &expression)
Converts a LinearExpression to the associated "raw ID" format.
SparseCoefficientMap coeffs