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>
* 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 {
/*
* Constructors and access
*
*/
forceinline
SetVar::SetVar(void) {}
forceinline
SetVar::SetVar(const SetVar& y)
: VarImpVar<Set::SetVarImp>(y.varimp()) {}
forceinline
SetVar::SetVar(const Set::SetView& y)
: VarImpVar<Set::SetVarImp>(y.varimp()) {}
/*
* Variable information
*
*/
forceinline unsigned int
SetVar::glbSize(void) const { return x->glbSize(); }
forceinline unsigned int
SetVar::lubSize(void) const { return x->lubSize(); }
forceinline unsigned int
SetVar::unknownSize(void) const { return x->lubSize()-x->glbSize(); }
forceinline bool
SetVar::contains(int i) const { return x->knownIn(i); }
forceinline bool
SetVar::notContains(int i) const { return x->knownOut(i); }
forceinline unsigned int
SetVar::cardMin(void) const { return x->cardMin(); }
forceinline unsigned int
SetVar::cardMax(void) const { return x->cardMax(); }
forceinline int
SetVar::lubMin(void) const { return x->lubMin(); }
forceinline int
SetVar::lubMax(void) const { return x->lubMax(); }
forceinline int
SetVar::glbMin(void) const { return x->glbMin(); }
forceinline int
SetVar::glbMax(void) const { return x->glbMax(); }
/*
* Range and value iterators for set variables
*
*/
forceinline
SetVarGlbRanges::SetVarGlbRanges(void) {}
forceinline
SetVarGlbRanges::SetVarGlbRanges(const SetVar& s)
: iter(s.varimp()) {}
forceinline
bool
SetVarGlbRanges::operator ()(void) const { return iter(); }
forceinline
void
SetVarGlbRanges::operator ++(void) { ++iter; }
forceinline
int
SetVarGlbRanges::min(void) const { return iter.min(); }
forceinline
int
SetVarGlbRanges::max(void) const { return iter.max(); }
forceinline
unsigned int
SetVarGlbRanges::width(void) const { return iter.width(); }
forceinline
SetVarLubRanges::SetVarLubRanges(void) {}
forceinline
SetVarLubRanges::SetVarLubRanges(const SetVar& s)
: iter(s.varimp()) {}
forceinline
bool
SetVarLubRanges::operator ()(void) const { return iter(); }
forceinline
void
SetVarLubRanges::operator ++(void) { ++iter; }
forceinline
int
SetVarLubRanges::min(void) const { return iter.min(); }
forceinline
int
SetVarLubRanges::max(void) const { return iter.max(); }
forceinline
unsigned int
SetVarLubRanges::width(void) const { return iter.width(); }
forceinline
SetVarUnknownRanges::SetVarUnknownRanges(void) {}
forceinline
SetVarUnknownRanges::SetVarUnknownRanges(const SetVar& s) {
iter.init(s.varimp());
}
forceinline
bool
SetVarUnknownRanges::operator ()(void) const { return iter(); }
forceinline
void
SetVarUnknownRanges::operator ++(void) { ++iter; }
forceinline
int
SetVarUnknownRanges::min(void) const { return iter.min(); }
forceinline
int
SetVarUnknownRanges::max(void) const { return iter.max(); }
forceinline
unsigned int
SetVarUnknownRanges::width(void) const { return iter.width(); }
forceinline
SetVarGlbValues::SetVarGlbValues(const SetVar& x) {
SetVarGlbRanges ivr(x);
iter.init(ivr);
}
forceinline bool
SetVarGlbValues::operator ()(void) const {
return iter();
}
forceinline void
SetVarGlbValues::operator ++(void) {
++iter;
}
forceinline int
SetVarGlbValues::val(void) const {
return iter.val();
}
forceinline
SetVarLubValues::SetVarLubValues(const SetVar& x) {
SetVarLubRanges ivr(x);
iter.init(ivr);
}
forceinline bool
SetVarLubValues::operator ()(void) const {
return iter();
}
forceinline void
SetVarLubValues::operator ++(void) {
++iter;
}
forceinline int
SetVarLubValues::val(void) const {
return iter.val();
}
forceinline
SetVarUnknownValues::SetVarUnknownValues(const SetVar& x) {
SetVarUnknownRanges ivr(x);
iter.init(ivr);
}
forceinline bool
SetVarUnknownValues::operator ()(void) const {
return iter();
}
forceinline void
SetVarUnknownValues::operator ++(void) {
++iter;
}
forceinline int
SetVarUnknownValues::val(void) const {
return iter.val();
}
}
// STATISTICS: set-var
Gecode::SetVarGlbRanges
Iterator for the greatest lower bound ranges of a set variable.
Definition set.hh:270
Gecode::SetVarGlbRanges::operator()
bool operator()(void) const
Test whether iterator is still at a range or done.
Definition set.hpp:111
Gecode::SetVarGlbRanges::max
int max(void) const
Return largest value of range.
Definition set.hpp:123
Gecode::SetVarGlbRanges::operator++
void operator++(void)
Move iterator to next range (if possible).
Definition set.hpp:115
Gecode::SetVarGlbRanges::min
int min(void) const
Return smallest value of range.
Definition set.hpp:119
Gecode::SetVarGlbRanges::width
unsigned int width(void) const
Return width of range (distance between minimum and maximum).
Definition set.hpp:127
Gecode::SetVarGlbRanges::SetVarGlbRanges
SetVarGlbRanges(void)
Default constructor.
Definition set.hpp:103
Gecode::SetVarGlbValues::operator()
bool operator()(void) const
Test whether iterator is still at a value or done.
Definition set.hpp:191
Gecode::SetVarGlbValues::val
int val(void) const
Return current value.
Definition set.hpp:201
Gecode::SetVarGlbValues::operator++
void operator++(void)
Move iterator to next value (if possible).
Definition set.hpp:196
Gecode::SetVarGlbValues::SetVarGlbValues
SetVarGlbValues(void)
Default constructor.
Gecode::SetVarLubRanges
Iterator for the least upper bound ranges of a set variable.
Definition set.hh:302
Gecode::SetVarLubRanges::operator++
void operator++(void)
Move iterator to next range (if possible).
Definition set.hpp:142
Gecode::SetVarLubRanges::SetVarLubRanges
SetVarLubRanges(void)
Default constructor.
Definition set.hpp:130
Gecode::SetVarLubRanges::width
unsigned int width(void) const
Return width of range (distance between minimum and maximum).
Definition set.hpp:154
Gecode::SetVarLubRanges::max
int max(void) const
Return largest value of range.
Definition set.hpp:150
Gecode::SetVarLubRanges::operator()
bool operator()(void) const
Test whether iterator is still at a range or done.
Definition set.hpp:138
Gecode::SetVarLubRanges::min
int min(void) const
Return smallest value of range.
Definition set.hpp:146
Gecode::SetVarLubValues::operator()
bool operator()(void) const
Test whether iterator is still at a value or done.
Definition set.hpp:212
Gecode::SetVarLubValues::val
int val(void) const
Return current value.
Definition set.hpp:222
Gecode::SetVarLubValues::SetVarLubValues
SetVarLubValues(void)
Default constructor.
Gecode::SetVarLubValues::operator++
void operator++(void)
Move iterator to next value (if possible).
Definition set.hpp:217
Gecode::SetVarUnknownRanges
Iterator for the unknown ranges of a set variable.
Definition set.hh:334
Gecode::SetVarUnknownRanges::max
int max(void) const
Return largest value of range.
Definition set.hpp:178
Gecode::SetVarUnknownRanges::operator()
bool operator()(void) const
Test whether iterator is still at a range or done.
Definition set.hpp:166
Gecode::SetVarUnknownRanges::width
unsigned int width(void) const
Return width of range (distance between minimum and maximum).
Definition set.hpp:182
Gecode::SetVarUnknownRanges::operator++
void operator++(void)
Move iterator to next range (if possible).
Definition set.hpp:170
Gecode::SetVarUnknownRanges::min
int min(void) const
Return smallest value of range.
Definition set.hpp:174
Gecode::SetVarUnknownRanges::SetVarUnknownRanges
SetVarUnknownRanges(void)
Default constructor.
Definition set.hpp:157
Gecode::SetVarUnknownValues::val
int val(void) const
Return current value.
Definition set.hpp:243
Gecode::SetVarUnknownValues::operator()
bool operator()(void) const
Test whether iterator is still at a value or done.
Definition set.hpp:233
Gecode::SetVarUnknownValues::SetVarUnknownValues
SetVarUnknownValues(void)
Default constructor.
Gecode::SetVarUnknownValues::operator++
void operator++(void)
Move iterator to next value (if possible).
Definition set.hpp:238
Gecode::SetVar
Set variables
Definition set.hh:127
Gecode::SetVar::cardMax
unsigned int cardMax(void) const
Return cardinality maximum.
Definition set.hpp:81
Gecode::SetVar::SetVar
SetVar(void)
Default constructor.
Definition set.hpp:46
Gecode::SetVar::notContains
bool notContains(int i) const
Test whether i is not in the least upper bound.
Definition set.hpp:75
Gecode::SetVar::lubMin
int lubMin(void) const
Return minimum element of least upper bound.
Definition set.hpp:84
Gecode::SetVar::lubSize
unsigned int lubSize(void) const
Return number of elements in the least upper bound.
Definition set.hpp:66
Gecode::SetVar::lubMax
int lubMax(void) const
Return maximum element of least upper bound.
Definition set.hpp:87
Gecode::SetVar::glbSize
unsigned int glbSize(void) const
Return number of elements in the greatest lower bound.
Definition set.hpp:63
Gecode::SetVar::glbMin
int glbMin(void) const
Return minimum element of greatest lower bound.
Definition set.hpp:90
Gecode::SetVar::unknownSize
unsigned int unknownSize(void) const
Return number of unknown elements (elements in lub but not in glb).
Definition set.hpp:69
Gecode::SetVar::glbMax
int glbMax(void) const
Return maximum of greatest lower bound.
Definition set.hpp:93
Gecode::SetVar::contains
bool contains(int i) const
Test whether i is in greatest lower bound.
Definition set.hpp:72
Gecode::SetVar::cardMin
unsigned int cardMin(void) const
Return cardinality minimum.
Definition set.hpp:78
Gecode::Set::SetVarImp
Finite integer set variable implementation.
Definition var-imp.hpp:430
Gecode::Set::SetView
Set view for set variables
Definition view.hpp:56
Gecode::VarImpVar< Set::SetVarImp >::varimp
Set::SetVarImp * varimp(void) const
Definition var.hpp:96
Gecode::VarImpVar< Set::SetVarImp >::x
Set::SetVarImp * x
Definition var.hpp:50
Gecode::VarImpVar< Set::SetVarImp >::VarImpVar
VarImpVar(void)
Definition var.hpp:88
Gecode::Set
Finite integer sets.
Definition var-imp.hpp:137
Gecode
Gecode toplevel namespace
forceinline
#define forceinline
Definition config.hpp:187