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

#include <sos1_constraint.h>

Public Types

using IdType = Sos1ConstraintId
 The typed integer used for ids.
 

Public Member Functions

 Sos1Constraint (const ModelStorage *storage, Sos1ConstraintId id)
 
int64_t id () const
 
Sos1ConstraintId 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
 Returns a detailed string description of the constraint.
 

Friends

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

Detailed Description

A value type that references a SOS1 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 sos1_constraint.h.

Member Typedef Documentation

◆ IdType

The typed integer used for ids.

Definition at line 40 of file sos1_constraint.h.

Constructor & Destructor Documentation

◆ Sos1Constraint()

operations_research::math_opt::Sos1Constraint::Sos1Constraint ( const ModelStorage * storage,
Sos1ConstraintId id )
inline

Definition at line 147 of file sos1_constraint.h.

Member Function Documentation

◆ Expression()

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

Definition at line 24 of file sos1_constraint.cc.

◆ has_weights()

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

Definition at line 97 of file sos1_constraint.h.

◆ id()

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

Inline function implementations

Definition at line 87 of file sos1_constraint.h.

◆ name()

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

Definition at line 105 of file sos1_constraint.h.

◆ NonzeroVariables()

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

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

Definition at line 112 of file sos1_constraint.h.

◆ num_expressions()

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

Definition at line 93 of file sos1_constraint.h.

◆ storage()

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

Definition at line 91 of file sos1_constraint.h.

◆ ToString()

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

Returns a detailed string description of the constraint.

Definition at line 140 of file sos1_constraint.h.

◆ typed_id()

Sos1ConstraintId operations_research::math_opt::Sos1Constraint::typed_id ( ) const
inline

Definition at line 89 of file sos1_constraint.h.

◆ weight()

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

Definition at line 101 of file sos1_constraint.h.

Friends And Related Symbol Documentation

◆ AbslHashValue

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

Definition at line 125 of file sos1_constraint.h.

◆ operator!=

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

Definition at line 120 of file sos1_constraint.h.

◆ operator<<

std::ostream & operator<< ( std::ostream & ostr,
const Sos1Constraint & 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 129 of file sos1_constraint.h.

◆ operator==

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

Definition at line 116 of file sos1_constraint.h.


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