Gecode::FloatVar Class Reference
Functionality by programming task » Programming models » Using integer set variables and constraints » Float variables

Float variables. More...

`#include <float.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 FloatVar &x)
| Print float variable x.

## Constructors and initialization

| FloatVar (void)
| Default constructor.
| FloatVar (const FloatVar &y)
| Initialize from float variable y.
| FloatVar (const Float::FloatView &y)
| Initialize from float view y.
| FloatVar (Space &home, FloatNum min, FloatNum max)
| Initialize variable with range domain.

## Value access

FloatVal | domain (void) const
| Return domain.
FloatNum | min (void) const
| Return minimum of domain.
FloatNum | max (void) const
| Return maximum of domain.
FloatNum | med (void) const
| Return median of domain.
FloatNum | size (void) const
| Return size of domain (distance between maximum and minimum).
FloatVal | val (void) const
| Return assigned value.

## Domain tests

bool | in (const FloatVal &n) const
| Test whether n is contained in domain.

## Additional Inherited Members

Public Types inherited from Gecode::VarImpVar< Float::FloatVarImp >
typedef Float::FloatVarImp | VarImpType
| The variable implementation type corresponding to the variable.
Float::FloatVarImp * | 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< Float::FloatVarImp > &y)
| Update this variable to be a clone of variable y.
Protected Member Functions inherited from Gecode::VarImpVar< Float::FloatVarImp >
| VarImpVar (void)
| Default constructor.
Protected Attributes inherited from Gecode::VarImpVar< Float::FloatVarImp >
Float::FloatVarImp * | x
| Pointer to variable implementation.

## Detailed Description

Float variables.

Definition at line 870 of file float.hh.

## Constructor & Destructor Documentation

## FloatVar() [1/4]

Gecode::FloatVar::FloatVar | ( | void |  | ) |

inline

Default constructor.

Definition at line 44 of file float.hpp.

## FloatVar() [2/4]

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

inline

Initialize from float variable y.

Definition at line 46 of file float.hpp.

## FloatVar() [3/4]

Gecode::FloatVar::FloatVar | ( | const Float::FloatView & | y | ) |

inline

Initialize from float view y.

Definition at line 49 of file float.hpp.

## FloatVar() [4/4]

Gecode::FloatVar::FloatVar | ( | Space & | home,
|  | FloatNum | min,
|  | FloatNum | 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::Float::VariableEmptyDomain is thrown.
- If min or max exceed the limits for floats as defined in Gecode::Float::Limits, an exception of type Gecode::Float::OutOfLimits is thrown.

Definition at line 40 of file float.cpp.

## Member Function Documentation

## domain()

FloatVal Gecode::FloatVar::domain | ( | void |  | ) | const

inline

Return domain.

Definition at line 72 of file float.hpp.

## min()

FloatNum Gecode::FloatVar::min | ( | void |  | ) | const

inline

Return minimum of domain.

Definition at line 59 of file float.hpp.

## max()

FloatNum Gecode::FloatVar::max | ( | void |  | ) | const

inline

Return maximum of domain.

Definition at line 67 of file float.hpp.

## med()

FloatNum Gecode::FloatVar::med | ( | void |  | ) | const

inline

Return median of domain.

Definition at line 63 of file float.hpp.

## size()

FloatNum Gecode::FloatVar::size | ( | void |  | ) | const

inline

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

Definition at line 77 of file float.hpp.

## val()

FloatVal Gecode::FloatVar::val | ( | void |  | ) | const

inline

Return assigned value.

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

Definition at line 53 of file float.hpp.

## in()

bool Gecode::FloatVar::in | ( | const FloatVal & | n | ) | const

inline

Test whether n is contained in domain.

Definition at line 82 of file float.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 FloatVar & | x )

related

Print float variable x.

Definition at line 1 of file print.hpp.

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

- gecode/float.hh
- gecode/float/var/float.cpp
- gecode/float/var/float.hpp