Gecode::IntVar Class Reference
[Integer variables]
Integer variables. More...
#include <int.hh>
Related Functions | |
(Note that these are not member functions.) | |
template<class Char , class Traits > | |
std::basic_ostream< Char, Traits > & | operator<< (std::basic_ostream< Char, Traits > &os, const IntVar &x) |
Print integer variable x. | |
Constructors and initialization | |
| |
IntVar (void) | |
Default constructor. | |
IntVar (const IntVar &x) | |
Initialize from integer variable x. | |
IntVar (const Int::IntView &x) | |
Initialize from integer view x. | |
IntVar (Space &home, int min, int max) | |
Initialize variable with range domain. | |
IntVar (Space &home, const IntSet &d) | |
Initialize variable with arbitrary domain. | |
void | init (Space &home, int min, int max) |
Initialize variable with range domain. | |
void | init (Space &home, const IntSet &d) |
Initialize variable with arbitrary domain. | |
Value access | |
| |
int | min (void) const |
Return minimum of domain. | |
int | max (void) const |
Return maximum of domain. | |
int | med (void) const |
Return median of domain (greatest element not greater than the median). | |
int | val (void) const |
Return assigned value. | |
unsigned int | size (void) const |
Return size (cardinality) of domain. | |
unsigned int | width (void) const |
Return width of domain (distance between maximum and minimum). | |
unsigned int | regret_min (void) const |
Return regret of domain minimum (distance to next larger value). | |
unsigned int | regret_max (void) const |
Return regret of domain maximum (distance to next smaller value). | |
Domain tests | |
| |
bool | range (void) const |
Test whether domain is a range. | |
bool | assigned (void) const |
Test whether view is assigned. | |
bool | in (int n) const |
Test whether n is contained in domain. | |
Cloning | |
| |
void | update (Space &home, bool share, IntVar &x) |
Update this variable to be a clone of variable x. |
Detailed Description
Integer variables.
Definition at line 336 of file int.hh.
Constructor & Destructor Documentation
Gecode::IntVar::IntVar | ( | void | ) | [inline] |
Gecode::IntVar::IntVar | ( | const IntVar & | x | ) | [inline] |
Gecode::IntVar::IntVar | ( | const Int::IntView & | x | ) | [inline] |
Gecode::IntVar::IntVar | ( | Space & | home, | |
int | min, | |||
int | max | |||
) |
Initialize variable with range domain.
The variable is created with a domain ranging from min to max. The following exceptions might be thrown:
- If min is greater than max, an exception of type Gecode::Int::VariableEmptyDomain is thrown.
- If min or max exceed the limits for integers as defined in Gecode::Int::Limits, an exception of type Gecode::Int::OutOfLimits is thrown.
Initialize variable with arbitrary domain.
The variable is created with a domain described by d. The following exceptions might be thrown:
- If d is empty, an exception of type Gecode::Int::VariableEmptyDomain is thrown.
- If d contains values that exceed the limits for integers as defined in Gecode::Int::Limits, an exception of type Gecode::Int::OutOfLimits is thrown.
Member Function Documentation
void Gecode::IntVar::init | ( | Space & | home, | |
int | min, | |||
int | max | |||
) |
Initialize variable with range domain.
The variable is created with a domain ranging from min to max. The following exceptions might be thrown:
- If min is greater than max, an exception of type Gecode::Int::VariableEmptyDomain is thrown.
- If min or max exceed the limits for integers as defined in Gecode::Int::Limits, an exception of type Gecode::Int::OutOfLimits is thrown.
Initialize variable with arbitrary domain.
The variable is created with a domain described by d. The following exceptions might be thrown:
- If d is empty, an exception of type Gecode::Int::VariableEmptyDomain is thrown.
- If d contains values that exceed the limits for integers as defined in Gecode::Int::Limits, an exception of type Gecode::Int::OutOfLimits is thrown.
int Gecode::IntVar::min | ( | void | ) | const [inline] |
int Gecode::IntVar::max | ( | void | ) | const [inline] |
int Gecode::IntVar::med | ( | void | ) | const [inline] |
int Gecode::IntVar::val | ( | void | ) | const [inline] |
Return assigned value.
Throws an exception of type Int::ValOfUnassignedVar if variable is not yet assigned.
unsigned int Gecode::IntVar::size | ( | void | ) | const [inline] |
unsigned int Gecode::IntVar::width | ( | void | ) | const [inline] |
unsigned int Gecode::IntVar::regret_min | ( | void | ) | const [inline] |
unsigned int Gecode::IntVar::regret_max | ( | void | ) | const [inline] |
bool Gecode::IntVar::range | ( | void | ) | const [inline] |
bool Gecode::IntVar::assigned | ( | void | ) | const [inline] |
bool Gecode::IntVar::in | ( | int | n | ) | const [inline] |
Friends And Related Function Documentation
std::basic_ostream< Char, Traits > & operator<< | ( | std::basic_ostream< Char, Traits > & | os, | |
const IntVar & | x | |||
) | [related] |
The documentation for this class was generated from the following files:
- gecode/int.hh (Revision: 10571)
- gecode/int/var/int.cpp (Revision: 8082)
- gecode/int/var/int.hpp (Revision: 9376)