bool.hpp
Go to the documentation of this file.
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
* Main authors:
* Christian Schulte <schulte@gecode.org>
*
* Contributing authors:
* Samuel Gagnon <samuel.gagnon92@gmail.com>
*
* Copyright:
* Christian Schulte, 2002
* Samuel Gagnon, 2018
*
* 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 Int {
/*
* Constructors and initialization
*
*/
forceinline
BoolView::BoolView(void) {}
forceinline
BoolView::BoolView(const BoolVar& y)
: VarImpView<BoolVar>(y.varimp()) {}
forceinline
BoolView::BoolView(BoolVarImp* y)
: VarImpView<BoolVar>(y) {}
/*
* Value access
*
*/
forceinline BoolStatus
BoolView::status(void) const {
return x->status();
}
forceinline int
BoolView::min(void) const {
return x->min();
}
forceinline int
BoolView::max(void) const {
return x->max();
}
forceinline int
BoolView::med(void) const {
return x->med();
}
forceinline int
BoolView::val(void) const {
return x->val();
}
#ifdef GECODE_HAS_CBS
forceinline int
BoolView::baseval(int val) const {
return val;
}
#endif
forceinline unsigned int
BoolView::size(void) const {
return x->size();
}
forceinline unsigned int
BoolView::width(void) const {
return x->width();
}
forceinline unsigned int
BoolView::regret_min(void) const {
return x->regret_min();
}
forceinline unsigned int
BoolView::regret_max(void) const {
return x->regret_max();
}
/*
* Domain tests
*
*/
forceinline bool
BoolView::range(void) const {
return x->range();
}
forceinline bool
BoolView::in(int n) const {
return x->in(n);
}
forceinline bool
BoolView::in(long long int n) const {
return x->in(n);
}
/*
* Domain update by value
*
*/
forceinline ModEvent
BoolView::lq(Space& home, int n) {
return x->lq(home,n);
}
forceinline ModEvent
BoolView::lq(Space& home, long long int n) {
return x->lq(home,n);
}
forceinline ModEvent
BoolView::le(Space& home, int n) {
return x->lq(home,n-1);
}
forceinline ModEvent
BoolView::le(Space& home, long long int n) {
return x->lq(home,n-1);
}
forceinline ModEvent
BoolView::gq(Space& home, int n) {
return x->gq(home,n);
}
forceinline ModEvent
BoolView::gq(Space& home, long long int n) {
return x->gq(home,n);
}
forceinline ModEvent
BoolView::gr(Space& home, int n) {
return x->gq(home,n+1);
}
forceinline ModEvent
BoolView::gr(Space& home, long long int n) {
return x->gq(home,n+1);
}
forceinline ModEvent
BoolView::nq(Space& home, int n) {
return x->nq(home,n);
}
forceinline ModEvent
BoolView::nq(Space& home, long long int n) {
return x->nq(home,n);
}
forceinline ModEvent
BoolView::eq(Space& home, int n) {
return x->eq(home,n);
}
forceinline ModEvent
BoolView::eq(Space& home, long long int n) {
return x->eq(home,n);
}
/*
* Iterator-based domain update
*
*/
template<class I>
forceinline ModEvent
BoolView::narrow_r(Space& home, I& i, bool depend) {
return x->narrow_r(home,i,depend);
}
template<class I>
forceinline ModEvent
BoolView::inter_r(Space& home, I& i, bool depend) {
return x->inter_r(home,i,depend);
}
template<class I>
forceinline ModEvent
BoolView::minus_r(Space& home, I& i, bool depend) {
return x->minus_r(home,i,depend);
}
template<class I>
forceinline ModEvent
BoolView::narrow_v(Space& home, I& i, bool depend) {
return x->narrow_v(home,i,depend);
}
template<class I>
forceinline ModEvent
BoolView::inter_v(Space& home, I& i, bool depend) {
return x->inter_v(home,i,depend);
}
template<class I>
forceinline ModEvent
BoolView::minus_v(Space& home, I& i, bool depend) {
return x->minus_v(home,i,depend);
}
/*
* Boolean domain tests
*
*/
forceinline bool
BoolView::zero(void) const {
return x->zero();
}
forceinline bool
BoolView::one(void) const {
return x->one();
}
forceinline bool
BoolView::none(void) const {
return x->none();
}
/*
* Boolean assignment operations
*
*/
forceinline ModEvent
BoolView::zero_none(Space& home) {
return x->zero_none(home);
}
forceinline ModEvent
BoolView::one_none(Space& home) {
return x->one_none(home);
}
forceinline ModEvent
BoolView::zero(Space& home) {
return x->zero(home);
}
forceinline ModEvent
BoolView::one(Space& home) {
return x->one(home);
}
/*
* Delta information for advisors
*
*/
forceinline int
BoolView::min(const Delta& d) const {
return BoolVarImp::min(d);
}
forceinline int
BoolView::max(const Delta& d) const {
return BoolVarImp::max(d);
}
forceinline unsigned int
BoolView::width(const Delta& d) const {
return BoolVarImp::width(d);
}
forceinline bool
BoolView::any(const Delta& d) const {
return BoolVarImp::any(d);
}
forceinline bool
BoolView::zero(const Delta& d) {
return BoolVarImp::zero(d);
}
forceinline bool
BoolView::one(const Delta& d) {
return BoolVarImp::one(d);
}
forceinline ModEventDelta
BoolView::med(ModEvent me) {
return VarImpView<BoolVar>::med(me);
}
template<>
class ViewRanges<BoolView> : public Iter::Ranges::Singleton {
public:
ViewRanges(void);
ViewRanges(const BoolView& x);
void init(const BoolView& x);
};
forceinline
ViewRanges<BoolView>::ViewRanges(void) {}
forceinline
ViewRanges<BoolView>::ViewRanges(const BoolView& x)
: Iter::Ranges::Singleton(x.min(),x.max()) {}
forceinline void
ViewRanges<BoolView>::init(const BoolView& x) {
Iter::Ranges::Singleton::init(x.min(),x.max());
}
}}
// STATISTICS: int-var
Gecode::BoolVar
Boolean integer variables.
Definition int.hh:512
Gecode::Delta
Generic domain change information to be supplied to advisors.
Definition core.hpp:204
Gecode::Int::BoolVarImp
Boolean variable implementation.
Definition var-imp.hpp:491
Gecode::Int::BoolVarImp::zero
bool zero(void) const
Test whether variable is assigned to zero.
Definition bool.hpp:131
Gecode::Int::BoolVarImp::max
int max(void) const
Return maximum of domain.
Definition bool.hpp:66
Gecode::Int::BoolVarImp::width
unsigned int width(void) const
Return width of domain (distance between maximum and minimum).
Definition bool.hpp:91
Gecode::Int::BoolVarImp::one
bool one(void) const
Test whether variable is assigned to one.
Definition bool.hpp:135
Gecode::Int::BoolVarImp::min
int min(void) const
Return minimum of domain.
Definition bool.hpp:62
Gecode::Int::BoolVarImp::any
static bool any(const Delta &d)
Test whether arbitrary values got pruned.
Definition bool.hpp:165
Gecode::Int::BoolView
Boolean view for Boolean variables.
Definition view.hpp:1380
Gecode::Int::BoolView::lq
ModEvent lq(Space &home, int n)
Restrict domain values to be less or equal than n.
Definition bool.hpp:125
Gecode::Int::BoolView::in
bool in(int n) const
Test whether n is contained in domain.
Definition bool.hpp:111
Gecode::Int::BoolView::BoolView
BoolView(void)
Default constructor.
Definition bool.hpp:45
Gecode::Int::BoolView::max
int max(void) const
Return maximum of domain.
Definition bool.hpp:66
Gecode::Int::BoolView::any
bool any(const Delta &d) const
Test whether arbitrary values got pruned.
Definition bool.hpp:273
Gecode::Int::BoolView::regret_max
unsigned int regret_max(void) const
Return regret of domain maximum (distance to next smaller value).
Definition bool.hpp:97
Gecode::Int::BoolView::narrow_r
ModEvent narrow_r(Space &home, I &i, bool depends=true)
Replace domain by ranges described by i.
Definition bool.hpp:185
Gecode::Int::BoolView::min
int min(void) const
Return minimum of domain.
Definition bool.hpp:62
Gecode::Int::BoolView::inter_r
ModEvent inter_r(Space &home, I &i, bool depends=true)
Intersect domain with ranges described by i.
Definition bool.hpp:190
Gecode::Int::BoolView::range
bool range(void) const
Test whether domain is a range.
Definition bool.hpp:107
Gecode::Int::BoolView::zero_none
ModEvent zero_none(Space &home)
Assign not yet assigned view to zero.
Definition bool.hpp:238
Gecode::Int::BoolView::size
unsigned int size(void) const
Return size (cardinality) of domain.
Definition bool.hpp:85
Gecode::Int::BoolView::narrow_v
ModEvent narrow_v(Space &home, I &i, bool depends=true)
Replace domain by values described by i.
Definition bool.hpp:200
Gecode::Int::BoolView::none
bool none(void) const
Test whether view is not yet assigned.
Definition bool.hpp:228
Gecode::Int::BoolView::inter_v
ModEvent inter_v(Space &home, I &i, bool depends=true)
Intersect domain with values described by i.
Definition bool.hpp:205
Gecode::Int::BoolView::nq
ModEvent nq(Space &home, int n)
Restrict domain values to be different from n.
Definition bool.hpp:161
Gecode::Int::BoolView::gq
ModEvent gq(Space &home, int n)
Restrict domain values to be greater or equal than n.
Definition bool.hpp:143
Gecode::Int::BoolView::le
ModEvent le(Space &home, int n)
Restrict domain values to be less than n.
Definition bool.hpp:134
Gecode::Int::BoolView::status
BoolStatus status(void) const
Return current domain status.
Definition bool.hpp:58
Gecode::Int::BoolView::zero
bool zero(void) const
Test whether view is assigned to be zero.
Definition bool.hpp:220
Gecode::Int::BoolView::one_none
ModEvent one_none(Space &home)
Assign not yet assigned view to one.
Definition bool.hpp:242
Gecode::Int::BoolView::gr
ModEvent gr(Space &home, int n)
Restrict domain values to be greater than n.
Definition bool.hpp:152
Gecode::Int::BoolView::med
int med(void) const
Return median of domain (greatest element not greater than the median).
Definition bool.hpp:70
Gecode::Int::BoolView::eq
ModEvent eq(Space &home, int n)
Restrict domain values to be equal to n.
Definition bool.hpp:170
Gecode::Int::BoolView::one
bool one(void) const
Test whether view is assigned to be one.
Definition bool.hpp:224
Gecode::Int::BoolView::minus_r
ModEvent minus_r(Space &home, I &i, bool depends=true)
Remove from domain the ranges described by i.
Definition bool.hpp:195
Gecode::Int::BoolView::val
int val(void) const
Return assigned value (only if assigned).
Definition bool.hpp:74
Gecode::Int::BoolView::regret_min
unsigned int regret_min(void) const
Return regret of domain minimum (distance to next larger value).
Definition bool.hpp:93
Gecode::Int::BoolView::minus_v
ModEvent minus_v(Space &home, I &i, bool depends=true)
Remove from domain the values described by i.
Definition bool.hpp:210
Gecode::Int::BoolView::width
unsigned int width(void) const
Return width of domain (distance between maximum and minimum).
Definition bool.hpp:89
Gecode::Int::ViewRanges< BoolView >::ViewRanges
ViewRanges(void)
Default constructor.
Definition bool.hpp:311
Gecode::Int::ViewRanges< BoolView >::max
int max(void) const
Gecode::Int::ViewRanges< BoolView >::min
int min(void) const
Gecode::Int::ViewRanges::init
void init(const View &x)
Initialize with ranges for view x.
Gecode::Int::ViewRanges::ViewRanges
ViewRanges(void)
Default constructor.
Gecode::Iter::Ranges::Singleton
Range iterator for singleton range.
Definition ranges-singleton.hpp:42
Gecode::Iter::Ranges::Singleton::init
void init(int min, int max)
Initialize with range min to max.
Definition ranges-singleton.hpp:70
Gecode::Iter::Ranges::Singleton::Singleton
Singleton(void)
Default constructor.
Definition ranges-singleton.hpp:63
Gecode::Space
Computation spaces.
Definition core.hpp:1742
Gecode::VarImpView::med
static ModEventDelta med(ModEvent me)
Translate modification event me to modification event delta for view.
Definition view.hpp:557
Gecode::VarImpView< BoolVar >::me
static ModEvent me(const ModEventDelta &med)
Definition view.hpp:552
Gecode::VarImpView< BoolVar >::VarImpView
VarImpView(void)
Definition view.hpp:476
Gecode::VarImpView< BoolVar >::varimp
void varimp(VarImpType *y)
Definition view.hpp:484
Gecode::VarImpView< BoolVar >::x
VarImpType * x
Definition view.hpp:141
Gecode::ModEventDelta
int ModEventDelta
Modification event deltas.
Definition core.hpp:89
Gecode::Int
Finite domain integers.
Gecode::Int::BoolStatus
unsigned int BoolStatus
Type for status of a Boolean variable.
Definition var-imp.hpp:484
Gecode::Iter
Range and value iterators.
Definition iter.hh:41
Gecode
Gecode toplevel namespace
Gecode::ModEvent
int ModEvent
Type for modification events.
Definition core.hpp:62
forceinline
#define forceinline
Definition config.hpp:187