Generated on Sat Feb 7 2015 02:01:44 for Gecode by doxygen 1.8.9.1
Gecode::Int::BoolVarImp Class Reference

Boolean variable implementation. More...

#include <var-imp.hpp>

Public Member Functions

 BoolVarImp (Space &home, int min, int max)
 Initialize with range domain. More...
 
- Public Member Functions inherited from Gecode::Int::BoolVarImpBase
 BoolVarImpBase (void)
 Constructor for creating static instance of variable. More...
 
 BoolVarImpBase (Gecode::Space &home)
 Constructor for creating variable. More...
 
void subscribe (Gecode::Space &home, Gecode::Propagator &p, Gecode::PropCond pc, bool assigned, bool schedule)
 Subscribe propagator p with propagation condition pc. More...
 
void subscribe (Gecode::Space &home, Gecode::Advisor &a, bool assigned)
 Subscribe advisor a if assigned is false. More...
 
Gecode::ModEvent notify (Gecode::Space &home, Gecode::ModEvent me, Gecode::Delta &d)
 Notify that variable implementation has been modified with modification event me and delta information d. More...
 
- Public Member Functions inherited from Gecode::VarImp< Gecode::Int::BoolVarImpConf >
 VarImp (Space &home)
 Creation. More...
 
 VarImp (void)
 Creation of static instances. More...
 
VarImpnext (void) const
 Return next copied variable. More...
 
 VarImp (Space &home, bool share, VarImp &x)
 Constructor for cloning. More...
 
bool copied (void) const
 Is variable already copied. More...
 
VarImpforward (void) const
 Use forward pointer if variable already copied. More...
 
void cancel (Space &home, Propagator &p, PropCond pc, bool assigned)
 Cancel subscription of propagator p with propagation condition pc. More...
 
void cancel (Space &home, Advisor &a, bool assigned)
 Cancel subscription of advisor a. More...
 
void subscribe (Space &home, Propagator &p, PropCond pc, bool assigned, ModEvent me, bool schedule)
 Subscribe propagator p with propagation condition pc. More...
 
void subscribe (Space &home, Advisor &a, bool assigned)
 Subscribe advisor a to variable. More...
 
unsigned int degree (void) const
 Return degree (number of subscribed propagators and advisors) More...
 
double afc (const Space &home) const
 Return accumulated failure count (plus degree) More...
 
unsigned int bits (void) const
 Provide access to free bits. More...
 
unsigned int & bits (void)
 Provide access to free bits. More...
 

Domain status access

static const int BITS = 2
 How many bits does the status have. More...
 
static const BoolStatus ZERO = 0
 Status of domain assigned to zero. More...
 
static const BoolStatus ONE = 3
 Status of domain assigned to one. More...
 
static const BoolStatus NONE = 2
 Status of domain not yet assigned. More...
 
BoolStatus status (void) const
 Return current domain status. More...
 

Value access

int min (void) const
 Return minimum of domain. More...
 
int max (void) const
 Return maximum of domain. More...
 
int val (void) const
 Return assigned value (only if assigned) More...
 
int med (void) const
 Return median of domain (greatest element not greater than the median) More...
 
unsigned int size (void) const
 Return size (cardinality) of domain. More...
 
unsigned int width (void) const
 Return width of domain (distance between maximum and minimum) More...
 
unsigned int regret_min (void) const
 Return regret of domain minimum (distance to next larger value) More...
 
unsigned int regret_max (void) const
 Return regret of domain maximum (distance to next smaller value) More...
 

Boolean domain tests

bool zero (void) const
 Test whether variable is assigned to zero. More...
 
bool one (void) const
 Test whether variable is assigned to one. More...
 
bool none (void) const
 Test whether variable is not yet assigned. More...
 

Domain tests

bool range (void) const
 Test whether domain is a range. More...
 
bool assigned (void) const
 Test whether variable is assigned. More...
 
