set.hpp
Go to the documentation of this file.
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
* Main authors:
* Guido Tack <tack@gecode.org>
*
* Contributing authors:
* Christian Schulte <schulte@gecode.org>
* Gabor Szokoli <szokoli@gecode.org>
*
* Copyright:
* Guido Tack, 2004
* Christian Schulte, 2004
* Gabor Szokoli, 2004
*
* This file is part of Gecode, the generic constraint
* development environment:
* http://www.gecode.org
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
namespace Gecode { namespace Set {
/*
* Constructors and access
*
*/
forceinline
SetView::SetView(void) {}
forceinline
SetView::SetView(const SetVar& y)
: VarImpView<SetVar>(y.varimp()) {}
forceinline
SetView::SetView(SetVarImp* y)
: VarImpView<SetVar>(y) {}
/*
* Variable information
*
*/
forceinline unsigned int
SetView::glbSize(void) const {
return x->glbSize();
}
forceinline unsigned int
SetView::lubSize(void) const {
return x->lubSize();
}
forceinline unsigned int
SetView::unknownSize(void) const {
return x->lubSize() - x->glbSize();
}
forceinline bool
SetView::contains(int i) const {
return x->knownIn(i);
}
forceinline bool
SetView::notContains(int i) const {
return x->knownOut(i);
}
forceinline unsigned int
SetView::cardMin(void) const {
return x->cardMin();
}
forceinline unsigned int
SetView::cardMax(void) const {
return x->cardMax();
}
forceinline int
SetView::lubMin(void) const {
return x->lubMin();
}
forceinline int
SetView::lubMax(void) const {
return x->lubMax();
}
forceinline int
SetView::lubMinN(unsigned int n) const {
return x->lubMinN(n);
}
forceinline int
SetView::glbMin(void) const {
return x->glbMin();
}
forceinline int
SetView::glbMax(void) const {
return x->glbMax();
}
/*
* Tells
*
*/
forceinline ModEvent
SetView::cardMin(Space& home, unsigned int m) {
return x->cardMin(home, m);
}
forceinline ModEvent
SetView::cardMax(Space& home, unsigned int m) {
return x->cardMax(home, m);
}
forceinline ModEvent
SetView::include(Space& home, int from, int to) {
return x->include(home,from,to);
}
forceinline ModEvent
SetView::include(Space& home, int n) {
return x->include(home,n);
}
forceinline ModEvent
SetView::exclude(Space& home, int n) {
return x->exclude(home, n);
}
forceinline ModEvent
SetView::intersect(Space& home, int from, int to) {
return x->intersect(home,from,to);
}
forceinline ModEvent
SetView::intersect(Space& home, int n) {
return x->intersect(home,n);
}
template<class I> ModEvent
SetView::includeI(Space& home, I& iter) {
return x->includeI(home, iter);
}
forceinline ModEvent
SetView::exclude(Space& home, int from, int to) {
return x->exclude(home,from,to);
}
template<class I> ModEvent
SetView::excludeI(Space& home, I& iter) {
return x->excludeI(home, iter);
}
template<class I> ModEvent
SetView::intersectI(Space& home, I& iter) {
return x->intersectI(home, iter);
}
/*
* Delta information for advisors
*
*/
forceinline ModEvent
SetView::modevent(const Delta& d) {
return SetVarImp::modevent(d);
}
forceinline int
SetView::glbMin(const Delta& d) const {
return SetVarImp::glbMin(d);
}
forceinline int
SetView::glbMax(const Delta& d) const {
return SetVarImp::glbMax(d);
}
forceinline bool
SetView::glbAny(const Delta& d) const {
return SetVarImp::glbAny(d);
}
forceinline int
SetView::lubMin(const Delta& d) const {
return SetVarImp::lubMin(d);
}
forceinline int
SetView::lubMax(const Delta& d) const {
return SetVarImp::lubMax(d);
}
forceinline bool
SetView::lubAny(const Delta& d) const {
return SetVarImp::lubAny(d);
}
template<>
class LubRanges<SetView> : public LubRanges<SetVarImp*> {
public:
LubRanges(void);
LubRanges(const SetView& x);
void init(const SetView& x);
};
forceinline
LubRanges<SetView>::LubRanges(void) {}
forceinline
LubRanges<SetView>::LubRanges(const SetView& x)
: LubRanges<SetVarImp*>(x.varimp()) {}
forceinline void
LubRanges<SetView>::init(const SetView& x) {
LubRanges<SetVarImp*>::init(x.varimp());
}
template<>
class GlbRanges<SetView> : public GlbRanges<SetVarImp*> {
public:
GlbRanges(void);
GlbRanges(const SetView& x);
void init(const SetView& x);
};
forceinline
GlbRanges<SetView>::GlbRanges(void) {}
forceinline
GlbRanges<SetView>::GlbRanges(const SetView& x)
: GlbRanges<SetVarImp*>(x.varimp()) {}
forceinline void
GlbRanges<SetView>::init(const SetView& x) {
GlbRanges<SetVarImp*>::init(x.varimp());
}
}}
// STATISTICS: set-var
Gecode::Delta
Generic domain change information to be supplied to advisors.
Definition core.hpp:204
Gecode::SetVar
Set variables
Definition set.hh:127
Gecode::Set::GlbRanges< SetView >::GlbRanges
GlbRanges(void)
Default constructor.
Definition set.hpp:255
Gecode::Set::GlbRanges::init
void init(const T &x)
Initialize with greatest lower bound ranges for set variable x.
Gecode::Set::GlbRanges::GlbRanges
GlbRanges(void)
Default constructor.
Gecode::Set::LubRanges< SetView >::LubRanges
LubRanges(void)
Default constructor.
Definition set.hpp:225
Gecode::Set::LubRanges::LubRanges
LubRanges(void)
Default constructor.
Gecode::Set::LubRanges::init
void init(const T &x)
Initialize with least upper bound ranges for set variable x.
Gecode::Set::SetVarImp
Finite integer set variable implementation.
Definition var-imp.hpp:430
Gecode::Set::SetVarImp::glbMin
int glbMin(void) const
Return minimum of the greatest lower bound.
Definition set.hpp:120
Gecode::Set::SetVarImp::lubAny
static bool lubAny(const Delta &d)
Test whether arbitrary values got pruned from lub.
Definition set.hpp:156
Gecode::Set::SetVarImp::lubMin
int lubMin(void) const
Return minimum of the least upper bound.
Definition set.hpp:111
Gecode::Set::SetVarImp::lubMax
int lubMax(void) const
Return maximum of the least upper bound.
Definition set.hpp:114
Gecode::Set::SetVarImp::glbMax
int glbMax(void) const
Return maximum of the greatest lower bound.
Definition set.hpp:123
Gecode::Set::SetVarImp::glbAny
static bool glbAny(const Delta &d)
Test whether arbitrary values got pruned from glb.
Definition set.hpp:144
Gecode::Set::SetView
Set view for set variables
Definition view.hpp:56
Gecode::Set::SetView::contains
bool contains(int i) const
Test whether i is in the greatest lower bound.
Definition set.hpp:74
Gecode::Set::SetView::lubAny
bool lubAny(const Delta &d) const
Test whether arbitrary values got pruned from lub.
Definition set.hpp:201
Gecode::Set::SetView::glbAny
bool glbAny(const Delta &d) const
Test whether arbitrary values got pruned from glb.
Definition set.hpp:188
Gecode::Set::SetView::unknownSize
unsigned int unknownSize(void) const
Return the number of unknown elements.
Definition set.hpp:70
Gecode::Set::SetView::SetView
SetView(void)
Default constructor.
Definition set.hpp:48
Gecode::Set::SetView::intersectI
ModEvent intersectI(Space &home, I &iter)
Intersect least upper bound with range sequence described by i.
Definition set.hpp:164
Gecode::Set::SetView::include
ModEvent include(Space &home, int i, int j)
Update greatest lower bound to include all elements between and including i and j.
Definition set.hpp:126
Gecode::Set::SetView::glbMax
int glbMax(void) const
Return maximum of the greatest lower bound.
Definition set.hpp:106
Gecode::Set::SetView::lubSize
unsigned int lubSize(void) const
Return the number of elements in the least upper bound.
Definition set.hpp:66
Gecode::Set::SetView::lubMax
int lubMax(void) const
Return maximum of the least upper bound.
Definition set.hpp:94
Gecode::Set::SetView::lubMin
int lubMin(void) const
Return minimum of the least upper bound.
Definition set.hpp:90
Gecode::Set::SetView::lubMinN
int lubMinN(unsigned int n) const
Return n-th smallest element of the least upper bound.
Definition set.hpp:98
Gecode::Set::SetView::glbMin
int glbMin(void) const
Return minimum of the greatest lower bound.
Definition set.hpp:102
Gecode::Set::SetView::modevent
static ModEvent modevent(const Delta &d)
Return modification event.
Definition set.hpp:175
Gecode::Set::SetView::cardMin
unsigned int cardMin(void) const
Return minimum cardinality.
Definition set.hpp:82
Gecode::Set::SetView::cardMax
unsigned int cardMax(void) const
Return maximum cardinality.
Definition set.hpp:86
Gecode::Set::SetView::glbSize
unsigned int glbSize(void) const
Return the number of elements in the greatest lower bound.
Definition set.hpp:62
Gecode::Set::SetView::notContains
bool notContains(int i) const
Test whether i is not in the least upper bound.
Definition set.hpp:78
Gecode::Set::SetView::intersect
ModEvent intersect(Space &home, int i, int j)
Update least upper bound to contain at most all elements between and including i and j.
Definition set.hpp:141
Gecode::Set::SetView::excludeI
ModEvent excludeI(Space &home, I &i)
Remove range sequence described by i from least upper bound.
Definition set.hpp:160
Gecode::Set::SetView::exclude
ModEvent exclude(Space &home, int i, int j)
Restrict least upper bound to not contain all elements between and including i and j.
Definition set.hpp:156
Gecode::Set::SetView::includeI
ModEvent includeI(Space &home, I &i)
Include range sequence described by i in greatest lower bound.
Definition set.hpp:151
Gecode::Space
Computation spaces.
Definition core.hpp:1742
Gecode::VarImpView< SetVar >::VarImpView
VarImpView(void)
Definition view.hpp:476
Gecode::VarImpView< SetVar >::varimp
void varimp(VarImpType *y)
Definition view.hpp:484
Gecode::VarImpView< SetVar >::x
VarImpType * x
Definition view.hpp:141
Gecode::VarImp< Gecode::Set::SetVarImpConf >::modevent
static ModEvent modevent(const Delta &d)
Definition core.hpp:4190
Gecode::Set
Finite integer sets.
Definition var-imp.hpp:137
Gecode
Gecode toplevel namespace
Gecode::ModEvent
int ModEvent
Type for modification events.
Definition core.hpp:62
forceinline
#define forceinline
Definition config.hpp:187