Cached set view. More...
#include <view.hpp>
Public Member Functions | |
template<class I > | |
ModEvent | excludeI (Space &home, I &iter) |
template<class I > | |
ModEvent | includeI (Space &home, I &iter) |
template<class I > | |
ModEvent | intersectI (Space &home, I &iter) |
![]() | |
VarImpType * | varimp (void) const |
Return variable implementation of view. | |
View | base (void) const |
Return view from which this view is derived. | |
unsigned int | degree (void) const |
Return degree (number of subscribed propagators) | |
double | afc (void) const |
Return accumulated failure count (plus degree) | |
bool | assigned (void) const |
Test whether view is assigned. | |
void | update (Space &home, bool share, DerivedView< View > &y) |
Update this view to be a clone of view y. |
Protected Attributes | |
LUBndSet | lubCache |
The cached least upper bound. | |
GLBndSet | glbCache |
The cached greatest lower bound. | |
![]() | |
View | x |
View from which this view is derived. |
Related Functions | |
(Note that these are not member functions.) | |
template<class Char , class Traits , class View > | |
std::basic_ostream< Char, Traits > & | operator<< (std::basic_ostream< Char, Traits > &os, const CachedView< View > &x) |
Print cached set view. |
Constructors and initialization | |
CachedView (void) | |
Default constructor. | |
CachedView (const View &y) | |
Initialize with set view y. |
Value access | |
unsigned int | cardMin (void) const |
Return minimum cardinality. | |
unsigned int | cardMax (void) const |
Return maximum cardinality. | |
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 of 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 number of elements in the greatest lower bound. | |
unsigned int | lubSize (void) const |
Return the number of elements in the least upper bound. | |
unsigned int | unknownSize (void) const |
Return the number of unknown elements. |
Domain tests | |
bool | contains (int i) const |
Test whether i is in the greatest lower bound. | |
bool | notContains (int i) const |
Test whether i is not in the least upper bound. |
Domain update by value | |
ModEvent | cardMin (Space &home, unsigned int m) |
Restrict cardinality to be greater than or equal to m. | |
ModEvent | cardMax (Space &home, unsigned int m) |
Restrict cardinality to be less than or equal to m. | |
ModEvent | include (Space &home, int i, int j) |
Update greatest lower bound to include all elements between and including i and j. | |
ModEvent | exclude (Space &home, int i, int j) |
Restrict least upper bound to not contain all elements between and including i and j. | |
ModEvent | include (Space &home, int i) |
Update greatest lower bound to contain i. | |
ModEvent | exclude (Space &home, int i) |
Restrict least upper bound to not contain i. | |
ModEvent | intersect (Space &home, int i, int j) |
Update least upper bound to contain at most all elements between and including i and j. | |
ModEvent | intersect (Space &home, int i) |
Update least upper bound to contain at most the element i. |
Domain update by range iterator | |
template<class I > | |
ModEvent | excludeI (Space &home, I &i) |
Remove range sequence described by i from least upper bound. | |
template<class I > | |
ModEvent | includeI (Space &home, I &i) |
Include range sequence described by i in greatest lower bound. | |
template<class I > | |
ModEvent | intersectI (Space &home, I &iter) |
Intersect least upper bound with range sequence described by i. |
View-dependent propagator support | |
static void | schedule (Space &home, Propagator &p, ModEvent me) |
Schedule propagator p with modification event me. | |
static ModEvent | me (const ModEventDelta &med) |
Return modification event for view type in med. | |
static ModEventDelta | med (ModEvent) |
Translate modification event me to modification event delta for view. |
Dependencies | |
void | subscribe (Space &home, Propagator &p, PropCond pc, bool schedule=true) |
Subscribe propagator p with propagation condition pc to view. | |
void | cancel (Space &home, Propagator &p, PropCond pc) |
Cancel subscription of propagator p with propagation condition pc to view. | |
void | subscribe (Space &home, Advisor &a) |
Subscribe advisor a to view. | |
void | cancel (Space &home, Advisor &a) |
Cancel subscription of advisor a. |
Delta information for advisors | |
int | glbMin (const Delta &d) const |
Return minimum value just pruned from glb. | |
int | glbMax (const Delta &d) const |
Return maximum value just pruned from glb. | |
bool | glbAny (const Delta &d) const |
Test whether arbitrary values got pruned from glb. | |
int | lubMin (const Delta &d) const |
Return minimum value just pruned from lub. | |
int | lubMax (const Delta &d) const |
Return maximum value just pruned from lub. | |
bool | lubAny (const Delta &d) const |
Test whether arbitrary values got pruned from lub. | |
static ModEvent | modevent (const Delta &d) |
Return modification event. |
Domain cache operations | |
void | initCache (Space &home, const IntSet &glb, const IntSet &lub) |
Initialize cache to bounds glb and lub. | |
void | cacheGlb (Space &home) |
Update greatest lower bound cache to current domain. | |
void | cacheLub (Space &home) |
Update least upper bound cache to current domain. | |
bool | glbModified (void) const |
Check whether greatest lower bound cache differs from current domain. | |
bool | lubModified (void) const |
Check whether least upper bound cache differs from current domain. |
Cloning | |
void | update (Space &home, bool share, CachedView< View > &y) |
Update this view to be a clone of view y. |
Additional Inherited Members | |
![]() | |
typedef View::VarImpType | VarImpType |
The variable implementation type belonging to the View. | |
typedef View::VarType | VarType |
The variable type belonging to the View. | |
![]() | |
static bool | varderived (void) |
Return whether this view is derived from a VarImpView. | |
![]() | |
DerivedView (void) | |
Default constructor. | |
DerivedView (const View &y) | |
Initialize with view y. |
Cached set view.
A cached set view for a set view
adds operations for cacheing the current domain of
and comparing the current domain to the cached domain. Cached views make it easy to implement incremental propagation algorithms.
Gecode::Set::CachedView< View >::CachedView | ( | void | ) |
Default constructor.
|
explicit |
Initialize with set view y.
unsigned int Gecode::Set::CachedView< View >::cardMin | ( | void | ) | const |
Return minimum cardinality.
unsigned int Gecode::Set::CachedView< View >::cardMax | ( | void | ) | const |
Return maximum cardinality.
int Gecode::Set::CachedView< View >::lubMin | ( | void | ) | const |
Return minimum of the least upper bound.
int Gecode::Set::CachedView< View >::lubMax | ( | void | ) | const |
Return maximum of the least upper bound.
int Gecode::Set::CachedView< View >::lubMinN | ( | unsigned int | n | ) | const |
Return n-th smallest element of the least upper bound.
int Gecode::Set::CachedView< View >::glbMin | ( | void | ) | const |
Return minimum of the greatest lower bound.
int Gecode::Set::CachedView< View >::glbMax | ( | void | ) | const |
Return maximum of the greatest lower bound.
|
inline |
Return the number of elements in the greatest lower bound.
Definition at line 53 of file cached.hpp.
|
inline |
Return the number of elements in the least upper bound.
Definition at line 59 of file cached.hpp.
|
inline |
Return the number of unknown elements.
Definition at line 65 of file cached.hpp.
|
inline |
Test whether i is in the greatest lower bound.
Definition at line 71 of file cached.hpp.
|
inline |
Test whether i is not in the least upper bound.
Definition at line 75 of file cached.hpp.
|
inline |
Restrict cardinality to be greater than or equal to m.
Definition at line 115 of file cached.hpp.
|
inline |
Restrict cardinality to be less than or equal to m.
Definition at line 121 of file cached.hpp.
|
inline |
Update greatest lower bound to include all elements between and including i and j.
Definition at line 151 of file cached.hpp.
|
inline |
Restrict least upper bound to not contain all elements between and including i and j.
Definition at line 157 of file cached.hpp.
|
inline |
Update greatest lower bound to contain i.
Definition at line 127 of file cached.hpp.
|
inline |
Restrict least upper bound to not contain i.
Definition at line 133 of file cached.hpp.
|
inline |
Update least upper bound to contain at most all elements between and including i and j.
Definition at line 145 of file cached.hpp.
|
inline |
Update least upper bound to contain at most the element i.
Definition at line 139 of file cached.hpp.
ModEvent Gecode::Set::CachedView< View >::excludeI | ( | Space & | home, |
I & | i | ||
) |
Remove range sequence described by i from least upper bound.
ModEvent Gecode::Set::CachedView< View >::includeI | ( | Space & | home, |
I & | i | ||
) |
Include range sequence described by i in greatest lower bound.
ModEvent Gecode::Set::CachedView< View >::intersectI | ( | Space & | home, |
I & | iter | ||
) |
Intersect least upper bound with range sequence described by i.
|
inlinestatic |
Schedule propagator p with modification event me.
Reimplemented from Gecode::DerivedView< View >.
Definition at line 206 of file cached.hpp.
|
inlinestatic |
Return modification event for view type in med.
Reimplemented from Gecode::DerivedView< View >.
Definition at line 211 of file cached.hpp.
|
static |
Translate modification event me to modification event delta for view.
Reimplemented from Gecode::DerivedView< View >.
void Gecode::Set::CachedView< View >::subscribe | ( | Space & | home, |
Propagator & | p, | ||
PropCond | pc, | ||
bool | schedule = true |
||
) |
Subscribe propagator p with propagation condition pc to view.
In case schedule is false, the propagator is just subscribed but not scheduled for execution (this must be used when creating subscriptions during propagation).
Reimplemented from Gecode::DerivedView< View >.
|
inline |
Cancel subscription of propagator p with propagation condition pc to view.
Reimplemented from Gecode::DerivedView< View >.
Definition at line 188 of file cached.hpp.
|
inline |
Subscribe advisor a to view.
Reimplemented from Gecode::DerivedView< View >.
Definition at line 194 of file cached.hpp.
|
inline |
Cancel subscription of advisor a.
Reimplemented from Gecode::DerivedView< View >.
Definition at line 200 of file cached.hpp.
|
inlinestatic |
Return modification event.
Reimplemented from Gecode::DerivedView< View >.
Definition at line 228 of file cached.hpp.
int Gecode::Set::CachedView< View >::glbMin | ( | const Delta & | d | ) | const |
Return minimum value just pruned from glb.
int Gecode::Set::CachedView< View >::glbMax | ( | const Delta & | d | ) | const |
Return maximum value just pruned from glb.
|
inline |
Test whether arbitrary values got pruned from glb.
Definition at line 246 of file cached.hpp.
int Gecode::Set::CachedView< View >::lubMin | ( | const Delta & | d | ) | const |
Return minimum value just pruned from lub.
int Gecode::Set::CachedView< View >::lubMax | ( | const Delta & | d | ) | const |
Return maximum value just pruned from lub.
|
inline |
Test whether arbitrary values got pruned from lub.
Definition at line 264 of file cached.hpp.
void Gecode::Set::CachedView< View >::initCache | ( | Space & | home, |
const IntSet & | glb, | ||
const IntSet & | lub | ||
) |
Initialize cache to bounds glb and lub.
Definition at line 282 of file cached.hpp.
|
inline |
Update greatest lower bound cache to current domain.
Definition at line 294 of file cached.hpp.
|
inline |
Update least upper bound cache to current domain.
Definition at line 301 of file cached.hpp.
|
inline |
Check whether greatest lower bound cache differs from current domain.
Definition at line 308 of file cached.hpp.
|
inline |
Check whether least upper bound cache differs from current domain.
Definition at line 314 of file cached.hpp.
void Gecode::Set::CachedView< View >::update | ( | Space & | home, |
bool | share, | ||
CachedView< View > & | y | ||
) |
Update this view to be a clone of view y.
ModEvent Gecode::Set::CachedView< View >::excludeI | ( | Space & | home, |
I & | iter | ||
) |
Definition at line 163 of file cached.hpp.
ModEvent Gecode::Set::CachedView< View >::includeI | ( | Space & | home, |
I & | iter | ||
) |
Definition at line 169 of file cached.hpp.
ModEvent Gecode::Set::CachedView< View >::intersectI | ( | Space & | home, |
I & | iter | ||
) |
Definition at line 175 of file cached.hpp.
|
related |
|
protected |
|
protected |