bool in (int n) const
 Test whether n is contained in domain. More...
 
bool in (long long int n) const
 Test whether n is contained in domain. More...
 

Domain update by value

ModEvent lq (Space &home, int n)
 Restrict domain values to be less or equal than n. More...
 
ModEvent lq (Space &home, long long int n)
 Restrict domain values to be less or equal than n. More...
 
ModEvent gq (Space &home, int n)
 Restrict domain values to be greater or equal than n. More...
 
ModEvent gq (Space &home, long long int n)
 Restrict domain values to be greater or equal than n. More...
 
ModEvent nq (Space &home, int n)
 Restrict domain values to be different from n. More...
 
ModEvent nq (Space &home, long long int n)
 Restrict domain values to be different from n. More...
 
ModEvent eq (Space &home, int n)
 Restrict domain values to be equal to n. More...
 
ModEvent eq (Space &home, long long int n)
 Restrict domain values to be equal to n. More...
 

Domain update by iterator

Variable domains can be both updated by range and value iterators. Value iterators do not need to be strict in that the same value is allowed to occur more than once in the iterated sequence.

The argument depends must be true, if the iterator passed as argument depends on the variable implementation on which the operation is invoked. In this case, the variable implementation is only updated after the iterator has been consumed. Otherwise, the domain might be updated concurrently while following the iterator.

template<class I >
ModEvent narrow_r (Space &home, I &i, bool depends=true)
 Replace domain by ranges described by i. More...
 
template<class I >
ModEvent inter_r (Space &home, I &i, bool depends=true)
 Intersect domain with ranges described by i. More...
 
template<class I >
ModEvent minus_r (Space &home, I &i, bool depends=true)
 Remove from domain the ranges described by i. More...
 
template<class I >
ModEvent narrow_v (Space &home, I &i, bool depends=true)
 Replace domain by values described by i. More...
 
template<class I >
ModEvent inter_v (Space &home, I &i, bool depends=true)
 Intersect domain with values described by i. More...
 
template<class I >
ModEvent minus_v (Space &home, I &i, bool depends=true)
 Remove from domain the values described by i. More...
 

Boolean update operations

ModEvent zero (Space &home)
 Assign variable to zero. More...
 
ModEvent one (Space &home)
 Assign variable to one. More...
 
ModEvent zero_none (Space &home)
 Assign unassigned variable to zero. More...
 
ModEvent one_none (Space &home)
 Assign unassigned variable to one. More...
 

Dependencies

void subscribe (Space &home, Propagator &p, PropCond pc, bool schedule=true)
 Subscribe propagator p to variable with propagation condition pc. More...
 
void cancel (Space &home, Propagator &p, PropCond pc)
 Cancel subscription of propagator p with propagation condition pc. More...
 
void subscribe (Space &home, Advisor &a)
 Subscribe advisor a to variable. More...
 
void cancel (Space &home, Advisor &a)
 Cancel subscription of advisor a. More...
 

Variable implementation-dependent propagator support

static void schedule (Space &home, Propagator &p, ModEvent me)
 Schedule propagator p with modification event me. More...
 
static ModEventDelta med (ModEvent me)
 Translate modification event me to modification event delta for view. More...
 

Support for delta information for advisors

static ModEvent modevent (const Delta &d)
 Return modification event. More...
 
static int min (const Delta &d)
 Return minimum value just pruned. More...
 
static int max (const Delta &d)
 Return maximum value just pruned. More...
 
static bool any (const Delta &d)
 Test whether arbitrary values got pruned. More...
 
static bool zero (const Delta &d)
 Test whether a variable has been assigned to zero. More...
 
static bool one (const Delta &d)
 Test whether a variable has been assigned to one. More...
 

Cloning

BoolVarImpcopy (Space &home, bool share)
 Return copy of this variable. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Gecode::VarImp< Gecode::Int::BoolVarImpConf >
