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

#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 One = static_cast<Integer>(1)
 Useful constants.
 
static constexpr Integer Zero = static_cast<Integer>(0)
 
static const int MaxCardinality = 8 * sizeof(Integer)
 

Detailed Description

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

Definition at line 126 of file hamiltonian_path.h.

Member Typedef Documentation

◆ IntegerType

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

Make this visible to classes using this class.

Definition at line 129 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 137 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 154 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 197 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 170 of file hamiltonian_path.h.

◆ Cardinality() [2/2]

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

Definition at line 214 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 161 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 zero).

Definition at line 182 of file hamiltonian_path.h.

◆ end()

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

Definition at line 200 of file hamiltonian_path.h.

◆ FullSet()

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

Definition at line 145 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 164 of file hamiltonian_path.h.

◆ operator!=()

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

Definition at line 201 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 158 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 178 of file hamiltonian_path.h.

◆ Singleton()

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

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

Definition at line 150 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 191 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 174 of file hamiltonian_path.h.

◆ SmallestElement() [2/2]

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

Definition at line 209 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 188 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 143 of file hamiltonian_path.h.

Member Data Documentation

◆ MaxCardinality

template<typename Integer >
const int operations_research::Set< Integer >::MaxCardinality = 8 * sizeof(Integer)
static

Definition at line 134 of file hamiltonian_path.h.

◆ One

template<typename Integer >
Integer operations_research::Set< Integer >::One = static_cast<Integer>(1)
staticconstexpr

Useful constants.

Definition at line 132 of file hamiltonian_path.h.

◆ Zero

template<typename Integer >
Integer operations_research::Set< Integer >::Zero = static_cast<Integer>(0)
staticconstexpr

Definition at line 133 of file hamiltonian_path.h.


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