16 #ifndef OR_TOOLS_MATH_OPT_CONSTRAINTS_SOS_SOS2_CONSTRAINT_H_
17 #define OR_TOOLS_MATH_OPT_CONSTRAINTS_SOS_SOS2_CONSTRAINT_H_
24 #include "absl/strings/string_view.h"
43 inline int64_t
id()
const;
45 inline Sos2ConstraintId
typed_id()
const;
52 inline absl::string_view
name()
const;
68 friend std::ostream&
operator<<(std::ostream& ostr,
83 inline std::ostream&
operator<<(std::ostream& ostr,
120 return lhs.id_ == rhs.id_ && lhs.storage_ == rhs.storage_;
124 return !(lhs == rhs);
127 template <
typename H>
129 return H::combine(std::move(h), constraint.id_.value(), constraint.storage_);
134 const absl::string_view
name = constraint.
name();
136 ostr <<
"__sos2_con#" << constraint.
id() <<
"__";
151 const Sos2ConstraintId
id)
152 : storage_(storage), id_(id) {}
const AtomicConstraintTraits< IdType >::ConstraintData & constraint_data(IdType id) const
bool has_constraint(IdType id) const
friend bool operator==(const Sos2Constraint &lhs, const Sos2Constraint &rhs)
std::string ToString() const
double weight(int index) const
Sos2Constraint(const ModelStorage *storage, Sos2ConstraintId id)
LinearExpression Expression(int index) const
friend H AbslHashValue(H h, const Sos2Constraint &constraint)
friend bool operator!=(const Sos2Constraint &lhs, const Sos2Constraint &rhs)
Sos2ConstraintId typed_id() const
int64_t num_expressions() const
friend std::ostream & operator<<(std::ostream &ostr, const Sos2Constraint &constraint)
std::vector< Variable > NonzeroVariables() const
absl::string_view name() const
const ModelStorage * storage() const
std::string SosConstraintToString(SosConstraint constraint, absl::string_view sos_type_name)
std::vector< Variable > AtomicConstraintNonzeroVariables(const ModelStorage &storage, const IdType id)
constexpr absl::string_view kDeletedConstraintDefaultDescription
bool operator==(const IndicatorConstraint &lhs, const IndicatorConstraint &rhs)
bool operator!=(const IndicatorConstraint &lhs, const IndicatorConstraint &rhs)
std::ostream & operator<<(std::ostream &ostr, const IndicatorConstraint &constraint)
H AbslHashValue(H h, const IndicatorConstraint &constraint)