16#ifndef OR_TOOLS_MATH_OPT_CONSTRAINTS_SECOND_ORDER_CONE_SECOND_ORDER_CONE_CONSTRAINT_H_
17#define OR_TOOLS_MATH_OPT_CONSTRAINTS_SECOND_ORDER_CONE_SECOND_ORDER_CONE_CONSTRAINT_H_
25#include "absl/strings/string_view.h"
40 using IdType = SecondOrderConeConstraintId;
43 SecondOrderConeConstraintId
id);
45 inline int64_t
id()
const;
47 inline SecondOrderConeConstraintId
typed_id()
const;
48 inline const ModelStorage*
storage()
const;
50 inline absl::string_view
name()
const;
74 friend std::ostream&
operator<<(std::ostream& ostr,
78 const ModelStorage* storage_;
79 SecondOrderConeConstraintId id_;
84inline std::ostream&
operator<<(std::ostream& ostr,
102 if (storage_->has_constraint(id_)) {
103 return storage_->constraint_data(id_).name;
114 return lhs.id_ == rhs.id_ && lhs.storage_ == rhs.storage_;
119 return !(lhs == rhs);
124 return H::combine(std::move(h), constraint.id_.value(), constraint.storage_);
130 const absl::string_view
name = constraint.
name();
132 ostr <<
"__soc_con#" << constraint.
id() <<
"__";
140 const ModelStorage*
const storage,
const SecondOrderConeConstraintId
id)
141 : storage_(storage), id_(id) {}
friend H AbslHashValue(H h, const SecondOrderConeConstraint &constraint)
std::string ToString() const
friend std::ostream & operator<<(std::ostream &ostr, const SecondOrderConeConstraint &constraint)
LinearExpression UpperBound() const
friend bool operator!=(const SecondOrderConeConstraint &lhs, const SecondOrderConeConstraint &rhs)
const ModelStorage * storage() const
std::vector< Variable > NonzeroVariables() const
std::vector< LinearExpression > ArgumentsToNorm() const
SecondOrderConeConstraint(const ModelStorage *storage, SecondOrderConeConstraintId id)
friend bool operator==(const SecondOrderConeConstraint &lhs, const SecondOrderConeConstraint &rhs)
SecondOrderConeConstraintId typed_id() const
SecondOrderConeConstraintId IdType
The typed integer used for ids.
absl::string_view name() const
const std::string name
A name for logging purposes.
An object oriented wrapper for quadratic constraints in ModelStorage.
constexpr absl::string_view kDeletedConstraintDefaultDescription
std::ostream & operator<<(std::ostream &ostr, const IndicatorConstraint &constraint)
bool operator==(const IndicatorConstraint &lhs, const IndicatorConstraint &rhs)
bool operator!=(const IndicatorConstraint &lhs, const IndicatorConstraint &rhs)
std::vector< Variable > AtomicConstraintNonzeroVariables(const ModelStorage &storage, const IdType id)
H AbslHashValue(H h, const IndicatorConstraint &constraint)