16#ifndef OR_TOOLS_MATH_OPT_CONSTRAINTS_SOS_SOS1_CONSTRAINT_H_
17#define OR_TOOLS_MATH_OPT_CONSTRAINTS_SOS_SOS1_CONSTRAINT_H_
24#include "absl/base/nullability.h"
25#include "absl/strings/string_view.h"
46 inline int64_t
id()
const;
48 inline Sos1ConstraintId
typed_id()
const;
53 inline double weight(
int index)
const;
54 inline absl::string_view
name()
const;
69 friend std::ostream&
operator<<(std::ostream& ostr,
78inline std::ostream&
operator<<(std::ostream& ostr,
90 return storage()->constraint_data(id_).num_expressions();
94 return storage()->constraint_data(id_).has_weights();
98 return storage()->constraint_data(id_).weight(index);
102 if (
storage()->has_constraint(id_)) {
103 return storage()->constraint_data(id_).name();
117 return !(lhs == rhs);
122 return H::combine(std::move(h), constraint.id_.value(), constraint.
storage());
129 ostr <<
"__sos1_con#" << constraint.
id() <<
"__";
137 if (
storage()->has_constraint(id_)) {
144 const Sos1ConstraintId
id)
ModelStorageCPtr storage() const
ModelStorageItem(ModelStorageCPtr storage)
int64_t num_expressions() const
std::vector< Variable > NonzeroVariables() const
friend bool operator!=(const Sos1Constraint &lhs, const Sos1Constraint &rhs)
std::string ToString() const
Returns a detailed string description of the constraint.
friend bool operator==(const Sos1Constraint &lhs, const Sos1Constraint &rhs)
friend H AbslHashValue(H h, const Sos1Constraint &constraint)
Sos1Constraint(ModelStorageCPtr storage, Sos1ConstraintId id)
absl::string_view name() const
double weight(int index) const
Sos1ConstraintId typed_id() const
Sos1ConstraintId IdType
The typed integer used for ids.
friend std::ostream & operator<<(std::ostream &ostr, const Sos1Constraint &constraint)
LinearExpression Expression(int index) const
std::string SosConstraintToString(SosConstraint constraint, absl::string_view sos_type_name)
An object oriented wrapper for quadratic constraints in ModelStorage.
absl::Nonnull< const ModelStorage * > ModelStorageCPtr
constexpr absl::string_view kDeletedConstraintDefaultDescription
bool operator==(const SecondOrderConeConstraint &lhs, const SecondOrderConeConstraint &rhs)
bool operator!=(const SecondOrderConeConstraint &lhs, const SecondOrderConeConstraint &rhs)
std::ostream & operator<<(std::ostream &ostr, const SecondOrderConeConstraint &constraint)
std::vector< Variable > AtomicConstraintNonzeroVariables(const ModelStorage &storage, const IdType id)
H AbslHashValue(H h, const SecondOrderConeConstraint &constraint)