Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::math_opt::Sos2Constraint Class Reference

#include <sos2_constraint.h>

Public Types

using IdType = Sos2ConstraintId
 The typed integer used for ids.
 

Public Member Functions

 Sos2Constraint (const ModelStorage *storage, Sos2ConstraintId id)
 
int64_t id () const
 
Sos2ConstraintId typed_id () const
 
const ModelStorage * storage () const
 
int64_t num_expressions () const
 
LinearExpression Expression (int index) const
 
bool has_weights () const
 
double weight (int index) const
 
absl::string_view name () const
 
std::vector< VariableNonzeroVariables () const
 
std::string ToString () const
 

Friends

bool operator== (const Sos2Constraint &lhs, const Sos2Constraint &rhs)
 
bool operator!= (const Sos2Constraint &lhs, const Sos2Constraint &rhs)
 
template<typename H >
AbslHashValue (H h, const Sos2Constraint &constraint)
 
std::ostream & operator<< (std::ostream &ostr, const Sos2Constraint &constraint)
 

Detailed Description

A value type that references a SOS2 constraint from ModelStorage. Usually this type is passed by copy.

This type implements https://abseil.io/docs/cpp/guides/hash.

Definition at line 37 of file sos2_constraint.h.

Member Typedef Documentation

◆ IdType

The typed integer used for ids.

Definition at line 40 of file sos2_constraint.h.

Constructor & Destructor Documentation

◆ Sos2Constraint()

operations_research::math_opt::Sos2Constraint::Sos2Constraint ( const ModelStorage * storage,
Sos2ConstraintId id )
inline

Definition at line 148 of file sos2_constraint.h.

Member Function Documentation

◆ Expression()

LinearExpression operations_research::math_opt::Sos2Constraint::Expression ( int index) const

Definition at line 24 of file sos2_constraint.cc.

◆ has_weights()

bool operations_research::math_opt::Sos2Constraint::has_weights ( ) const
inline

Definition at line 98 of file sos2_constraint.h.

◆ id()

int64_t operations_research::math_opt::Sos2Constraint::id ( ) const
inline

Inline function implementations

Definition at line 88 of file sos2_constraint.h.

◆ name()

absl::string_view operations_research::math_opt::Sos2Constraint::name ( ) const
inline

Definition at line 106 of file sos2_constraint.h.

◆ NonzeroVariables()

std::vector< Variable > operations_research::math_opt::Sos2Constraint::NonzeroVariables ( ) const
inline

All variables that appear in the SOS2 constraint with a nonzero coefficient in any of the expressions. Order is not defined.

Definition at line 113 of file sos2_constraint.h.

◆ num_expressions()

int64_t operations_research::math_opt::Sos2Constraint::num_expressions ( ) const
inline

Definition at line 94 of file sos2_constraint.h.

◆ storage()

const ModelStorage * operations_research::math_opt::Sos2Constraint::storage ( ) const
inline

Definition at line 92 of file sos2_constraint.h.

◆ ToString()

std::string operations_research::math_opt::Sos2Constraint::ToString ( ) const
inline

Returns a detailed string description of the contents of the constraint (not its name, use << for that instead).

Definition at line 141 of file sos2_constraint.h.

◆ typed_id()

Sos2ConstraintId operations_research::math_opt::Sos2Constraint::typed_id ( ) const
inline

Definition at line 90 of file sos2_constraint.h.

◆ weight()

double operations_research::math_opt::Sos2Constraint::weight ( int index) const
inline

Definition at line 102 of file sos2_constraint.h.

Friends And Related Symbol Documentation

◆ AbslHashValue

template<typename H >
H AbslHashValue ( H h,
const Sos2Constraint & constraint )
friend

Definition at line 126 of file sos2_constraint.h.

◆ operator!=

bool operator!= ( const Sos2Constraint & lhs,
const Sos2Constraint & rhs )
friend

Definition at line 121 of file sos2_constraint.h.

◆ operator<<

std::ostream & operator<< ( std::ostream & ostr,
const Sos2Constraint & constraint )
friend

Streams the name of the constraint, as registered upon constraint creation, or a short default if none was provided.

Todo
(b/170992529): handle quoting of invalid characters in the name.

Definition at line 130 of file sos2_constraint.h.

◆ operator==

bool operator== ( const Sos2Constraint & lhs,
const Sos2Constraint & rhs )
friend

Definition at line 117 of file sos2_constraint.h.


The documentation for this class was generated from the following files: