int.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
IntView::IntView(void) {}
forceinline
IntView::IntView(const IntVar& y)
: VarImpView<IntVar>(y.varimp()) {}
forceinline
IntView::IntView(IntVarImp* y)
: VarImpView<IntVar>(y) {}
/*
* Value access
*
*/
forceinline int
IntView::min(void) const {
return x->min();
}
forceinline int
IntView::max(void) const {
return x->max();
}
forceinline int
IntView::med(void) const {
return x->med();
}
forceinline int
IntView::val(void) const {
return x->val();
}
#ifdef GECODE_HAS_CBS
forceinline int
IntView::baseval(int val) const {
return val;
}
#endif
forceinline unsigned int
IntView::size(void) const {
return x->size();
}
forceinline unsigned int
IntView::width(void) const {
return x->width();
}
forceinline unsigned int
IntView::regret_min(void) const {
return x->regret_min();
}
forceinline unsigned int
IntView::regret_max(void) const {
return x->regret_max();
}
/*
* Domain tests
*
*/
forceinline bool
IntView::range(void) const {
return x->range();
}
forceinline bool
IntView::in(int n) const {
return x->in(n);
}
forceinline bool
IntView::in(long long int n) const {
return x->in(n);
}
/*
* Domain update by value
*
*/
forceinline ModEvent
IntView::lq(Space& home, int n) {
return x->lq(home,n);
}
forceinline ModEvent
IntView::lq(Space& home, long long int n) {
return x->lq(home,n);
}
forceinline ModEvent
IntView::le(Space& home, int n) {
return x->lq(home,n-1);
}
forceinline ModEvent
IntView::le(Space& home, long long int n) {
return x->lq(home,n-1);
}
forceinline ModEvent
IntView::gq(Space& home, int n) {
return x->gq(home,n);
}
forceinline ModEvent
IntView::gq(Space& home, long long int n) {
return x->gq(home,n);
}
forceinline ModEvent
IntView::gr(Space& home, int n) {
return x->gq(home,n+1);
}
forceinline ModEvent
IntView::gr(Space& home, long long int n) {
return x->gq(home,n+1);
}
forceinline ModEvent
IntView::nq(Space& home, int n) {
return x->nq(home,n);
}
forceinline ModEvent
IntView::nq(Space& home, long long int n) {
return x->nq(home,n);
}
forceinline ModEvent
IntView::eq(Space& home, int n) {
return x->eq(home,n);
}
forceinline ModEvent
IntView::eq(Space& home, long long int n) {
return x->eq(home,n);
}
/*
* Iterator-based domain update
*
*/
template<class I>
forceinline ModEvent
IntView::narrow_r(Space& home, I& i, bool depend) {
return x->narrow_r(home,i,depend);
}
template<class I>
forceinline ModEvent
IntView::inter_r(Space& home, I& i, bool depend) {
return x->inter_r(home,i,depend);
}
template<class I>
forceinline ModEvent
IntView::minus_r(Space& home, I& i, bool depend) {
return x->minus_r(home,i,depend);
}
template<class I>
forceinline ModEvent
IntView::narrow_v(Space& home, I& i, bool depend) {
return x->narrow_v(home,i,depend);
}
template<class I>
forceinline ModEvent
IntView::inter_v(Space& home, I& i, bool depend) {
return x->inter_v(home,i,depend);
}
template<class I>
forceinline ModEvent
IntView::minus_v(Space& home, I& i, bool depend) {
return x->minus_v(home,i,depend);
}
/*
* Delta information for advisors
*
*/
forceinline int
IntView::min(const Delta& d) const {
return IntVarImp::min(d);
}
forceinline int
IntView::max(const Delta& d) const {
return IntVarImp::max(d);
}
forceinline unsigned int
IntView::width(const Delta& d) const {
return IntVarImp::width(d);
}
forceinline bool
IntView::any(const Delta& d) const {
return IntVarImp::any(d);
}
forceinline ModEventDelta
IntView::med(ModEvent me) {
return VarImpView<IntVar>::med(me);
}
template<>
class ViewRanges<IntView> : public IntVarImpFwd {
public:
ViewRanges(void);
ViewRanges(const IntView& x);
void init(const IntView& x);
};
forceinline
ViewRanges<IntView>::ViewRanges(void) {}
forceinline
ViewRanges<IntView>::ViewRanges(const IntView& x)
: IntVarImpFwd(x.varimp()) {}
forceinline void
ViewRanges<IntView>::init(const IntView& x) {
IntVarImpFwd::init(x.varimp());
}
}}
// STATISTICS: int-var
Gecode::Delta
Generic domain change information to be supplied to advisors.
Definition core.hpp:204
Gecode::IntVar
Integer variables.
Definition int.hh:371
Gecode::Int::IntVarImpFwd::init
void init(const IntVarImp *x)
Initialize with ranges from variable implementation x.
Definition int.hpp:432
Gecode::Int::IntVarImpFwd::IntVarImpFwd
IntVarImpFwd(void)
Default constructor.
Definition int.hpp:427
Gecode::Int::IntVarImp
Integer variable implementation.
Definition var-imp.hpp:89
Gecode::Int::IntVarImp::width
unsigned int width(void) const
Return width of domain (distance between maximum and minimum).
Definition int.hpp:248
Gecode::Int::IntVarImp::max
int max(void) const
Return maximum of domain.
Definition int.hpp:228
Gecode::Int::IntVarImp::min
int min(void) const
Return minimum of domain.
Definition int.hpp:224
Gecode::Int::IntVarImp::any
static bool any(const Delta &d)
Test whether arbitrary values got pruned.
Definition int.hpp:333
Gecode::Int::IntView
Integer view for integer variables.
Definition view.hpp:129
Gecode::Int::IntView::size
unsigned int size(void) const
Return size (cardinality) of domain.
Definition int.hpp:81
Gecode::Int::IntView::inter_r
ModEvent inter_r(Space &home, I &i, bool depends=true)
Intersect domain with ranges described by i.
Definition int.hpp:186
Gecode::Int::IntView::min
int min(void) const
Return minimum of domain.
Definition int.hpp:58
Gecode::Int::IntView::width
unsigned int width(void) const
Return width of domain (distance between maximum and minimum).
Definition int.hpp:85
Gecode::Int::IntView::range
bool range(void) const
Test whether domain is a range.
Definition int.hpp:103
Gecode::Int::IntView::gr
ModEvent gr(Space &home, int n)
Restrict domain values to be greater than n.
Definition int.hpp:148
Gecode::Int::IntView::narrow_v
ModEvent narrow_v(Space &home, I &i, bool depends=true)
Replace domain by values described by i.
Definition int.hpp:196
Gecode::Int::IntView::in
bool in(int n) const
Test whether n is contained in domain.
Definition int.hpp:107
Gecode::Int::IntView::lq
ModEvent lq(Space &home, int n)
Restrict domain values to be less or equal than n.
Definition int.hpp:121
Gecode::Int::IntView::med
int med(void) const
Return median of domain (greatest element not greater than the median).
Definition int.hpp:66
Gecode::Int::IntView::le
ModEvent le(Space &home, int n)
Restrict domain values to be less than n.
Definition int.hpp:130
Gecode::Int::IntView::inter_v
ModEvent inter_v(Space &home, I &i, bool depends=true)
Intersect domain with values described by i.
Definition int.hpp:201
Gecode::Int::IntView::gq
ModEvent gq(Space &home, int n)
Restrict domain values to be greater or equal than n.
Definition int.hpp:139
Gecode::Int::IntView::minus_v
ModEvent minus_v(Space &home, I &i, bool depends=true)
Remove from domain the values described by i.
Definition int.hpp:206
Gecode::Int::IntView::IntView
IntView(void)
Default constructor.
Definition int.hpp:45
Gecode::Int::IntView::regret_min
unsigned int regret_min(void) const
Return regret of domain minimum (distance to next larger value).
Definition int.hpp:89
Gecode::Int::IntView::minus_r
ModEvent minus_r(Space &home, I &i, bool depends=true)
Remove from domain the ranges described by i.
Definition int.hpp:191
Gecode::Int::IntView::regret_max
unsigned int regret_max(void) const
Return regret of domain maximum (distance to next smaller value).
Definition int.hpp:93
Gecode::Int::IntView::val
int val(void) const
Return assigned value (only if assigned).
Definition int.hpp:70
Gecode::Int::IntView::any
bool any(const Delta &d) const
Test whether arbitrary values got pruned.
Definition int.hpp:230
Gecode::Int::IntView::max
int max(void) const
Return maximum of domain.
Definition int.hpp:62
Gecode::Int::IntView::narrow_r
ModEvent narrow_r(Space &home, I &i, bool depends=true)
Replace domain by ranges described by i.
Definition int.hpp:181
Gecode::Int::IntView::nq
ModEvent nq(Space &home, int n)
Restrict domain values to be different from n.
Definition int.hpp:157
Gecode::Int::IntView::eq
ModEvent eq(Space &home, int n)
Restrict domain values to be equal to n.
Definition int.hpp:166
Gecode::Int::ViewRanges< IntView >::ViewRanges
ViewRanges(void)
Default constructor.
Definition int.hpp:260
Gecode::Int::ViewRanges::init
void init(const View &x)
Initialize with ranges for view x.
Gecode::Int::ViewRanges::ViewRanges
ViewRanges(void)
Default constructor.
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< IntVar >::me
static ModEvent me(const ModEventDelta &med)
Definition view.hpp:552
Gecode::VarImpView< IntVar >::VarImpView
VarImpView(void)
Definition view.hpp:476
Gecode::VarImpView< IntVar >::varimp
void varimp(VarImpType *y)
Definition view.hpp:484
Gecode::VarImpView< IntVar >::x
VarImpType * x
Definition view.hpp:141
Gecode::ModEventDelta
int ModEventDelta
Modification event deltas.
Definition core.hpp:89
Gecode::Int
Finite domain integers.
Gecode
Gecode toplevel namespace
Gecode::ModEvent
int ModEvent
Type for modification events.
Definition core.hpp:62
forceinline
#define forceinline
Definition config.hpp:187