Google OR-Tools v9.14
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::Set< Integer > Class Template Reference

Detailed Description

template<typename Integer>
class operations_research::Set< Integer >

Definition at line 132 of file hamiltonian_path.h.

#include <hamiltonian_path.h>

Public Types

typedef Integer IntegerType
 Make this visible to classes using this class.

Public Member Functions

 Set (Integer n)
 Construct a set from an Integer.
Integer value () const
 Returns the integer corresponding to the set.
Set AddElement (int n) const
Set RemoveElement (int n) const
bool Contains (int n) const
 Returns true if the calling set contains element n.
bool Includes (Set other) const
 Returns true if 'other' is included in the calling set.
int Cardinality () const
int SmallestElement () const
Set RemoveSmallestElement () const
int ElementRank (int n) const
Set SmallestSingleton () const
 Returns the set consisting of the smallest element of the calling object.
int SingletonRank (Set singleton) const
 Returns the rank of the singleton's element in the calling Set.
ElementIterator< Setbegin () const
 STL iterator-related member functions.
ElementIterator< Setend () const
bool operator!= (const Set &other) const
int SmallestElement () const
int Cardinality () const

Static Public Member Functions

static Set FullSet (Integer card)
static Set Singleton (Integer n)
 Returns the singleton set with 'n' as its only element.

Static Public Attributes

static constexpr Integer kOne = Integer{1}
 Useful constants.
static constexpr Integer kZero = Integer{0}
static constexpr int kMaxCardinality = std::numeric_limits<Integer>::digits

Member Typedef Documentation

◆ IntegerType

template<typename Integer>
typedef Integer operations_research::Set< Integer >::IntegerType

Make this visible to classes using this class.

Definition at line 135 of file hamiltonian_path.h.

Constructor & Destructor Documentation

◆ Set()

template<typename Integer>
operations_research::Set< Integer >::Set ( Integer n)
inlineexplicit

Construct a set from an Integer.

Definition at line 143 of file hamiltonian_path.h.

Member Function Documentation

◆ AddElement()

template<typename Integer>
Set operations_research::Set< Integer >::AddElement ( int n) const
inline

Returns a set equal to the calling object, with element n added. If n is already in the set, no operation occurs.

Definition at line 160 of file hamiltonian_path.h.

◆ begin()

template<typename Integer>
ElementIterator< Set > operations_research::Set< Integer >::begin ( ) const
inline

STL iterator-related member functions.

Definition at line 203 of file hamiltonian_path.h.

◆ Cardinality() [1/2]

template<typename Integer>
int operations_research::Set< Integer >::Cardinality ( ) const
inline

Returns the number of elements in the set. Uses the 32-bit version for types that have 32-bits or less. Specialized for uint64_t.

Definition at line 176 of file hamiltonian_path.h.

◆ Cardinality() [2/2]

int operations_research::Set< uint64_t >::Cardinality ( ) const
inline

Definition at line 220 of file hamiltonian_path.h.

◆ Contains()

template<typename Integer>
bool operations_research::Set< Integer >::Contains ( int n) const
inline

Returns true if the calling set contains element n.

Definition at line 167 of file hamiltonian_path.h.

◆ ElementRank()

template<typename Integer>
int operations_research::Set< Integer >::ElementRank ( int n) const
inline

Returns the rank of an element in a set. For the set 11100, ElementRank(4) would return 2. (Ranks start at kZero).

Definition at line 188 of file hamiltonian_path.h.

◆ end()

template<typename Integer>
ElementIterator< Set > operations_research::Set< Integer >::end ( ) const
inline

Definition at line 206 of file hamiltonian_path.h.

◆ FullSet()

template<typename Integer>
Set operations_research::Set< Integer >::FullSet ( Integer card)
inlinestatic

Definition at line 151 of file hamiltonian_path.h.

◆ Includes()

template<typename Integer>
bool operations_research::Set< Integer >::Includes ( Set< Integer > other) const
inline

Returns true if 'other' is included in the calling set.

Definition at line 170 of file hamiltonian_path.h.

◆ operator!=()

template<typename Integer>
bool operations_research::Set< Integer >::operator!= ( const Set< Integer > & other) const
inline

Definition at line 207 of file hamiltonian_path.h.

◆ RemoveElement()

template<typename Integer>
Set operations_research::Set< Integer >::RemoveElement ( int n) const
inline

Returns a set equal to the calling object, with element n removed. If n is not in the set, no operation occurs.

Definition at line 164 of file hamiltonian_path.h.

◆ RemoveSmallestElement()

template<typename Integer>
Set operations_research::Set< Integer >::RemoveSmallestElement ( ) const
inline

Returns a set equal to the calling object, with its smallest element removed.

Definition at line 184 of file hamiltonian_path.h.

◆ Singleton()

template<typename Integer>
Set operations_research::Set< Integer >::Singleton ( Integer n)
inlinestatic

Returns the singleton set with 'n' as its only element.

Definition at line 156 of file hamiltonian_path.h.

◆ SingletonRank()

template<typename Integer>
int operations_research::Set< Integer >::SingletonRank ( Set< Integer > singleton) const
inline

Returns the rank of the singleton's element in the calling Set.

Definition at line 197 of file hamiltonian_path.h.

◆ SmallestElement() [1/2]

template<typename Integer>
int operations_research::Set< Integer >::SmallestElement ( ) const
inline

Returns the index of the smallest element in the set. Uses the 32-bit version for types that have 32-bits or less. Specialized for uint64_t.

Definition at line 180 of file hamiltonian_path.h.

◆ SmallestElement() [2/2]

int operations_research::Set< uint64_t >::SmallestElement ( ) const
inline

Definition at line 215 of file hamiltonian_path.h.

◆ SmallestSingleton()

template<typename Integer>
Set operations_research::Set< Integer >::SmallestSingleton ( ) const
inline

Returns the set consisting of the smallest element of the calling object.

Definition at line 194 of file hamiltonian_path.h.

◆ value()

template<typename Integer>
Integer operations_research::Set< Integer >::value ( ) const
inline

Returns the integer corresponding to the set.

Definition at line 149 of file hamiltonian_path.h.

Member Data Documentation

◆ kMaxCardinality

template<typename Integer>
int operations_research::Set< Integer >::kMaxCardinality = std::numeric_limits<Integer>::digits
staticconstexpr

Definition at line 140 of file hamiltonian_path.h.

◆ kOne

template<typename Integer>
Integer operations_research::Set< Integer >::kOne = Integer{1}
staticconstexpr

Useful constants.

Definition at line 138 of file hamiltonian_path.h.

◆ kZero

template<typename Integer>
Integer operations_research::Set< Integer >::kZero = Integer{0}
staticconstexpr

Definition at line 139 of file hamiltonian_path.h.


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