18#include "absl/status/status.h"
22#include "ortools/math_opt/sparse_containers.pb.h"
31 MakeView(expression.ids(), expression.coefficients()),
32 {.allow_positive_infinity = false, .allow_negative_infinity = false}))
33 <<
"invalid linear expression terms";
34 for (
const int64_t var_id : expression.ids()) {
35 if (!variable_universe.
HasId(var_id)) {
37 <<
"invalid variable id: " << var_id;
41 <<
"invalid linear expression offset";
42 return absl::OkStatus();
#define RETURN_IF_ERROR(expr)
bool HasId(int64_t id) const
An object oriented wrapper for quadratic constraints in ModelStorage.
SparseVectorView< T > MakeView(absl::Span< const int64_t > ids, const Collection &values)
absl::Status CheckIdsAndValues(const SparseVectorView< T > &vector_view, absl::string_view value_name="values")
absl::Status CheckScalarNoNanNoInf(const double d)
absl::Status ValidateLinearExpression(const LinearExpressionProto &expression, const IdNameBiMap &variable_universe)
StatusBuilder InvalidArgumentErrorBuilder()