Generated on Tue Feb 11 2025 17:33:26 for Gecode by doxygen 1.12.0

Finite integer set variable implementation. More...

#include <var-imp.hpp>

Protected Member Functions

 SetVarImp (Space &home, SetVarImp &x)
 Constructor for cloning x.
 
- Protected Member Functions inherited from Gecode::Set::SetVarImpBase
 SetVarImpBase (Gecode::Space &home, SetVarImpBase &x)
 Constructor for cloning x.
 
- Protected Member Functions inherited from Gecode::VarImp< Gecode::Set::SetVarImpConf >
void cancel (Space &home)
 Cancel all subscriptions when variable implementation is assigned.
 
bool advise (Space &home, ModEvent me, Delta &d)
 Run advisors when variable implementation has been modified with modification event me and domain change d.
 
ModEvent fail (Space &home)
 Run advisors to be run on failure and returns ME_GEN_FAILED.
 
void schedule (Space &home, PropCond pc1, PropCond pc2, ModEvent me)
 Schedule subscribed propagators.
 

Constructors and initialization

 SetVarImp (Space &home)
 Initialize with empty lower and full upper bound.
 
 SetVarImp (Space &home, int glbMin, int glbMax, int lubMin, int lubMax, unsigned int cardMin=0, unsigned int cardMax=Limits::card)
 Initialize with given bounds and cardinality.
 
 SetVarImp (Space &home, const IntSet &glbD, int lubMin, int lubMax, unsigned int cardMin, unsigned int cardMax)
 Initialize with given bounds and cardinality.
 
 SetVarImp (Space &home, int glbMin, int glbMax, const IntSet &lubD, unsigned int cardMin, unsigned int cardMax)
 Initialize with given bounds and cardinality.
 
 SetVarImp (Space &home, const IntSet &glbD, const IntSet &lubD, unsigned int cardMin, unsigned int cardMax)
 Initialize with given bounds and cardinality.
 

Value access

unsigned int cardMin (void) const
 Return current cardinality minimum.
 
unsigned int cardMax (void) const
 Return current cardinality maximum.
 
int lubMin (void) const
 Return minimum of the least upper bound.
 
int lubMax (void) const
 Return maximum of the least upper bound.
 
int lubMinN (unsigned int n) const
 Return n -th smallest element in the least upper bound.
 
int glbMin (void) const
 Return minimum of the greatest lower bound.
 
int glbMax (void) const
 Return maximum of the greatest lower bound.
 
unsigned int glbSize (void) const
 Return the size of the greatest lower bound.
 
unsigned int lubSize (void) const
 Return the size of the least upper bound.
 

Domain tests

bool assigned (void) const
 Test whether variable is assigned.
 
bool knownIn (int n) const
 Test whether n is contained in greatest lower bound.
 
bool knownOut (int) const
 Test whether n is not contained in least upper bound.
 

Domain update by value

ModEvent include (Space &home, int n)
 Include n in the greatest lower bound.
 
ModEvent include (Space &home, int i, int j)
 Include the range $\{i,\dots,j\}$ in the greatest lower bound.
 
ModEvent exclude (Space &home, int n)
 Exclude n from the least upper bound.
 
ModEvent exclude (Space &home, int i, int j)
 Exclude the range $\{i,\dots,j\}$ from the least upper bound.
 
ModEvent intersect (Space &home, int n)
 Exclude everything but n from the least upper bound.
 
ModEvent intersect (Space &home, int i, int j)
 Exclude everything but the range $\{i,\dots,j\}$ from the least upper bound.
 
ModEvent cardMin (Space &home, unsigned int n)
 Restrict cardinality to be at least n.
 
ModEvent cardMax (Space &home, unsigned int n)
 Restrict cardinality to be at most n.
 

Domain update by range iterator

template<class I >
ModEvent includeI (Space &home, I &i)
 Include set described by i in the greatest lower bound.
 
template<class I >
ModEvent excludeI (Space &home, I &i)
 Exclude set described by i from the least upper bound.
 
template<class I >
ModEvent intersectI (Space &home, I &i)
 Exclude everything but set described by i from the least upper bound.
 

Dependencies

void subscribe (Space &home, Propagator &p, PropCond pc, bool schedule=true)
 Subscribe propagator p with propagation condition pc to variable.
 
void reschedule (Space &home, Propagator &p, PropCond pc)
 Re-schedule propagator p with propagation condition pc.
 
void subscribe (Space &home, Advisor &a, bool fail)
 Subscribe advisor a to variable.
 

Cloning

SetVarImpcopy (Space &home)
 Return copy of this variable.
 

Delta information for advisors

static int glbMin (const Delta &d)
 Return minimum value just pruned from glb.
 
