Gecode::IntSet Class Reference
Functionality by programming task » Programming models » Using integer variables and constraints » Integer variables | Functionality by programming task » Programming models » Using integer set variables and constraints » Set variables

Integer sets. More...

`#include <int.hh>`

## Classes

class | MinInc
| Sort ranges according to increasing minimum. More...

## Public Member Functions

template<>
| IntSet (const std::vector< int > &r)
| Initialize with integers from vector r.
template<>
| IntSet (const std::vector< std::pair< int, int > > &r)
| Initialize with ranges from vector r.
Public Member Functions inherited from Gecode::SharedHandle
| SharedHandle (void)
| Create shared handle with no object pointing to.
| SharedHandle (SharedHandle::Object *so)
| Create shared handle that points to shared object so.
| SharedHandle (const SharedHandle &sh)
| Copy constructor maintaining reference count.
SharedHandle & | operator= (const SharedHandle &sh)
| Assignment operator maintaining reference count.
| ~SharedHandle (void)
| Destructor that maintains reference count.
| operator bool (void) const
| Whether handle points to an object.

## Related Symbols

(Note that these are not member symbols.)
template<class Char, class Traits>
std::basic_ostream< Char, Traits > & | operator<< (std::basic_ostream< Char, Traits > &os, const IntSet &s)
| Print integer set s.

## Predefined value

static const IntSet | empty
| Empty set.

## Constructors and initialization

| IntSet (void)
| Initialize as empty set.
| IntSet (int n, int m)
| Initialize as range with minimum n and maximum m.
| IntSet (const int r[], int n)
| Initialize with n integers from array r.
| IntSet (const int r[][2], int n)
| Initialize with n ranges from array r.
template<class I>
| IntSet (I &i)
| Initialize with range iterator i.
template<class I>
| IntSet (const I &i)
| Initialize with range iterator i.
| IntSet (std::initializer_list< int > r)
| Initialize with integers from list r.
| IntSet (std::initializer_list< std::pair< int, int > > r)
| Initialize with ranges from vector r.

## Range access

int | ranges (void) const
| Return number of ranges of the specification.
int | min (int i) const
| Return minimum of range at position i.
int | max (int i) const
| Return maximum of range at position i.
unsigned int | width (int i) const
| Return width of range at position i.

## Entire set access

bool | in (int n) const
| Return whether n is included in the set.
unsigned int | size (void) const
| Return size (cardinality) of set.
unsigned int | width (void) const
| Return width of set (distance between maximum and minimum).
int | min (void) const
| Return minimum of entire set.
int | max (void) const
| Return maximum of entire set.

## Equality tests

bool | operator== (const IntSet &s) const
| Return whether s is equal.
bool | operator!= (const IntSet &s) const
| Return whether s is not equal.

## Additional Inherited Members

Protected Member Functions inherited from Gecode::SharedHandle
SharedHandle::Object * | object (void) const
| Access to the shared object.
void | object (SharedHandle::Object *n)
| Modify shared object.

## Detailed Description

Integer sets.

Integer sets are the means to specify arbitrary sets of integers to be used as domains for integer variables.

Definition at line 174 of file int.hh.

## Constructor & Destructor Documentation

## IntSet() [1/10]

Gecode::IntSet::IntSet | ( | void |  | ) |

inline

Initialize as empty set.

Definition at line 43 of file int-set-1.hpp.

## IntSet() [2/10]

Gecode::IntSet::IntSet | ( | int | n,
|  | int | m )

inline explicit

Initialize as range with minimum n and maximum m.

Note that the set is empty if n is larger than m

Definition at line 147 of file int-set-1.hpp.

## IntSet() [3/10]

Gecode::IntSet::IntSet | ( | const int | r[],
|  | int | n )

inline explicit

Initialize with n integers from array r.

Definition at line 103 of file int-set-1.hpp.

## IntSet() [4/10]

Gecode::IntSet::IntSet | ( | const int | r[][2],
|  | int | n )

inline explicit

Initialize with n ranges from array r.

For position i in the array r, the minimum is r[i][0] and the maximum is r[i][1].

