Infrared
Loading...
Searching...
No Matches
ired::FiniteDomain Class Reference

#include <finite_domain.hpp>

Public Member Functions

 FiniteDomain (int domsize=0)
 construct as domain 0..(domain size - 1)
 
 FiniteDomain (std::pair< int, int > bounds)
 construct as contiguous domain lb..ub
 
 FiniteDomain (int lb, int ub)
 construct as contiguous domain lb..ub
 
bool empty () const
 empty domain return emtpy?
 
int size () const
 size of the domain
 
int lb () const
 lower bound
 
int ub () const
 upper bound
 
void inc (int &v) const
 increment domain value
 
int undet () const
 undetermined
 
bool in (int v) const
 test domain membership
 

Detailed Description

Specification of a finite domain

Note
Even if currently only contiguous domains are supported, users shouldn't assume this, but use the provided methods to manipulate domain values.

Constructor & Destructor Documentation

◆ FiniteDomain() [1/3]

ired::FiniteDomain::FiniteDomain ( int  domsize = 0)
inlineexplicit

construct as domain 0..(domain size - 1)

Parameters
domsizesize of the domain

◆ FiniteDomain() [2/3]

ired::FiniteDomain::FiniteDomain ( std::pair< int, int >  bounds)
inlineexplicit

construct as contiguous domain lb..ub

Parameters
boundslower and upper bound
Note
both, lower and upper bound, are included in the domain

◆ FiniteDomain() [3/3]

ired::FiniteDomain::FiniteDomain ( int  lb,
int  ub 
)
inline

construct as contiguous domain lb..ub

Parameters
lblower bound
ubupper bound
Note
both, lower and upper bound, are included in the domain

Member Function Documentation

◆ empty()

bool ired::FiniteDomain::empty ( ) const
inline

empty domain return emtpy?

Note
domains are empty whenever ub < lb

◆ in()

bool ired::FiniteDomain::in ( int  v) const
inline

test domain membership

Parameters
valuea domain value
Returns
whether v is in the domain

◆ inc()

void ired::FiniteDomain::inc ( int &  v) const
inline

increment domain value

Parameters
va domain value

Sets v to the next larger domain value after v or the lowest domain value if v was undetermined.

Note
undefined behavior if v neither in the domain nor 'undet', which has to be lb_-1
if v was the last domain variable, then afterwards, in(v) is false and v exceeds the upper bound.

◆ lb()

int ired::FiniteDomain::lb ( ) const
inline

lower bound

Returns
bound

◆ size()

int ired::FiniteDomain::size ( ) const
inline

size of the domain

Returns
size

◆ ub()

int ired::FiniteDomain::ub ( ) const
inline

upper bound

Returns
bound

◆ undet()

int ired::FiniteDomain::undet ( ) const
inline

undetermined

Returns
domain-specific undetermined value

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