static int glbMax (const Delta &d)
 Return maximum value just pruned from glb.
 
static bool glbAny (const Delta &d)
 Test whether arbitrary values got pruned from glb.
 
static int lubMin (const Delta &d)
 Return minimum value just pruned from lub.
 
static int lubMax (const Delta &d)
 Return maximum value just pruned from lub.
 
static bool lubAny (const Delta &d)
 Test whether arbitrary values got pruned from lub.
 

Additional Inherited Members

- Public Member Functions inherited from Gecode::Set::SetVarImpBase
 SetVarImpBase (void)
 Constructor for creating static instance of variable.
 
 SetVarImpBase (Gecode::Space &home)
 Constructor for creating variable.
 
void subscribe (Gecode::Space &home, Gecode::Propagator &p, Gecode::PropCond pc, bool assigned, bool schedule)
 Subscribe propagator p with propagation condition pc.
 
void subscribe (Gecode::Space &home, Gecode::Advisor &a, bool assigned, bool failed)
 Subscribe advisor a if assigned is false.
 
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.
 
void reschedule (Gecode::Space &home, Gecode::Propagator &p, Gecode::PropCond pc, bool assigned)
 Re-schedule propagator p.
 
- Public Member Functions inherited from Gecode::VarImp< Gecode::Set::SetVarImpConf >
 VarImp (Space &home)
 Creation.
 
 VarImp (void)
 Creation of static instances.
 
VarImpnext (void) const
 Return next copied variable.
 
 VarImp (Space &home, VarImp &x)
 Constructor for cloning.
 
bool copied (void) const
 Is variable already copied.
 
VarImpforward (void) const
 Use forward pointer if variable already copied.
 
void cancel (Space &home, Propagator &p, PropCond pc)
 Cancel subscription of propagator p with propagation condition pc.
 
void cancel (Space &home, Advisor &a, bool fail)
 Cancel subscription of advisor a.
 
void subscribe (Space &home, Propagator &p, PropCond pc, bool assigned, ModEvent me, bool schedule)
 Subscribe propagator p with propagation condition pc.
 
void subscribe (Space &home, Advisor &a, bool assigned, bool fail)
 Subscribe advisor a to variable.
 
unsigned int degree (void) const
 Return degree (number of subscribed propagators and advisors)
 
double afc (void) const
 Return accumulated failure count (plus degree)
 
unsigned int bits (void) const
 Provide access to free bits.
 
unsigned int & bits (void)
 Provide access to free bits.
 
- Static Public Member Functions inherited from Gecode::Set::SetVarImpBase
static void schedule (Gecode::Space &home, Gecode::Propagator &p, Gecode::ModEvent me)
 Schedule propagator p.
 
- Static Public Member Functions inherited from Gecode::VarImp< Gecode::Set::SetVarImpConf >
static void schedule (Space &home, Propagator &p, ModEvent me, bool force=false)
 Schedule propagator p with modification event me.
 
static void reschedule (Space &home, Propagator &p, PropCond pc, bool assigned, ModEvent me)
 Schedule propagator p.
 
static ModEvent me (const ModEventDelta &med)
 Project modification event for this variable type from med.
 
static ModEventDelta med (ModEvent me)
 Translate modification event me into modification event delta.
 
static ModEvent me_combine (ModEvent me1, ModEvent me2)
 Combine modifications events me1 and me2.
 
static ModEvent modevent (const Delta &d)
 Return modification event.
 
static void * operator new (size_t, Space &)
 Allocate memory from space.
 
static void operator delete (void *, Space &)
 Return memory to space.
 
static void operator delete (void *)
 Needed for exceptions.
 
- Public Attributes inherited from Gecode::VarImp< Gecode::Set::SetVarImpConf >
ActorLink ** base
 Subscribed actors.
 
VarImp< Gecode::Set::SetVarImpConf > * fwd
 Forwarding pointer.
 
unsigned int idx [pc_max+1]
 Indices of subscribed actors.
 
VarImp< Gecode::Set::SetVarImpConf > * next
 During cloning, points to the next copied variable.
 

Detailed Description

Finite integer set variable implementation.

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

Constructor & Destructor Documentation

◆ SetVarImp() [1/6]

Gecode::Set::SetVarImp::SetVarImp ( Space & home,
SetVarImp & x )
inlineprotected

Constructor for cloning x.

Definition at line 117 of file set.cpp.

◆ SetVarImp() [2/6]

Gecode::Set::SetVarImp::SetVarImp ( Space & home)
inline

Initialize with empty lower and full upper bound.

Definition at line 48 of file set.hpp.

◆ SetVarImp() [3/6]