static void schedule (Space &home, Propagator &p, ModEvent me, bool force=false)
 Schedule propagator p with modification event me. More...
 
static ModEvent me (const ModEventDelta &med)
 Project modification event for this variable type from med. More...
 
static ModEventDelta med (ModEvent me)
 Translate modification event me into modification event delta. More...
 
static ModEvent me_combine (ModEvent me1, ModEvent me2)
 Combine modifications events me1 and me2. More...
 
static ModEvent modevent (const Delta &d)
 Return modification event. More...
 
static void * operator new (size_t, Space &)
 Allocate memory from space. More...
 
static void operator delete (void *, Space &)
 Return memory to space. More...
 
static void operator delete (void *)
 Needed for exceptions. More...
 
- Public Attributes inherited from Gecode::VarImp< Gecode::Int::BoolVarImpConf >
ActorLink ** base
 Subscribed actors. More...
 
VarImp< Gecode::Int::BoolVarImpConf > * fwd
 Forwarding pointer. More...
 
unsigned int idx [pc_max+1]
 Indices of subscribed actors. More...
 
VarImp< Gecode::Int::BoolVarImpConf > * next
 During cloning, points to the next copied variable. More...
 
- Protected Member Functions inherited from Gecode::Int::BoolVarImpBase
 BoolVarImpBase (Gecode::Space &home, bool share, BoolVarImpBase &x)
 Constructor for cloning x. More...
 
- Protected Member Functions inherited from Gecode::VarImp< Gecode::Int::BoolVarImpConf >
void cancel (Space &home)
 Cancel all subscriptions when variable implementation is assigned. More...
 
bool advise (Space &home, ModEvent me, Delta &d)
 Run advisors when variable implementation has been modified with modification event me and domain change d. More...
 
void schedule (Space &home, PropCond pc1, PropCond pc2, ModEvent me)
 Schedule subscribed propagators. More...
 

Detailed Description

Boolean variable implementation.

Definition at line 486 of file var-imp.hpp.

Constructor & Destructor Documentation

Gecode::Int::BoolVarImp::BoolVarImp ( Space home,
int  min,
int  max 
)
inline

Initialize with range domain.

Definition at line 50 of file bool.hpp.

Member Function Documentation

BoolStatus Gecode::Int::BoolVarImp::status ( void  ) const
inline

Return current domain status.

Definition at line 62 of file bool.hpp.

int Gecode::Int::BoolVarImp::min ( void  ) const
inline

Return minimum of domain.

Definition at line 66 of file bool.hpp.

int Gecode::Int::BoolVarImp::max ( void  ) const
inline

Return maximum of domain.

Definition at line 70 of file bool.hpp.

int Gecode::Int::BoolVarImp::val ( void  ) const
inline

Return assigned value (only if assigned)

Definition at line 79 of file bool.hpp.

int Gecode::Int::BoolVarImp::med ( void  ) const
inline

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

Definition at line 74 of file bool.hpp.

unsigned int Gecode::Int::BoolVarImp::size ( void  ) const
inline

Return size (cardinality) of domain.

Definition at line 100 of file bool.hpp.

unsigned int Gecode::Int::BoolVarImp::width ( void  ) const
inline

Return width of domain (distance between maximum and minimum)

Definition at line 95 of file bool.hpp.

unsigned int Gecode::Int::BoolVarImp::regret_min ( void  ) const
inline

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

Definition at line 105 of file bool.hpp.

unsigned int Gecode::Int::BoolVarImp::regret_max ( void  ) const
inline

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

Definition at line 109 of file bool.hpp.

bool Gecode::Int::BoolVarImp::zero ( void  ) const
inline

Test whether variable is assigned to zero.

Definition at line 135 of file bool.hpp.

bool Gecode::Int::BoolVarImp::one ( void  ) const
inline

Test whether variable is assigned to one.

Definition at line 139 of file bool.hpp.

bool Gecode::Int::BoolVarImp::none ( void  ) const
inline

