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

--— Main IntTupleSet class --— More...

#include <tuple_set.h>

Public Member Functions

 IntTupleSet (int arity)
 Creates an empty tuple set with a fixed length for all tuples.
 
 IntTupleSet (const IntTupleSet &set)
 Copy constructor (it actually does a lazy copy, see toplevel comment).
 
 ~IntTupleSet ()
 
void Clear ()
 Clears data.
 
int Insert (const std::vector< int > &tuple)
 
int Insert (const std::vector< int64_t > &tuple)
 
int Insert2 (int64_t v0, int64_t v1)
 Arity fixed version of Insert removing the need for a vector for the user.
 
int Insert3 (int64_t v0, int64_t v1, int64_t v2)
 
int Insert4 (int64_t v0, int64_t v1, int64_t v2, int64_t v3)
 
void InsertAll (const std::vector< std::vector< int64_t > > &tuples)
 Inserts the tuples.
 
void InsertAll (const std::vector< std::vector< int > > &tuples)
 
bool Contains (const std::vector< int > &tuple) const
 Checks if the tuple is in the set.
 
bool Contains (const std::vector< int64_t > &tuple) const
 
int NumTuples () const
 Returns the number of tuples.
 
int64_t Value (int tuple_index, int pos_in_tuple) const
 
int Arity () const
 Returns the arity of the set.
 
const int64_t * RawData () const
 Access the raw data, see IntTupleSet::Data::flat_tuples_.
 
int NumDifferentValuesInColumn (int col) const
 Returns the number of different values in the given column.
 
IntTupleSet SortedByColumn (int col) const
 
IntTupleSet SortedLexicographically () const
 Returns a copy of the tuple set lexicographically sorted.
 

Detailed Description

--— Main IntTupleSet class --—

Definition at line 47 of file tuple_set.h.

Constructor & Destructor Documentation

◆ IntTupleSet() [1/2]

operations_research::IntTupleSet::IntTupleSet ( int arity)
inlineexplicit

Creates an empty tuple set with a fixed length for all tuples.

Definition at line 265 of file tuple_set.h.

◆ IntTupleSet() [2/2]

operations_research::IntTupleSet::IntTupleSet ( const IntTupleSet & set)
inline

Copy constructor (it actually does a lazy copy, see toplevel comment).

Definition at line 270 of file tuple_set.h.

◆ ~IntTupleSet()

operations_research::IntTupleSet::~IntTupleSet ( )
inline

Definition at line 274 of file tuple_set.h.

Member Function Documentation

◆ Arity()

int operations_research::IntTupleSet::Arity ( ) const
inline

Returns the arity of the set.

Definition at line 351 of file tuple_set.h.

◆ Clear()

void operations_research::IntTupleSet::Clear ( )
inline

Clears data.

Definition at line 281 of file tuple_set.h.

◆ Contains() [1/2]

bool operations_research::IntTupleSet::Contains ( const std::vector< int > & tuple) const
inline

Checks if the tuple is in the set.

Definition at line 321 of file tuple_set.h.

◆ Contains() [2/2]

bool operations_research::IntTupleSet::Contains ( const std::vector< int64_t > & tuple) const
inline

Definition at line 325 of file tuple_set.h.

◆ Insert() [1/2]

int operations_research::IntTupleSet::Insert ( const std::vector< int > & tuple)
inline

Inserts the tuple to the set. It does nothing if the tuple is already in the set. The size of the tuple must be equal to the arity of the set. It returns the index at which the tuple was inserted (-1 if it was already present).

Definition at line 286 of file tuple_set.h.

◆ Insert() [2/2]

int operations_research::IntTupleSet::Insert ( const std::vector< int64_t > & tuple)
inline

Definition at line 291 of file tuple_set.h.

◆ Insert2()

int operations_research::IntTupleSet::Insert2 ( int64_t v0,
int64_t v1 )
inline

Arity fixed version of Insert removing the need for a vector for the user.

Definition at line 296 of file tuple_set.h.

◆ Insert3()

int operations_research::IntTupleSet::Insert3 ( int64_t v0,
int64_t v1,
int64_t v2 )
inline

Definition at line 303 of file tuple_set.h.

◆ Insert4()

int operations_research::IntTupleSet::Insert4 ( int64_t v0,
int64_t v1,
int64_t v2,
int64_t v3 )
inline

Definition at line 311 of file tuple_set.h.

◆ InsertAll() [1/2]

void operations_research::IntTupleSet::InsertAll ( const std::vector< std::vector< int > > & tuples)
inline

Definition at line 329 of file tuple_set.h.

◆ InsertAll() [2/2]

void operations_research::IntTupleSet::InsertAll ( const std::vector< std::vector< int64_t > > & tuples)
inline

Inserts the tuples.

Definition at line 337 of file tuple_set.h.

◆ NumDifferentValuesInColumn()

int operations_research::IntTupleSet::NumDifferentValuesInColumn ( int col) const
inline

Returns the number of different values in the given column.

Definition at line 355 of file tuple_set.h.

◆ NumTuples()

int operations_research::IntTupleSet::NumTuples ( ) const
inline

Returns the number of tuples.

Definition at line 345 of file tuple_set.h.

◆ RawData()

const int64_t * operations_research::IntTupleSet::RawData ( ) const
inline

Access the raw data, see IntTupleSet::Data::flat_tuples_.

Definition at line 353 of file tuple_set.h.

◆ SortedByColumn()

IntTupleSet operations_research::IntTupleSet::SortedByColumn ( int col) const
inline

Return a copy of the set, sorted by the "col"-th value of each tuples. The sort is stable.

Definition at line 371 of file tuple_set.h.

◆ SortedLexicographically()

IntTupleSet operations_research::IntTupleSet::SortedLexicographically ( ) const
inline

Returns a copy of the tuple set lexicographically sorted.

Definition at line 404 of file tuple_set.h.

◆ Value()

int64_t operations_research::IntTupleSet::Value ( int tuple_index,
int pos_in_tuple ) const
inline

Get the given tuple's value at the given position. The indices of the tuples correspond to the order in which they were inserted.

Definition at line 347 of file tuple_set.h.


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