Gecode::Set::SetVarImp::SetVarImp ( Space & home,
int glbMin,
int glbMax,
int lubMin,
int lubMax,
unsigned int cardMin = 0,
unsigned int cardMax = Limits::card )
inline

Initialize with given bounds and cardinality.

Creates a set variable $s$ with $\mathit{glb}(s)=\{\mathit{glbMin},\dots,\mathit{glbMax}\}$, $\mathit{lub}(s)=\{\mathit{lubMin},\dots,\mathit{lubMax}\}$, and $\mathit{cardMin}\leq |s|\leq\mathit{cardMax}$

Definition at line 55 of file set.hpp.

◆ SetVarImp() [4/6]

Gecode::Set::SetVarImp::SetVarImp ( Space & home,
const IntSet & glbD,
int lubMin,
int lubMax,
unsigned int cardMin,
unsigned int cardMax )
inline

Initialize with given bounds and cardinality.

Creates a set variable $s$ with $\mathit{glb}(s)=\mathit{glbD}$, $\mathit{lub}(s)=\{\mathit{lubMin},\dots,\mathit{lubMax}\}$, and $\mathit{cardMin}\leq |s|\leq\mathit{cardMax}$

Definition at line 64 of file set.hpp.

◆ SetVarImp() [5/6]

Gecode::Set::SetVarImp::SetVarImp ( Space & home,
int glbMin,
int glbMax,
const IntSet & lubD,
unsigned int cardMin,
unsigned int cardMax )
inline

Initialize with given bounds and cardinality.

Creates a set variable $s$ with $\mathit{glb}(s)=\{\mathit{glbMin},\dots,\mathit{glbMax}\}$, $\mathit{lub}(s)=\mathit{lubD}$, and $\mathit{cardMin}\leq |s|\leq\mathit{cardMax}$

Definition at line 74 of file set.hpp.

◆ SetVarImp() [6/6]

Gecode::Set::SetVarImp::SetVarImp ( Space & home,
const IntSet & glbD,
const IntSet & lubD,
unsigned int cardMin,
unsigned int cardMax )
inline

Initialize with given bounds and cardinality.

Creates a set variable $s$ with $\mathit{glb}(s)=\mathit{glbD}$, $\mathit{lub}(s)=\mathit{lubD}$, and $\mathit{cardMin}\leq |s|\leq\mathit{cardMax}$

Definition at line 84 of file set.hpp.

Member Function Documentation

◆ cardMin() [1/2]

unsigned int Gecode::Set::SetVarImp::cardMin ( void ) const
inline

Return current cardinality minimum.

Definition at line 99 of file set.hpp.

◆ cardMax() [1/2]

unsigned int Gecode::Set::SetVarImp::cardMax ( void ) const
inline

Return current cardinality maximum.

Definition at line 102 of file set.hpp.

◆ lubMin() [1/2]

int Gecode::Set::SetVarImp::lubMin ( void ) const
inline

Return minimum of the least upper bound.

Definition at line 111 of file set.hpp.

◆ lubMax() [1/2]

int Gecode::Set::SetVarImp::lubMax ( void ) const
inline

Return maximum of the least upper bound.

Definition at line 114 of file set.hpp.

◆ lubMinN()

int Gecode::Set::SetVarImp::lubMinN ( unsigned int n) const
inline

Return n -th smallest element in the least upper bound.

Definition at line 117 of file set.hpp.

◆ glbMin() [1/2]

int Gecode::Set::SetVarImp::glbMin ( void ) const
inline

Return minimum of the greatest lower bound.

Definition at line 120 of file set.hpp.

◆ glbMax() [1/2]

int Gecode::Set::SetVarImp::glbMax ( void ) const
inline

Return maximum of the greatest lower bound.

Definition at line 123 of file set.hpp.

◆ glbSize()

unsigned int Gecode::Set::SetVarImp::glbSize ( void ) const
inline

Return the size of the greatest lower bound.

Definition at line 126 of file set.hpp.

◆ lubSize()

unsigned int Gecode::Set::SetVarImp::lubSize ( void ) const
inline

Return the size of the least upper bound.

Definition at line 129 of file set.hpp.

◆ assigned()

bool Gecode::Set::SetVarImp::assigned ( void ) const
inline

Test whether variable is assigned.

Definition at line 94 of file set.hpp.

◆ knownIn()

bool Gecode::Set::SetVarImp::knownIn ( int n) const
inline

Test whether n is contained in greatest lower bound.

Definition at line 105 of file set.hpp.

◆ knownOut()

bool Gecode::Set::SetVarImp::knownOut ( int i) const
inline

Test whether n is not contained in least upper bound.

Definition at line 108 of file set.hpp.

◆ include() [1/2]

ModEvent Gecode::Set::SetVarImp::include ( Space & home,
int n )
inline

