Gecode::BoolVar Class Reference
Functionality by programming task » Programming models » Using integer variables and constraints » Integer variables

Boolean integer variables. More...

`#include <int.hh>`

## 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 BoolVar &x)
| Print Boolean variable x.

## Constructors and initialization

| BoolVar (void)
| Default constructor.
| BoolVar (const BoolVar &y)
| Initialize from Boolean variable y.
| BoolVar (const Int::BoolView &y)
| Initialize from Boolean view y.
| BoolVar (Space &home, int min, int max)
| Initialize Boolean variable with range 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 | in (int n) const
| Test whether n is contained in domain.

## Boolean domain tests

bool | zero (void) const
| Test whether domain is zero.
bool | one (void) const
| Test whether domain is one.
bool | none (void) const
| Test whether domain is neither zero nor one.

## Additional Inherited Members

Public Types inherited from Gecode::VarImpVar< Int::BoolVarImp >
typedef Int::BoolVarImp | VarImpType
| The variable implementation type corresponding to the variable.
Int::BoolVarImp * | varimp (void) const
| Return variable implementation of variable.
unsigned int | degree (void) const
| Return degree (number of subscribed propagators and advisors).
double | afc (void) const
| Return accumulated failure count.
bool | assigned (void) const
| Test whether view is assigned.
void | update (Space &home, VarImpVar< Int::BoolVarImp > &y)
| Update this variable to be a clone of variable y.
Protected Member Functions inherited from Gecode::VarImpVar< Int::BoolVarImp >
| VarImpVar (void)
| Default constructor.
Protected Attributes inherited from Gecode::VarImpVar< Int::BoolVarImp >
Int::BoolVarImp * | x
| Pointer to variable implementation.

## Detailed Description

Boolean integer variables.

Definition at line 512 of file int.hh.

## Constructor & Destructor Documentation

## BoolVar() [1/4]

Gecode::BoolVar::BoolVar | ( | void |  | ) |

inline

Default constructor.

Definition at line 48 of file bool.hpp.

## BoolVar() [2/4]

Gecode::BoolVar::BoolVar | ( | const BoolVar & | y | ) |

inline

Initialize from Boolean variable y.

Definition at line 50 of file bool.hpp.

## BoolVar() [3/4]

Gecode::BoolVar::BoolVar | ( | const Int::BoolView & | y | ) |

inline

Initialize from Boolean view y.

Definition at line 53 of file bool.hpp.

## BoolVar() [4/4]

Gecode::BoolVar::BoolVar | ( | Space & | home,
|  | int | min,
|  | int | max )

Initialize Boolean 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 is less than 0 or max is greater than 1, an exception of type Gecode::Int::NotZeroOne is thrown.

Definition at line 38 of file bool.cpp.

## Member Function Documentation

## min()

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

inline

Return minimum of domain.

Definition at line 63 of file bool.hpp.

## max()

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

inline

Return maximum of domain.

Definition at line 71 of file bool.hpp.

## med()

int Gecode::BoolVar::med | ( | void |  | ) | const

inline

Return median of domain (greatest element not greater than the median).

Definition at line 67 of file bool.hpp.

## val()

int Gecode::BoolVar::val | ( | void |  | ) | const

inline

Return assigned value.

Throws an exception of type Int::ValOfUnassignedVar if variable is not yet assigned.

Definition at line 57 of file bool.hpp.

## size()

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

inline

Return size (cardinality) of domain.

Definition at line 81 of file bool.hpp.

## width()

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

inline

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

Definition at line 77 of file bool.hpp.

## regret_min()

unsigned int Gecode::BoolVar::regret_min | ( | void |  | ) | const

inline

Return regret of domain minimum (distance to next larger value).

Definition at line 85 of file bool.hpp.

## regret_max()

unsigned int Gecode::BoolVar::regret_max | ( | void |  | ) | const

inline

Return regret of domain maximum (distance to next smaller value).

Definition at line 89 of file bool.hpp.

## range()

bool Gecode::BoolVar::range | ( | void |  | ) | const

inline

Test whether domain is a range.

Definition at line 94 of file bool.hpp.

## in()

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

inline

Test whether n is contained in domain.

Definition at line 98 of file bool.hpp.

## zero()

bool Gecode::BoolVar::zero | ( | void |  | ) | const

inline

Test whether domain is zero.

Definition at line 103 of file bool.hpp.

## one()

bool Gecode::BoolVar::one | ( | void |  | ) | const

inline

Test whether domain is one.

Definition at line 107 of file bool.hpp.

## none()

bool Gecode::BoolVar::none | ( | void |  | ) | const

inline

Test whether domain is neither zero nor one.

Definition at line 111 of file bool.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 BoolVar & | x )

related

Print Boolean variable x.

Definition at line 1 of file print.hpp.

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

- gecode/int.hh
- gecode/int/var/bool.cpp
- gecode/int/var/bool.hpp