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/strings/string_view.h"
43 inline int64_t
id()
const;
45 inline Sos1ConstraintId
typed_id()
const;
52 inline absl::string_view
name()
const;
67 friend std::ostream&
operator<<(std::ostream& ostr,
82 inline std::ostream&
operator<<(std::ostream& ostr,
119 return lhs.id_ == rhs.id_ && lhs.storage_ == rhs.storage_;
123 return !(lhs == rhs);
126 template <
typename H>
128 return H::combine(std::move(h), constraint.id_.value(), constraint.storage_);
133 const absl::string_view
name = constraint.
name();
135 ostr <<
"__sos1_con#" << constraint.
id() <<
"__";
150 const Sos1ConstraintId
id)
151 : storage_(storage), id_(id) {}
const AtomicConstraintTraits< IdType >::ConstraintData & constraint_data(IdType id) const
bool has_constraint(IdType id) const
std::string ToString() const
double weight(int index) const
friend bool operator!=(const Sos1Constraint &lhs, const Sos1Constraint &rhs)
LinearExpression Expression(int index) const
friend bool operator==(const Sos1Constraint &lhs, const Sos1Constraint &rhs)
friend H AbslHashValue(H h, const Sos1Constraint &constraint)
Sos1Constraint(const ModelStorage *storage, Sos1ConstraintId id)
Sos1ConstraintId typed_id() const
int64_t num_expressions() const
friend std::ostream & operator<<(std::ostream &ostr, const Sos1Constraint &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)