Include n in the greatest lower bound.

Definition at line 287 of file set.hpp.

◆ include() [2/2]

ModEvent Gecode::Set::SetVarImp::include ( Space & home,
int i,
int j )
inline

Include the range $\{i,\dots,j\}$ in the greatest lower bound.

Definition at line 272 of file set.hpp.

◆ exclude() [1/2]

ModEvent Gecode::Set::SetVarImp::exclude ( Space & home,
int n )
inline

Exclude n from the least upper bound.

Definition at line 361 of file set.hpp.

◆ exclude() [2/2]

ModEvent Gecode::Set::SetVarImp::exclude ( Space & home,
int i,
int j )
inline

Exclude the range $\{i,\dots,j\}$ from the least upper bound.

Definition at line 346 of file set.hpp.

◆ intersect() [1/2]

ModEvent Gecode::Set::SetVarImp::intersect ( Space & home,
int n )
inline

Exclude everything but n from the least upper bound.

Definition at line 206 of file set.hpp.

◆ intersect() [2/2]

ModEvent Gecode::Set::SetVarImp::intersect ( Space & home,
int i,
int j )
inline

Exclude everything but the range $\{i,\dots,j\}$ from the least upper bound.

Definition at line 181 of file set.hpp.

◆ cardMin() [2/2]

ModEvent Gecode::Set::SetVarImp::cardMin ( Space & home,
unsigned int n )
inline

Restrict cardinality to be at least n.

Definition at line 161 of file set.hpp.

◆ cardMax() [2/2]

ModEvent Gecode::Set::SetVarImp::cardMax ( Space & home,
unsigned int n )
inline

Restrict cardinality to be at most n.

Definition at line 171 of file set.hpp.

◆ includeI()

template<class I >
ModEvent Gecode::Set::SetVarImp::includeI ( Space & home,
I & i )
inline

Include set described by i in the greatest lower bound.

Definition at line 292 of file set.hpp.

◆ excludeI()

template<class I >
ModEvent Gecode::Set::SetVarImp::excludeI ( Space & home,
I & i )
inline

Exclude set described by i from the least upper bound.

Definition at line 367 of file set.hpp.

◆ intersectI()

template<class I >
ModEvent Gecode::Set::SetVarImp::intersectI ( Space & home,
I & i )
inline

Exclude everything but set described by i from the least upper bound.

Definition at line 212 of file set.hpp.

◆ subscribe() [1/2]

void Gecode::Set::SetVarImp::subscribe ( Space & home,
Propagator & p,
PropCond pc,
bool schedule = true )

Subscribe propagator p with propagation condition pc to variable.

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

Definition at line 140 of file set.cpp.

◆ reschedule()

void Gecode::Set::SetVarImp::reschedule ( Space & home,
Propagator & p,
PropCond pc )

Re-schedule propagator p with propagation condition pc.

Definition at line 149 of file set.cpp.

◆ subscribe() [2/2]

void Gecode::Set::SetVarImp::subscribe ( Space & home,
Advisor & a,
bool fail )

Subscribe advisor a to variable.

The advisor a is only subscribed if assigned is false.

If fail is true, the advisor a is also run when a variable operation triggers failure. This feature is undocumented.

Definition at line 145 of file set.cpp.

◆ copy()

SetVarImp * Gecode::Set::SetVarImp::copy ( Space & home)
inline

Return copy of this variable.

Definition at line 424 of file set.hpp.

◆ glbMin() [2/2]

int Gecode::Set::SetVarImp::glbMin ( const Delta & d)
inlinestatic

Return minimum value just pruned from glb.

Definition at line 136 of file set.hpp.

◆ glbMax() [2/2]

int Gecode::Set::SetVarImp::glbMax ( const Delta & d)
inlinestatic

Return maximum value just pruned from glb.

Definition at line 140 of file set.hpp.

◆ glbAny()

bool Gecode::Set::SetVarImp::glbAny ( const Delta & d)
inlinestatic

Test whether arbitrary values got pruned from glb.

Definition at line 144 of file set.hpp.

◆ lubMin() [2/2]

int Gecode::Set::SetVarImp::lubMin ( const Delta & d)
inlinestatic

Return minimum value just pruned from lub.

Definition at line 148 of file set.hpp.

◆ lubMax() [2/2]

int Gecode::Set::SetVarImp::lubMax ( const Delta & d)
inlinestatic

Return maximum value just pruned from lub.

Definition at line 152 of file set.hpp.

◆ lubAny()

bool Gecode::Set::SetVarImp::lubAny ( const Delta & d)
inlinestatic

Test whether arbitrary values got pruned from lub.

Definition at line 156 of file set.hpp.


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