Test whether variable is not yet assigned.

Definition at line 143 of file bool.hpp.

bool Gecode::Int::BoolVarImp::range ( void  ) const
inline

Test whether domain is a range.

Definition at line 85 of file bool.hpp.

bool Gecode::Int::BoolVarImp::assigned ( void  ) const
inline

Test whether variable is assigned.

Definition at line 89 of file bool.hpp.

bool Gecode::Int::BoolVarImp::in ( int  n) const
inline

Test whether n is contained in domain.

Definition at line 121 of file bool.hpp.

bool Gecode::Int::BoolVarImp::in ( long long int  n) const
inline

Test whether n is contained in domain.

Definition at line 125 of file bool.hpp.

ModEvent Gecode::Int::BoolVarImp::lq ( Space home,
int  n 
)
inline

Restrict domain values to be less or equal than n.

Definition at line 214 of file bool.hpp.

ModEvent Gecode::Int::BoolVarImp::lq ( Space home,
long long int  n 
)
inline

Restrict domain values to be less or equal than n.

Definition at line 220 of file bool.hpp.

ModEvent Gecode::Int::BoolVarImp::gq ( Space home,
int  n 
)
inline

Restrict domain values to be greater or equal than n.

Definition at line 201 of file bool.hpp.

ModEvent Gecode::Int::BoolVarImp::gq ( Space home,
long long int  n 
)
inline

Restrict domain values to be greater or equal than n.

Definition at line 207 of file bool.hpp.

ModEvent Gecode::Int::BoolVarImp::nq ( Space home,
int  n 
)
inline

Restrict domain values to be different from n.

Definition at line 238 of file bool.hpp.

ModEvent Gecode::Int::BoolVarImp::nq ( Space home,
long long int  n 
)
inline

Restrict domain values to be different from n.

Definition at line 243 of file bool.hpp.

ModEvent Gecode::Int::BoolVarImp::eq ( Space home,
int  n 
)
inline

Restrict domain values to be equal to n.

Definition at line 227 of file bool.hpp.

ModEvent Gecode::Int::BoolVarImp::eq ( Space home,
long long int  n 
)
inline

Restrict domain values to be equal to n.

Definition at line 232 of file bool.hpp.

template<class I >
ModEvent Gecode::Int::BoolVarImp::narrow_r ( Space home,
I &  i,
bool  depends = true 
)
inline

Replace domain by ranges described by i.

Definition at line 276 of file bool.hpp.

template<class I >
ModEvent Gecode::Int::BoolVarImp::inter_r ( Space home,
I &  i,
bool  depends = true 
)
inline

Intersect domain with ranges described by i.

Definition at line 297 of file bool.hpp.

template<class I >
ModEvent Gecode::Int::BoolVarImp::minus_r ( Space home,
I &  i,
bool  depends = true 
)
inline

Remove from domain the ranges described by i.

Definition at line 314 of file bool.hpp.

template<class I >
ModEvent Gecode::Int::BoolVarImp::narrow_v ( Space home,
I &  i,
bool  depends = true 
)
inline

Replace domain by values described by i.

Definition at line 332 of file bool.hpp.

template<class I >
ModEvent Gecode::Int::BoolVarImp::inter_v ( Space home,
I &  i,
bool  depends = true 
)
inline

Intersect domain with values described by i.

Definition at line 351 of file bool.hpp.

template<class I >
ModEvent Gecode::Int::BoolVarImp::minus_v ( Space home,
I &  i,
bool  depends = true 
)
inline

Remove from domain the values described by i.

Definition at line 370 of file bool.hpp.

ModEvent Gecode::Int::BoolVarImp::zero ( Space home)
inline

Assign variable to zero.

Definition at line 183 of file bool.hpp.

ModEvent Gecode::Int::BoolVarImp::one ( Space home)
inline

Assign variable to one.

Definition at line 189 of file bool.hpp.