Definition at line 97 of file int-set-1.hpp.

## IntSet() [5/10]

template<class I>

Gecode::IntSet::IntSet | ( | I & | i | ) |

explicit

Initialize with range iterator i.

Initialize integer set with iterator.

Definition at line 86 of file int-set-1.hpp.

## IntSet() [6/10]

template<class I>

Gecode::IntSet::IntSet | ( | const I & | i | ) |

explicit

Initialize with range iterator i.

Initialize integer set with iterator.

Definition at line 92 of file int-set-1.hpp.

## IntSet() [7/10]

Gecode::IntSet::IntSet | ( | std::initializer_list< int > | r | ) |

explicit

Initialize with integers from list r.

Definition at line 150 of file int-set.cpp.

## IntSet() [8/10]

Gecode::IntSet::IntSet | ( | std::initializer_list< std::pair< int, int > > | r | ) |

explicit

Initialize with ranges from vector r.

The minimum is the first element and the maximum is the second element.

Definition at line 162 of file int-set.cpp.

## IntSet() [9/10]

template<>

Gecode::IntSet::IntSet | ( | const std::vector< int > & | r | ) |

inline

Initialize with integers from vector r.

Definition at line 111 of file int-set-1.hpp.

## IntSet() [10/10]

template<>

Gecode::IntSet::IntSet | ( | const std::vector< std::pair< int, int > > & | r | ) |

inline

Initialize with ranges from vector r.

The minimum is the first element and the maximum is the second element.

Definition at line 129 of file int-set-1.hpp.

## Member Function Documentation

## ranges()

int Gecode::IntSet::ranges | ( | void |  | ) | const

inline

Return number of ranges of the specification.

Definition at line 171 of file int-set-1.hpp.

## min() [1/2]

int Gecode::IntSet::min | ( | int | i | ) | const

inline

Return minimum of range at position i.

Definition at line 152 of file int-set-1.hpp.

## max() [1/2]

int Gecode::IntSet::max | ( | int | i | ) | const

inline

Return maximum of range at position i.

Definition at line 158 of file int-set-1.hpp.

## width() [1/2]

unsigned int Gecode::IntSet::width | ( | int | i | ) | const

inline

Return width of range at position i.

Definition at line 164 of file int-set-1.hpp.

## in()

bool Gecode::IntSet::in | ( | int | n | ) | const

inline

Return whether n is included in the set.

Definition at line 177 of file int-set-1.hpp.

## size()

unsigned int Gecode::IntSet::size | ( | void |  | ) | const

inline

Return size (cardinality) of set.

Definition at line 198 of file int-set-1.hpp.

## width() [2/2]

unsigned int Gecode::IntSet::width | ( | void |  | ) | const

inline

Return width of set (distance between maximum and minimum).

Definition at line 204 of file int-set-1.hpp.

## min() [2/2]

int Gecode::IntSet::min | ( | void |  | ) | const

inline

Return minimum of entire set.

Definition at line 186 of file int-set-1.hpp.

## max() [2/2]

int Gecode::IntSet::max | ( | void |  | ) | const

inline

Return maximum of entire set.

Definition at line 192 of file int-set-1.hpp.

## operator==()

bool Gecode::IntSet::operator== | ( | const IntSet & | s | ) | const

inline

Return whether s is equal.

Definition at line 210 of file int-set-1.hpp.

## operator!=()

bool Gecode::IntSet::operator!= | ( | const IntSet & | s | ) | const

inline

Return whether s is not equal.

Definition at line 223 of file int-set-1.hpp.

## Friends And Related Symbol Documentation

## operator<<()

template<class Char, class Traits>

std::basic_ostream< Char, Traits > & operator<< | ( | std::basic_ostream< Char, Traits > & | os,
|  | const IntSet & | s )

related

Print integer set s.

Definition at line 285 of file int-set-1.hpp.

## Member Data Documentation

## empty

const IntSet Gecode::IntSet::empty

static

Empty set.

Definition at line 283 of file int.hh.

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

- gecode/int.hh
- gecode/int/int-set-1.hpp
- gecode/int/int-set.cpp