int.cpp
Go to the documentation of this file.
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
* Main authors:
* Guido Tack <tack@gecode.org>
*
* Copyright:
* Guido Tack, 2005
*
* 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.
*
*/
#include "test/set.hh"
#include "test/int.hh"
#include <gecode/minimodel.hh>
using namespace Gecode;
namespace Test { namespace Set {
namespace Int {
static const int d1r[4][2] = {
{-4,-3},{-1,-1},{1,1},{3,5}
};
static IntSet d1(d1r,4);
static IntSet d2(-1,3);
static IntSet d3(0,3);
static IntSet d4(0,4);
static IntSet ds_33(-3,3);
class Card : public SetTest {
public:
Card(const char* t)
: SetTest(t,1,ds_33,true,1) {}
virtual bool solution(const SetAssignment& x) const {
unsigned int s = 0;
for (CountableSetRanges xr(x.lub, x[0]);xr();++xr) s+= xr.width();
if (x.intval() < 0)
return false;
return s==(unsigned int)x.intval();
}
virtual void post(Space& home, SetVarArray& x, IntVarArray& y) {
Gecode::cardinality(home, x[0], y[0]);
}
virtual void post(Space& home, SetVarArray& x, IntVarArray& y,
Reify r) {
Gecode::cardinality(home, x[0], y[0], r);
}
};
Card _card("Int::Card");
class Min : public SetTest {
public:
Min(const char* t)
: SetTest(t,1,ds_33,true,1) {}
virtual bool solution(const SetAssignment& x) const {
CountableSetRanges xr0(x.lub, x[0]);
return xr0() && xr0.min()==x.intval();
}
virtual void post(Space& home, SetVarArray& x, IntVarArray& y) {
Gecode::min(home, x[0], y[0]);
}
virtual void post(Space& home, SetVarArray& x, IntVarArray& y,
Reify r) {
Gecode::min(home, x[0], y[0], r);
}
};
Min _min("Int::Min");
class NotMin : public SetTest {
public:
NotMin(const char* t)
: SetTest(t,1,ds_33,false,1) {}
virtual bool solution(const SetAssignment& x) const {
CountableSetRanges xr0(x.lub, x[0]);
return !(xr0() && xr0.min()==x.intval());
}
virtual void post(Space& home, SetVarArray& x, IntVarArray& y) {
Gecode::notMin(home, x[0], y[0]);
}
};
NotMin _notmin("Int::NotMin");
class Max : public SetTest {
public:
Max(const char* t)
: SetTest(t,1,ds_33,true,1) {}
virtual bool solution(const SetAssignment& x) const {
CountableSetRanges xr0(x.lub, x[0]);
IntSet x0(xr0);
return x0.ranges() > 0 && x0.max()==x.intval();
}
virtual void post(Space& home, SetVarArray& x, IntVarArray& y) {
Gecode::max(home, x[0], y[0]);
}
virtual void post(Space& home, SetVarArray& x, IntVarArray& y,
Reify r) {
Gecode::max(home, x[0], y[0], r);
}
};
Max _max("Int::Max");
class NotMax : public SetTest {
public:
NotMax(const char* t)
: SetTest(t,1,ds_33,false,1) {}
virtual bool solution(const SetAssignment& x) const {
CountableSetRanges xr0(x.lub, x[0]);
IntSet x0(xr0);
return !(x0.ranges() > 0 && x0.max()==x.intval());
}
virtual void post(Space& home, SetVarArray& x, IntVarArray& y) {
Gecode::notMax(home, x[0], y[0]);
}
};
NotMax _notmax("Int::NotMax");
class Elem : public SetTest {
public:
Elem(const char* t)
: SetTest(t,1,ds_33,true,1) {}
virtual bool solution(const SetAssignment& x) const {
for (CountableSetValues xr(x.lub, x[0]);xr();++xr)
if (xr.val()==x.intval())
return true;
return false;
}
virtual void post(Space& home, SetVarArray& x, IntVarArray& y) {
Gecode::rel(home, x[0], SRT_SUP, y[0]);
}
virtual void post(Space& home, SetVarArray& x, IntVarArray& y,
Reify r) {
Gecode::rel(home, x[0], SRT_SUP, y[0], r);
}
};
Elem _elem("Int::Elem");
class NoElem : public SetTest {
public:
NoElem(const char* t)
: SetTest(t,1,ds_33,false,1) {}
virtual bool solution(const SetAssignment& x) const {
for (CountableSetValues xr(x.lub, x[0]);xr();++xr)
if (xr.val()==x.intval())
return false;
return true;
}
virtual void post(Space& home, SetVarArray& x, IntVarArray& y) {
Gecode::rel(home, x[0], SRT_DISJ, y[0]);
}
};
NoElem _noelem("Int::NoElem");
class Rel : public SetTest {
private:
Gecode::SetRelType srt;
bool swapped;
public:
Rel(Gecode::SetRelType srt0, bool s)
: SetTest("Int::Rel::"+str(srt0)+(s ? "::s" : ""),
1,ds_33,true,1),
srt(srt0), swapped(s) {}
virtual bool solution(const SetAssignment& x) const {
CountableSetRanges xr(x.lub, x[0]);
IntSet is(x.intval(), x.intval());
IntSetRanges dr(is);
Gecode::SetRelType rsrt = srt;
if (swapped) {
switch (srt) {
case SRT_SUB: rsrt = SRT_SUP; break;
case SRT_SUP: rsrt = SRT_SUB; break;
default: break;
}
}
switch (rsrt) {
case SRT_EQ: return Iter::Ranges::equal(xr, dr);
case SRT_NQ: return !Iter::Ranges::equal(xr, dr);
case SRT_SUB: return Iter::Ranges::subset(xr, dr);
case SRT_SUP: return Iter::Ranges::subset(dr, xr);
case SRT_DISJ:
{
Gecode::Iter::Ranges::Inter<CountableSetRanges,IntSetRanges>
inter(xr, dr);
return !inter();
}
case SRT_CMPL:
{
Gecode::Set::RangesCompl<IntSetRanges> drc(dr);
return Iter::Ranges::equal(xr,drc);
}
default: GECODE_NEVER;
}
return false;
}
virtual void post(Space& home, SetVarArray& x, IntVarArray& y) {
if (!swapped)
Gecode::rel(home, x[0], srt, y[0]);
else
Gecode::rel(home, y[0], srt, x[0]);
}
virtual void post(Space& home, SetVarArray& x, IntVarArray& y,
Reify r) {
if (!swapped)
Gecode::rel(home, x[0], srt, y[0], r);
else
Gecode::rel(home, y[0], srt, x[0], r);
}
};
Rel _rel_eq(Gecode::SRT_EQ,false);
Rel _rel_nq(Gecode::SRT_NQ,false);
Rel _rel_sub(Gecode::SRT_SUB,false);
Rel _rel_sup(Gecode::SRT_SUP,false);
Rel _rel_disj(Gecode::SRT_DISJ,false);
Rel _rel_cmpl(Gecode::SRT_CMPL,false);
Rel _rel_eqs(Gecode::SRT_EQ,true);
Rel _rel_nqs(Gecode::SRT_NQ,true);
Rel _rel_subs(Gecode::SRT_SUB,true);
Rel _rel_sups(Gecode::SRT_SUP,true);
Rel _rel_disjs(Gecode::SRT_DISJ,true);
Rel _rel_cmpls(Gecode::SRT_CMPL,true);
class IntRel : public SetTest {
private:
Gecode::IntRelType irt;
bool swapped;
public:
IntRel(Gecode::IntRelType irt0, bool s)
: SetTest("Int::IntRel::"+Test::Int::Test::str(irt0)+
(s ? "::s" : ""),1,ds_33,true,1),
irt(irt0), swapped(s) {
testsubsumed = false;
}
virtual bool solution(const SetAssignment& x) const {
CountableSetValues xr(x.lub, x[0]);
if (!xr())
return false;
for (; xr(); ++xr)
switch (irt) {
case Gecode::IRT_EQ:
if (xr.val() != x.intval()) return false;
break;
case Gecode::IRT_NQ:
if (xr.val() == x.intval()) return false;
break;
case Gecode::IRT_GR:
if (!swapped && xr.val() <= x.intval()) return false;
if (swapped && xr.val() >= x.intval()) return false;
break;
case Gecode::IRT_GQ:
if (!swapped && xr.val() < x.intval()) return false;
if (swapped && xr.val() > x.intval()) return false;
break;
case Gecode::IRT_LE:
if (!swapped && xr.val() >= x.intval()) return false;
if (swapped && xr.val() <= x.intval()) return false;
break;
case Gecode::IRT_LQ:
if (!swapped && xr.val() > x.intval()) return false;
if (swapped && xr.val() < x.intval()) return false;
break;
default:
GECODE_NEVER;
return false;
}
return true;
}
virtual void post(Space& home, SetVarArray& x, IntVarArray& y) {
if (!swapped)
Gecode::rel(home, x[0], irt, y[0]);
else
Gecode::rel(home, y[0], irt, x[0]);
}
virtual void post(Space& home, SetVarArray& x, IntVarArray& y,
Reify r) {
assert((x.size() == 1) && (y.size() == 1));
if ((r.mode() != Gecode::RM_EQV) || (Base::rand(2) != 0)) {
if (!swapped)
Gecode::rel(home, x[0], irt, y[0], r);
else
Gecode::rel(home, y[0], irt, x[0], r);
} else if (swapped) {
switch (irt) {
case Gecode::IRT_EQ:
Gecode::rel(home, (y[0] == x[0]) == r.var()); break;
case Gecode::IRT_NQ:
Gecode::rel(home, (y[0] != x[0]) == r.var()); break;
case Gecode::IRT_LE:
Gecode::rel(home, (y[0] < x[0]) == r.var()); break;
case Gecode::IRT_LQ:
Gecode::rel(home, (y[0] <= x[0]) == r.var()); break;
case Gecode::IRT_GR:
Gecode::rel(home, (y[0] > x[0]) == r.var()); break;
case Gecode::IRT_GQ:
Gecode::rel(home, (y[0] >= x[0]) == r.var()); break;
default: GECODE_NEVER;
}
} else {
switch (irt) {
case Gecode::IRT_EQ:
Gecode::rel(home, (x[0] == y[0]) == r.var()); break;
case Gecode::IRT_NQ:
Gecode::rel(home, (x[0] != y[0]) == r.var()); break;
case Gecode::IRT_LE:
Gecode::rel(home, (x[0] < y[0]) == r.var()); break;
case Gecode::IRT_LQ:
Gecode::rel(home, (x[0] <= y[0]) == r.var()); break;
case Gecode::IRT_GR:
Gecode::rel(home, (x[0] > y[0]) == r.var()); break;
case Gecode::IRT_GQ:
Gecode::rel(home, (x[0] >= y[0]) == r.var()); break;
default: GECODE_NEVER;
}
}
}
};
IntRel _intrel_eq(Gecode::IRT_EQ,false);
IntRel _intrel_nq(Gecode::IRT_NQ,false);
IntRel _intrel_gr(Gecode::IRT_GR,false);
IntRel _intrel_gq(Gecode::IRT_GQ,false);
IntRel _intrel_le(Gecode::IRT_LE,false);
IntRel _intrel_lq(Gecode::IRT_LQ,false);
IntRel _intrel_eqs(Gecode::IRT_EQ,true);
IntRel _intrel_nqs(Gecode::IRT_NQ,true);
IntRel _intrel_grs(Gecode::IRT_GR,true);
IntRel _intrel_gqs(Gecode::IRT_GQ,true);
IntRel _intrel_les(Gecode::IRT_LE,true);
IntRel _intrel_lqs(Gecode::IRT_LQ,true);
template<class I>
int weightI(const IntArgs& elements,
const IntArgs& weights,
I& iter) {
int sum = 0;
int i = 0;
for (Iter::Ranges::ToValues<I> v(iter); v(); ++v) {
// Skip all elements below the current
while (elements[i]<v.val()) i++;
assert(elements[i] == v.val());
sum += weights[i];
}
return sum;
}
class Weights : public SetTest {
public:
IntArgs elements;
IntArgs weights;
int minWeight;
int maxWeight;
Weights(const char* t, IntArgs& el, IntArgs& w,
int min = -10000, int max = 10000)
: SetTest(t,1,ds_33,false,1),
elements(el), weights(w), minWeight(min), maxWeight(max) {}
virtual bool solution(const SetAssignment& x) const {
CountableSetRanges x0(x.lub, x[0]);
return x.intval()==weightI(elements,weights,x0) &&
x.intval() >= minWeight && x.intval() <= maxWeight;
}
virtual void post(Space& home, SetVarArray& x, IntVarArray& y) {
Gecode::rel(home, minWeight <= y[0]);
Gecode::rel(home, maxWeight >= y[0]);
Gecode::weights(home, elements, weights, x[0], y[0]);
}
};
const int el1v[] = {-3,-2,-1,0,1,2,3};
IntArgs el1(7,el1v);
const int w1v[] = {1,-2,1,1,1,6,1};
IntArgs w1(7,w1v);
Weights _weights1("Int::Weights::1", el1, w1);
const int w2v[] = {-1,-1,-1,10,-1,-1,-1};
IntArgs w2(7,w2v);
Weights _weights2("Int::Weights::2", el1, w2);
Weights _weights3("Int::Weights::3", el1, w2, 3);
const int w4v[] = {1,1,0,0,0,0,0};
IntArgs w4(7,w4v);
Weights _weights4("Int::Weights::4", el1, w4);
}}}
// STATISTICS: test-set
Gecode::IntArgs
Passing integer arguments.
Definition int.hh:628
Gecode::IntSetRanges
Range iterator for integer sets.
Definition int.hh:292
Gecode::IntSet
Integer sets.
Definition int.hh:174
Gecode::IntSet::max
int max(int i) const
Return maximum of range at position i.
Definition int-set-1.hpp:158
Gecode::IntSet::ranges
int ranges(void) const
Return number of ranges of the specification.
Definition int-set-1.hpp:171
Gecode::IntVarArray
Integer variable array.
Definition int.hh:763
Gecode::Iter::Ranges::Inter
Range iterator for computing intersection (binary).
Definition ranges-inter.hpp:44
Gecode::Iter::Ranges::MinMax::min
int min(void) const
Return smallest value of range.
Definition ranges-minmax.hpp:99
Gecode::Iter::Ranges::ToValues
Value iterator from range iterator.
Definition ranges-values.hpp:42
Gecode::Reify
Reification specification.
Definition int.hh:876
Gecode::SetVarArray
Set variable array
Definition set.hh:570
Gecode::Set::RangesCompl
A complement iterator spezialized for the BndSet limits.
Definition var-imp.hpp:293
Gecode::Space
Computation spaces.
Definition core.hpp:1742
Gecode::VarArray::size
int size(void) const
Return size of array (number of elements).
Definition array.hpp:926
Test::Base::rand
static Gecode::Support::RandomGenerator rand
Random number generator.
Definition test.hh:134
Test::Set::CountableSetRanges
Range iterator producing subsets of an IntSet.
Definition set.hh:99
Test::Set::CountableSetValues
Value iterator producing subsets of an IntSet.
Definition set.hh:60
Test::Set::CountableSetValues::val
int val(void) const
Return current value.
Definition set.hh:94
Test::Set::Int::Card
Test for cardinality constraint
Definition int.cpp:64
Test::Set::Int::Card::Card
Card(const char *t)
Create and register test.
Definition int.cpp:67
Test::Set::Int::Card::post
virtual void post(Space &home, SetVarArray &x, IntVarArray &y, Reify r)
Post reified constraint on x.
Definition int.cpp:82
Test::Set::Int::Card::solution
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
Definition int.cpp:70
Test::Set::Int::Card::post
virtual void post(Space &home, SetVarArray &x, IntVarArray &y)
Post constraint on x.
Definition int.cpp:78
Test::Set::Int::Elem
Test for element constraint
Definition int.cpp:174
Test::Set::Int::Elem::post
virtual void post(Space &home, SetVarArray &x, IntVarArray &y)
Post constraint on x.
Definition int.cpp:187
Test::Set::Int::Elem::Elem
Elem(const char *t)
Create and register test.
Definition int.cpp:177
Test::Set::Int::Elem::post
virtual void post(Space &home, SetVarArray &x, IntVarArray &y, Reify r)
Post reified constraint on x for b.
Definition int.cpp:191
Test::Set::Int::Elem::solution
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
Definition int.cpp:180
Test::Set::Int::IntRel
Test for integer relation constraint
Definition int.cpp:294
Test::Set::Int::IntRel::IntRel
IntRel(Gecode::IntRelType irt0, bool s)
Create and register test.
Definition int.cpp:302
Test::Set::Int::IntRel::post
virtual void post(Space &home, SetVarArray &x, IntVarArray &y, Reify r)
Post reified constraint on x for r.
Definition int.cpp:351
Test::Set::Int::IntRel::solution
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
Definition int.cpp:309
Test::Set::Int::IntRel::post
virtual void post(Space &home, SetVarArray &x, IntVarArray &y)
Post constraint on x.
Definition int.cpp:344
Test::Set::Int::Max
Test for maximal element constraint
Definition int.cpp:131
Test::Set::Int::Max::Max
Max(const char *t)
Create and register test.
Definition int.cpp:134
Test::Set::Int::Max::post
virtual void post(Space &home, SetVarArray &x, IntVarArray &y, Reify r)
Post reified constraint on x.
Definition int.cpp:147
Test::Set::Int::Max::solution
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
Definition int.cpp:137
Test::Set::Int::Max::post
virtual void post(Space &home, SetVarArray &x, IntVarArray &y)
Post constraint on x.
Definition int.cpp:143
Test::Set::Int::Min
Test for minimal element constraint
Definition int.cpp:90
Test::Set::Int::Min::solution
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
Definition int.cpp:96
Test::Set::Int::Min::Min
Min(const char *t)
Create and register test.
Definition int.cpp:93
Test::Set::Int::Min::post
virtual void post(Space &home, SetVarArray &x, IntVarArray &y)
Post constraint on x.
Definition int.cpp:101
Test::Set::Int::Min::post
virtual void post(Space &home, SetVarArray &x, IntVarArray &y, Reify r)
Post reified constraint on x.
Definition int.cpp:105
Test::Set::Int::NoElem
Test for negated element constraint
Definition int.cpp:199
Test::Set::Int::NoElem::post
virtual void post(Space &home, SetVarArray &x, IntVarArray &y)
Post constraint on x.
Definition int.cpp:212
Test::Set::Int::NoElem::solution
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
Definition int.cpp:205
Test::Set::Int::NoElem::NoElem
NoElem(const char *t)
Create and register test.
Definition int.cpp:202
Test::Set::Int::NotMax
Test for negated maximal element constraint
Definition int.cpp:155
Test::Set::Int::NotMax::NotMax
NotMax(const char *t)
Create and register test.
Definition int.cpp:158
Test::Set::Int::NotMax::post
virtual void post(Space &home, SetVarArray &x, IntVarArray &y)
Post constraint on x.
Definition int.cpp:167
Test::Set::Int::NotMax::solution
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
Definition int.cpp:161
Test::Set::Int::NotMin
Test for negated minimal element constraint
Definition int.cpp:113
Test::Set::Int::NotMin::NotMin
NotMin(const char *t)
Create and register test.
Definition int.cpp:116
Test::Set::Int::NotMin::post
virtual void post(Space &home, SetVarArray &x, IntVarArray &y)
Post constraint on x.
Definition int.cpp:124
Test::Set::Int::NotMin::solution
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
Definition int.cpp:119
Test::Set::Int::Rel
Test for relation constraint
Definition int.cpp:219
Test::Set::Int::Rel::Rel
Rel(Gecode::SetRelType srt0, bool s)
Create and register test.
Definition int.cpp:227
Test::Set::Int::Rel::solution
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
Definition int.cpp:232
Test::Set::Int::Rel::post
virtual void post(Space &home, SetVarArray &x, IntVarArray &y)
Post constraint on x.
Definition int.cpp:265
Test::Set::Int::Rel::post
virtual void post(Space &home, SetVarArray &x, IntVarArray &y, Reify r)
Post reified constraint on x for r.
Definition int.cpp:272
Test::Set::Int::Weights
Test for set weight constraint
Definition int.cpp:424
Test::Set::Int::Weights::post
virtual void post(Space &home, SetVarArray &x, IntVarArray &y)
Post constraint on x.
Definition int.cpp:442
Test::Set::Int::Weights::Weights
Weights(const char *t, IntArgs &el, IntArgs &w, int min=-10000, int max=10000)
Create and register test.
Definition int.cpp:431
Test::Set::Int::Weights::elements
IntArgs elements
Definition int.cpp:426
Test::Set::Int::Weights::minWeight
int minWeight
Definition int.cpp:428
Test::Set::Int::Weights::weights
IntArgs weights
Definition int.cpp:427
Test::Set::Int::Weights::solution
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
Definition int.cpp:436
Test::Set::Int::Weights::maxWeight
int maxWeight
Definition int.cpp:429
Test::Set::SetAssignment
Generate all set assignments.
Definition set.hh:142
Test::Set::SetAssignment::intval
int intval(void) const
Return value for first integer variable.
Definition set.hh:169
Test::Set::SetAssignment::lub
Gecode::IntSet lub
The common superset for all domains.
Definition set.hh:154
Test::Set::SetTest::str
static std::string str(Gecode::SetRelType srt)
Map set relation to string.
Definition set.hpp:46
Test::Set::SetTest::testsubsumed
bool testsubsumed
Whether to check for subsumption.
Definition set.hh:295
Test::Set::SetTest::SetTest
SetTest(const std::string &s, int a, const Gecode::IntSet &d, bool r=false, int w=0)
Constructor.
Definition set.hh:304
Gecode::rel
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVar x1)
Post propagator for .
Definition rel.cpp:68
Gecode::IntRelType
IntRelType
Relation types for integers.
Definition int.hh:925
Gecode::IRT_EQ
@ IRT_EQ
Equality ( ).
Definition int.hh:926
Gecode::IRT_NQ
@ IRT_NQ
Disequality ( ).
Definition int.hh:927
Gecode::IRT_GQ
@ IRT_GQ
Greater or equal ( ).
Definition int.hh:930
Gecode::IRT_LE
@ IRT_LE
Less ( ).
Definition int.hh:929
Gecode::IRT_GR
@ IRT_GR
Greater ( ).
Definition int.hh:931
Gecode::IRT_LQ
@ IRT_LQ
Less or equal ( ).
Definition int.hh:928
Gecode::RM_EQV
@ RM_EQV
Equivalence for reification (default).
Definition int.hh:855
Gecode::weights
void weights(Home home, IntSharedArray elements, IntSharedArray weights, SetVar x, IntVar y)
Post propagator for .
Definition int.cpp:292
Gecode::notMin
void notMin(Home home, SetVar s, IntVar x)
Post propagator that x is not the minimal element of s.
Definition int.cpp:235
Gecode::notMax
void notMax(Home home, SetVar s, IntVar x)
Post propagator that x is not the maximal element of s.
Definition int.cpp:267
Gecode::SetRelType
SetRelType
Common relation types for sets.
Definition set.hh:643
Gecode::SRT_CMPL
@ SRT_CMPL
Complement.
Definition set.hh:649
Gecode::SRT_NQ
@ SRT_NQ
Disequality ( ).
Definition set.hh:645
Gecode::SRT_EQ
@ SRT_EQ
Equality ( ).
Definition set.hh:644
Gecode::SRT_SUP
@ SRT_SUP
Superset ( ).
Definition set.hh:647
Gecode::SRT_DISJ
@ SRT_DISJ
Disjoint ( ).
Definition set.hh:648
Gecode::SRT_SUB
@ SRT_SUB
Subset ( ).
Definition set.hh:646
minimodel.hh
Gecode::Iter::Ranges::subset
bool subset(I &i, J &j)
Check whether range iterator i is subset of range iterator j.
Definition ranges-operations.hpp:97
Gecode::Iter::Ranges::equal
bool equal(I &i, J &j)
Check whether range iterators i and j are equal.
Definition ranges-operations.hpp:84
Gecode
Gecode toplevel namespace
Gecode::min
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition arithmetic.cpp:67
Gecode::inter
SetExpr inter(const SetVarArgs &)
Intersection of set variables.
Definition set-expr.cpp:696
Gecode::sum
LinIntExpr sum(const IntVarArgs &x)
Construct linear expression as sum of integer variables.
Definition int-expr.cpp:880
Gecode::max
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition arithmetic.cpp:49
Gecode::cardinality
LinIntExpr cardinality(const SetExpr &)
Cardinality of set expression.
Definition set-expr.cpp:817
Test::Set::Int
Tests for combined int/set constraints
Definition int.cpp:43
Test::Set::Int::_intrel_gq
IntRel _intrel_gq(Gecode::IRT_GQ, false)
Test::Set::Int::_rel_sup
Rel _rel_sup(Gecode::SRT_SUP, false)
Test::Set::Int::w1v
const int w1v[]
Definition int.cpp:451
Test::Set::Int::_intrel_nq
IntRel _intrel_nq(Gecode::IRT_NQ, false)
Test::Set::Int::w1
IntArgs w1(7, w1v)
Test::Set::Int::_noelem
NoElem _noelem("Int::NoElem")
Test::Set::Int::weightI
int weightI(const IntArgs &elements, const IntArgs &weights, I &iter)
Definition int.cpp:409
Test::Set::Int::_min
Min _min("Int::Min")
Test::Set::Int::_card
Card _card("Int::Card")
Test::Set::Int::_intrel_eq
IntRel _intrel_eq(Gecode::IRT_EQ, false)
Test::Set::Int::w4v
const int w4v[]
Definition int.cpp:460
Test::Set::Int::_intrel_gr
IntRel _intrel_gr(Gecode::IRT_GR, false)
Test::Set::Int::_intrel_nqs
IntRel _intrel_nqs(Gecode::IRT_NQ, true)
Test::Set::Int::el1v
const int el1v[]
Definition int.cpp:449
Test::Set::Int::_weights1
Weights _weights1("Int::Weights::1", el1, w1)
Test::Set::Int::el1
IntArgs el1(7, el1v)
Test::Set::Int::w2
IntArgs w2(7, w2v)
Test::Set::Int::_weights4
Weights _weights4("Int::Weights::4", el1, w4)
Test::Set::Int::_notmin
NotMin _notmin("Int::NotMin")
Test::Set::Int::_rel_nq
Rel _rel_nq(Gecode::SRT_NQ, false)
Test::Set::Int::_rel_disj
Rel _rel_disj(Gecode::SRT_DISJ, false)
Test::Set::Int::_intrel_gqs
IntRel _intrel_gqs(Gecode::IRT_GQ, true)
Test::Set::Int::_notmax
NotMax _notmax("Int::NotMax")
Test::Set::Int::_rel_cmpl
Rel _rel_cmpl(Gecode::SRT_CMPL, false)
Test::Set::Int::_rel_sups
Rel _rel_sups(Gecode::SRT_SUP, true)
Test::Set::Int::_weights3
Weights _weights3("Int::Weights::3", el1, w2, 3)
Test::Set::Int::_rel_subs
Rel _rel_subs(Gecode::SRT_SUB, true)
Test::Set::Int::_elem
Elem _elem("Int::Elem")
Test::Set::Int::_rel_eqs
Rel _rel_eqs(Gecode::SRT_EQ, true)
Test::Set::Int::_intrel_grs
IntRel _intrel_grs(Gecode::IRT_GR, true)
Test::Set::Int::_rel_eq
Rel _rel_eq(Gecode::SRT_EQ, false)
Test::Set::Int::_intrel_le
IntRel _intrel_le(Gecode::IRT_LE, false)
Test::Set::Int::_intrel_eqs
IntRel _intrel_eqs(Gecode::IRT_EQ, true)
Test::Set::Int::_intrel_les
IntRel _intrel_les(Gecode::IRT_LE, true)
Test::Set::Int::_rel_cmpls
Rel _rel_cmpls(Gecode::SRT_CMPL, true)
Test::Set::Int::w2v
const int w2v[]
Definition int.cpp:455
Test::Set::Int::w4
IntArgs w4(7, w4v)
Test::Set::Int::_intrel_lq
IntRel _intrel_lq(Gecode::IRT_LQ, false)
Test::Set::Int::_max
Max _max("Int::Max")
Test::Set::Int::_weights2
Weights _weights2("Int::Weights::2", el1, w2)
Test::Set::Int::_rel_sub
Rel _rel_sub(Gecode::SRT_SUB, false)
Test::Set::Int::_intrel_lqs
IntRel _intrel_lqs(Gecode::IRT_LQ, true)
Test::Set::Int::_rel_disjs
Rel _rel_disjs(Gecode::SRT_DISJ, true)
Test::Set::Int::_rel_nqs
Rel _rel_nqs(Gecode::SRT_NQ, true)
Test::Set
Testing finite sets.
Definition set.cpp:42
Test
General test support.
Definition afc.cpp:39
Test::r
Region r
Definition region.cpp:65
GECODE_NEVER
#define GECODE_NEVER
Assert that this command is never executed.
Definition macros.hpp:56
int.hh
set.hh