ModEvent Gecode::Int::BoolVarImp::zero_none ( Space home)

Assign unassigned variable to zero.

Definition at line 55 of file bool.cpp.

ModEvent Gecode::Int::BoolVarImp::one_none ( Space home)

Assign unassigned variable to one.

Definition at line 46 of file bool.cpp.

void Gecode::Int::BoolVarImp::subscribe ( Space home,
Propagator p,
PropCond  pc,
bool  schedule = true 
)
inline

Subscribe propagator p to variable with propagation condition pc.

In case schedule is false, the propagator is just subscribed but not scheduled for execution (this must be used when creating subscriptions during propagation).

The propagation condition pc can be a propagation condition for integer variables, which will be mapped to PC_BOOL_VAL.

Definition at line 395 of file bool.hpp.

void Gecode::Int::BoolVarImp::cancel ( Space home,
Propagator p,
PropCond  pc 
)
inline

Cancel subscription of propagator p with propagation condition pc.

The propagation condition pc can be a propagation condition for integer variables, which will be mapped to PC_BOOL_VAL.

Definition at line 402 of file bool.hpp.

void Gecode::Int::BoolVarImp::subscribe ( Space home,
Advisor a 
)
inline

Subscribe advisor a to variable.

Definition at line 407 of file bool.hpp.

void Gecode::Int::BoolVarImp::cancel ( Space home,
Advisor a 
)
inline

Cancel subscription of advisor a.

Definition at line 411 of file bool.hpp.

void Gecode::Int::BoolVarImp::schedule ( Space home,
Propagator p,
ModEvent  me 
)
inlinestatic

Schedule propagator p with modification event me.

The modfication event me can be a modification event for integer variables, however me will be ignored if it is not ME_INT_VAL (or ME_BOOL_VAL).

Definition at line 416 of file bool.hpp.

ModEventDelta Gecode::Int::BoolVarImp::med ( ModEvent  me)
inlinestatic

Translate modification event me to modification event delta for view.

Definition at line 422 of file bool.hpp.

ModEvent Gecode::Int::BoolVarImp::modevent ( const Delta d)
inlinestatic

Return modification event.

Definition at line 153 of file bool.hpp.

int Gecode::Int::BoolVarImp::min ( const Delta d)
inlinestatic

Return minimum value just pruned.

Definition at line 157 of file bool.hpp.

int Gecode::Int::BoolVarImp::max ( const Delta d)
inlinestatic

Return maximum value just pruned.

Definition at line 161 of file bool.hpp.

bool Gecode::Int::BoolVarImp::any ( const Delta d)
inlinestatic

Test whether arbitrary values got pruned.

Definition at line 165 of file bool.hpp.

bool Gecode::Int::BoolVarImp::zero ( const Delta d)
inlinestatic

Test whether a variable has been assigned to zero.

Definition at line 169 of file bool.hpp.

bool Gecode::Int::BoolVarImp::one ( const Delta d)
inlinestatic

Test whether a variable has been assigned to one.

Definition at line 173 of file bool.hpp.

BoolVarImp * Gecode::Int::BoolVarImp::copy ( Space home,
bool  share 
)
inline

Return copy of this variable.

Definition at line 258 of file bool.hpp.

Member Data Documentation

const int Gecode::Int::BoolVarImp::BITS = 2
static

How many bits does the status have.

Definition at line 514 of file var-imp.hpp.

const BoolStatus Gecode::Int::BoolVarImp::ZERO = 0
static

Status of domain assigned to zero.

Definition at line 516 of file var-imp.hpp.

const BoolStatus Gecode::Int::BoolVarImp::ONE = 3
static

Status of domain assigned to one.

Definition at line 518 of file var-imp.hpp.

const BoolStatus Gecode::Int::BoolVarImp::NONE = 2
static

Status of domain not yet assigned.

Definition at line 520 of file var-imp.hpp.


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