rel.cpp
Go to the documentation of this file.
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
* Main authors:
* Christian Schulte <schulte@gecode.org>
*
* Copyright:
* Christian Schulte, 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/int.hh"
#include <gecode/minimodel.hh>
namespace Test { namespace Int {
namespace Rel {
class IntVarXY : public Test {
protected:
Gecode::IntRelType irt;
public:
IntVarXY(Gecode::IntRelType irt0, int n, Gecode::IntPropLevel ipl)
: Test("Rel::Int::Var::XY::"+str(irt0)+"::"+str(ipl)+"::"+str(n),
n+1,-3,3,n==1,ipl),
irt(irt0) {}
virtual bool solution(const Assignment& x) const {
if (x.size() == 2) {
return cmp(x[0],irt,x[1]);
} else {
return cmp(x[0],irt,x[2]) && cmp(x[1],irt,x[2]);
}
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
using namespace Gecode;
if (x.size() == 2) {
rel(home, x[0], irt, x[1], ipl);
} else {
IntVarArgs y(2);
y[0]=x[0]; y[1]=x[1];
rel(home, y, irt, x[2], ipl);
}
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x,
Gecode::Reify r) {
assert(x.size() == 2);
Gecode::rel(home, x[0], irt, x[1], r, ipl);
}
};
class IntVarXX : public Test {
protected:
Gecode::IntRelType irt;
public:
IntVarXX(Gecode::IntRelType irt0, Gecode::IntPropLevel ipl)
: Test("Rel::Int::Var::XX::"+str(irt0)+"::"+str(ipl),
1,-3,3,true,ipl),
irt(irt0) {
contest = ((irt != Gecode::IRT_LE) &&
(irt != Gecode::IRT_GR) &&
(irt != Gecode::IRT_NQ))
? CTL_DOMAIN : CTL_NONE;
}
virtual bool solution(const Assignment& x) const {
return cmp(x[0],irt,x[0]);
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
Gecode::rel(home, x[0], irt, x[0], ipl);
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x,
Gecode::Reify r) {
Gecode::rel(home, x[0], irt, x[0], r, ipl);
}
};
class BoolVarXY : public Test {
protected:
Gecode::IntRelType irt;
public:
BoolVarXY(Gecode::IntRelType irt0, int n)
: Test("Rel::Bool::Var::XY::"+str(irt0)+"::"+str(n),n+1,0,1,
n==1),
irt(irt0) {}
virtual bool solution(const Assignment& x) const {
if (x.size() == 2) {
return cmp(x[0],irt,x[1]);
} else {
return cmp(x[0],irt,x[2]) && cmp(x[1],irt,x[2]);
}
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
using namespace Gecode;
if (x.size() == 2) {
rel(home, channel(home,x[0]), irt, channel(home,x[1]));
} else {
BoolVarArgs y(2);
y[0]=channel(home,x[0]); y[1]=channel(home,x[1]);
rel(home, y, irt, channel(home,x[2]));
}
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x,
Gecode::Reify r) {
assert(x.size() == 2);
using namespace Gecode;
rel(home,
channel(home,x[0]), irt, channel(home,x[1]),
r);
}
};
class BoolVarXX : public Test {
protected:
Gecode::IntRelType irt;
public:
BoolVarXX(Gecode::IntRelType irt0)
: Test("Rel::Bool::Var::XX::"+str(irt0),1,0,1),
irt(irt0) {
contest = ((irt != Gecode::IRT_LE) &&
(irt != Gecode::IRT_GR) &&
(irt != Gecode::IRT_NQ))
? CTL_DOMAIN : CTL_NONE;
}
virtual bool solution(const Assignment& x) const {
return cmp(x[0],irt,x[0]);
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
Gecode::BoolVar b = Gecode::channel(home,x[0]);
Gecode::rel(home, b, irt, b);
}
};
class IntInt : public Test {
protected:
Gecode::IntRelType irt;
int c;
public:
IntInt(Gecode::IntRelType irt0, int n, int c0)
: Test("Rel::Int::Int::"+str(irt0)+"::"+str(n)+"::"+str(c0),
n,-3,3,n==1),
irt(irt0), c(c0) {}
virtual bool solution(const Assignment& x) const {
if (x.size() == 1)
return cmp(x[0],irt,c);
else
return cmp(x[0],irt,c) && cmp(x[1],irt,c);
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
using namespace Gecode;
if (x.size() == 1)
rel(home, x[0], irt, c);
else
rel(home, x, irt, c);
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x,
Gecode::Reify r) {
assert(x.size() == 1);
Gecode::rel(home, x[0], irt, c, r);
}
};
class BoolInt : public Test {
protected:
Gecode::IntRelType irt;
int c;
public:
BoolInt(Gecode::IntRelType irt0, int n, int c0)
: Test("Rel::Bool::Int::"+str(irt0)+"::"+str(n)+"::"+str(c0),n,0,1,
n==1),
irt(irt0), c(c0) {}
virtual bool solution(const Assignment& x) const {
if (x.size() == 1)
return cmp(x[0],irt,c);
else
return cmp(x[0],irt,c) && cmp(x[1],irt,c);
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
using namespace Gecode;
if (x.size() == 1) {
rel(home, channel(home,x[0]), irt, c);
} else {
BoolVarArgs y(2);
y[0]=channel(home,x[0]); y[1]=channel(home,x[1]);
rel(home, y, irt, c);
}
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x,
Gecode::Reify r) {
assert(x.size() == 1);
using namespace Gecode;
rel(home, channel(home,x[0]), irt, c, r);
}
};
class IntSeq : public Test {
protected:
Gecode::IntRelType irt;
public:
IntSeq(int n, Gecode::IntRelType irt0, Gecode::IntPropLevel ipl)
: Test("Rel::Int::Seq::"+str(n)+"::"+str(irt0)+"::"+str(ipl),
n,-3,3,false,ipl),
irt(irt0) {}
virtual bool solution(const Assignment& x) const {
if (irt == Gecode::IRT_NQ) {
if (x.size() < 2)
return false;
for (int i=0; i<x.size()-1; i++)
if (x[i] != x[i+1])
return true;
return false;
} else {
for (int i=0; i<x.size()-1; i++)
if (!cmp(x[i],irt,x[i+1]))
return false;
return true;
}
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
Gecode::rel(home, x, irt, ipl);
}
};
class IntSharedSeq : public Test {
protected:
Gecode::IntRelType irt;
public:
IntSharedSeq(int n, Gecode::IntRelType irt0, Gecode::IntPropLevel ipl)
: Test("Rel::Int::Seq::Shared::"+str(n)+"::"+str(irt0)+"::"+str(ipl),
n,-3,3,false,ipl),
irt(irt0) {}
virtual bool solution(const Assignment& x) const {
if (irt == Gecode::IRT_NQ) {
if (x.size() < 2)
return false;
for (int i=0; i<x.size()-1; i++)
if (x[i] != x[i+1])
return true;
return false;
} else {
int n = x.size();
for (int i=0; i<2*n-1; i++)
if (!cmp(x[i % n],irt,x[(i+1) % n]))
return false;
return true;
}
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
using namespace Gecode;
int n = x.size();
IntVarArgs y(2*n);
for (int i=n; i--; )
y[i] = y[n+i] = x[i];
rel(home, y, irt, ipl);
}
};
class BoolSeq : public Test {
protected:
Gecode::IntRelType irt;
public:
BoolSeq(int n, Gecode::IntRelType irt0)
: Test("Rel::Bool::Seq::"+str(n)+"::"+str(irt0),n,0,1),
irt(irt0) {}
virtual bool solution(const Assignment& x) const {
if (irt == Gecode::IRT_NQ) {
if (x.size() < 2)
return false;
for (int i=0; i<x.size()-1; i++)
if (x[i] != x[i+1])
return true;
return false;
} else {
for (int i=0; i<x.size()-1; i++)
if (!cmp(x[i],irt,x[i+1]))
return false;
return true;
}
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
using namespace Gecode;
BoolVarArgs b(x.size());
for (int i=x.size(); i--; )
b[i]=channel(home,x[i]);
rel(home, b, irt);
}
};
class BoolSharedSeq : public Test {
protected:
Gecode::IntRelType irt;
public:
BoolSharedSeq(int n, Gecode::IntRelType irt0)
: Test("Rel::Bool::Seq::Shared::"+str(n)+"::"+str(irt0),n,0,1),
irt(irt0) {}
virtual bool solution(const Assignment& x) const {
if (irt == Gecode::IRT_NQ) {
if (x.size() < 2)
return false;
for (int i=0; i<x.size()-1; i++)
if (x[i] != x[i+1])
return true;
return false;
} else {
int n = x.size();
for (int i=0; i<2*n-1; i++)
if (!cmp(x[i % n],irt,x[(i+1) % n]))
return false;
return true;
}
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
using namespace Gecode;
int n = x.size();
BoolVarArgs b(2*n);
for (int i=n; i--; )
b[i]=b[n+i]=channel(home,x[i]);
rel(home, b, irt);
}
};
class IntArrayVar : public Test {
protected:
Gecode::IntRelType irt;
public:
IntArrayVar(Gecode::IntRelType irt0)
: Test("Rel::Int::Array::Var::"+str(irt0),6,-2,2), irt(irt0) {}
virtual bool solution(const Assignment& x) const {
int n=x.size() >> 1;
for (int i=0; i<n; i++)
if (x[i] != x[n+i])
return cmp(x[i],irt,x[n+i]);
return ((irt == Gecode::IRT_LQ) || (irt == Gecode::IRT_GQ) ||
(irt == Gecode::IRT_EQ));
GECODE_NEVER;
return false;
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
using namespace Gecode;
int n=x.size() >> 1;
IntVarArgs y(n); IntVarArgs z(n);
for (int i=0; i<n; i++) {
y[i]=x[i]; z[i]=x[n+i];
}
rel(home, y, irt, z);
}
};
class IntArrayInt : public Test {
protected:
Gecode::IntRelType irt;
public:
IntArrayInt(Gecode::IntRelType irt0)
: Test("Rel::Int::Array::Int::"+str(irt0),3,-2,2), irt(irt0) {}
virtual bool solution(const Assignment& x) const {
Gecode::IntArgs y({0,0,0});
int n=x.size();
for (int i=0; i<n; i++)
if (x[i] != y[i])
return cmp(x[i],irt,y[i]);
return ((irt == Gecode::IRT_LQ) || (irt == Gecode::IRT_GQ) ||
(irt == Gecode::IRT_EQ));
GECODE_NEVER;
return false;
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
using namespace Gecode;
IntArgs y({0,0,0});
rel(home, x, irt, y);
}
};
class IntArrayDiff : public Test {
protected:
Gecode::IntRelType irt;
static const int n = 4;
int n_fst;
public:
IntArrayDiff(Gecode::IntRelType irt0, int m)
: Test("Rel::Int::Array::"+str(irt0)+"::"+str(m)+"::"+str(n-m),
n,-2,2),
irt(irt0), n_fst(m) {
assert(n_fst <= n);
}
virtual bool solution(const Assignment& x) const {
int n_snd = n - n_fst;
for (int i=0; i<std::min(n_fst,n_snd); i++)
if (x[i] != x[n_fst+i])
return cmp(x[i],irt,x[n_fst+i]);
return cmp(n_fst,irt,n_snd);
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
using namespace Gecode;
int n_snd = n - n_fst;
IntVarArgs y(n_fst); IntVarArgs z(n_snd);
for (int i=0; i<n_fst; i++) {
y[i]=x[i];
}
for (int i=0; i<n_snd; i++) {
z[i]=x[n_fst + i];
}
rel(home, y, irt, z);
}
};
class BoolArrayVar : public Test {
protected:
Gecode::IntRelType irt;
public:
BoolArrayVar(Gecode::IntRelType irt0)
: Test("Rel::Bool::Array::Var::"+str(irt0),10,0,1), irt(irt0) {}
virtual bool solution(const Assignment& x) const {
int n=x.size() >> 1;
for (int i=0; i<n; i++)
if (x[i] != x[n+i])
return cmp(x[i],irt,x[n+i]);
return ((irt == Gecode::IRT_LQ) || (irt == Gecode::IRT_GQ) ||
(irt == Gecode::IRT_EQ));
GECODE_NEVER;
return false;
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
using namespace Gecode;
int n=x.size() >> 1;
BoolVarArgs y(n); BoolVarArgs z(n);
for (int i=0; i<n; i++) {
y[i]=channel(home,x[i]); z[i]=channel(home,x[n+i]);
}
rel(home, y, irt, z);
}
};
class BoolArrayInt : public Test {
protected:
Gecode::IntRelType irt;
public:
BoolArrayInt(Gecode::IntRelType irt0)
: Test("Rel::Bool::Array::Int::"+str(irt0),5,0,1), irt(irt0) {}
virtual bool solution(const Assignment& x) const {
Gecode::IntArgs y({0,0,1,0,0});
for (int i=0; i<5; i++)
if (x[i] != y[i])
return cmp(x[i],irt,y[i]);
return ((irt == Gecode::IRT_LQ) || (irt == Gecode::IRT_GQ) ||
(irt == Gecode::IRT_EQ));
GECODE_NEVER;
return false;
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
using namespace Gecode;
Gecode::IntArgs z({0,0,1,0,0});
int n=x.size();
BoolVarArgs y(n);
for (int i=0; i<n; i++)
y[i]=channel(home,x[i]);
rel(home, y, irt, z);
}
};
class Create {
public:
Create(void) {
using namespace Gecode;
for (IntRelTypes irts; irts(); ++irts) {
for (IntPropLevels ipls; ipls(); ++ipls) {
(void) new IntVarXY(irts.irt(),1,ipls.ipl());
(void) new IntVarXY(irts.irt(),2,ipls.ipl());
(void) new IntVarXX(irts.irt(),ipls.ipl());
(void) new IntSeq(1,irts.irt(),ipls.ipl());
(void) new IntSeq(2,irts.irt(),ipls.ipl());
(void) new IntSeq(3,irts.irt(),ipls.ipl());
(void) new IntSeq(5,irts.irt(),ipls.ipl());
(void) new IntSharedSeq(1,irts.irt(),ipls.ipl());
(void) new IntSharedSeq(2,irts.irt(),ipls.ipl());
(void) new IntSharedSeq(3,irts.irt(),ipls.ipl());
(void) new IntSharedSeq(4,irts.irt(),ipls.ipl());
}
(void) new BoolVarXY(irts.irt(),1);
(void) new BoolVarXY(irts.irt(),2);
(void) new BoolVarXX(irts.irt());
(void) new BoolSeq(1,irts.irt());
(void) new BoolSeq(2,irts.irt());
(void) new BoolSeq(3,irts.irt());
(void) new BoolSeq(10,irts.irt());
(void) new BoolSharedSeq(1,irts.irt());
(void) new BoolSharedSeq(2,irts.irt());
(void) new BoolSharedSeq(3,irts.irt());
(void) new BoolSharedSeq(4,irts.irt());
(void) new BoolSharedSeq(8,irts.irt());
for (int c=-4; c<=4; c++) {
(void) new IntInt(irts.irt(),1,c);
(void) new IntInt(irts.irt(),2,c);
}
for (int c=0; c<=1; c++) {
(void) new BoolInt(irts.irt(),1,c);
(void) new BoolInt(irts.irt(),2,c);
}
(void) new IntArrayVar(irts.irt());
(void) new IntArrayInt(irts.irt());
for (int n_fst=0; n_fst<=4; n_fst++)
(void) new IntArrayDiff(irts.irt(),n_fst);
(void) new BoolArrayVar(irts.irt());
(void) new BoolArrayInt(irts.irt());
}
}
};
Create c;
}
}}
// STATISTICS: test-int
Gecode::BoolVarArgs
Passing Boolean variables.
Definition int.hh:712
Gecode::BoolVar
Boolean integer variables.
Definition int.hh:512
Gecode::IntArgs
Passing integer arguments.
Definition int.hh:628
Gecode::IntVarArgs
Passing integer variables.
Definition int.hh:656
Gecode::IntVarArray
Integer variable array.
Definition int.hh:763
Gecode::Reify
Reification specification.
Definition int.hh:876
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::Int::Assignment
Base class for assignments
Definition int.hh:59
Test::Int::Assignment::size
int size(void) const
Return number of variables.
Definition int.hpp:46
Test::Int::IntPropLevels
Iterator for simple integer propagation levels.
Definition int.hh:332
Test::Int::IntRelTypes
Iterator for integer relation types.
Definition int.hh:368
Test::Int::Rel::BoolArrayInt
Test for relation between arrays of Boolean variables and integers
Definition rel.cpp:540
Test::Int::Rel::BoolArrayInt::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition rel.cpp:560
Test::Int::Rel::BoolArrayInt::irt
Gecode::IntRelType irt
Integer relation type to propagate.
Definition rel.cpp:543
Test::Int::Rel::BoolArrayInt::solution
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition rel.cpp:549
Test::Int::Rel::BoolArrayInt::BoolArrayInt
BoolArrayInt(Gecode::IntRelType irt0)
Create and register test.
Definition rel.cpp:546
Test::Int::Rel::BoolArrayVar
Test for relation between arrays of Boolean variables
Definition rel.cpp:508
Test::Int::Rel::BoolArrayVar::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition rel.cpp:528
Test::Int::Rel::BoolArrayVar::solution
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition rel.cpp:517
Test::Int::Rel::BoolArrayVar::irt
Gecode::IntRelType irt
Integer relation type to propagate.
Definition rel.cpp:511
Test::Int::Rel::BoolArrayVar::BoolArrayVar
BoolArrayVar(Gecode::IntRelType irt0)
Create and register test.
Definition rel.cpp:514
Test::Int::Rel::BoolInt
Test for simple relation involving Boolean variable and integer constant
Definition rel.cpp:221
Test::Int::Rel::BoolInt::c
int c
Integer constant.
Definition rel.cpp:226
Test::Int::Rel::BoolInt::solution
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition rel.cpp:234
Test::Int::Rel::BoolInt::BoolInt
BoolInt(Gecode::IntRelType irt0, int n, int c0)
Create and register test.
Definition rel.cpp:229
Test::Int::Rel::BoolInt::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x, Gecode::Reify r)
Post reified constraint on x for r.
Definition rel.cpp:252
Test::Int::Rel::BoolInt::irt
Gecode::IntRelType irt
Integer relation type to propagate.
Definition rel.cpp:224
Test::Int::Rel::BoolInt::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition rel.cpp:241
Test::Int::Rel::BoolSeq
Test for sequence of relations between Boolean variables
Definition rel.cpp:333
Test::Int::Rel::BoolSeq::BoolSeq
BoolSeq(int n, Gecode::IntRelType irt0)
Create and register test.
Definition rel.cpp:339
Test::Int::Rel::BoolSeq::irt
Gecode::IntRelType irt
Integer relation type to propagate.
Definition rel.cpp:336
Test::Int::Rel::BoolSeq::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition rel.cpp:359
Test::Int::Rel::BoolSeq::solution
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition rel.cpp:343
Test::Int::Rel::BoolSharedSeq
Test for sequence of relations between shared Boolean variables
Definition rel.cpp:369
Test::Int::Rel::BoolSharedSeq::irt
Gecode::IntRelType irt
Integer relation type to propagate.
Definition rel.cpp:372
Test::Int::Rel::BoolSharedSeq::solution
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition rel.cpp:379
Test::Int::Rel::BoolSharedSeq::BoolSharedSeq
BoolSharedSeq(int n, Gecode::IntRelType irt0)
Create and register test.
Definition rel.cpp:375
Test::Int::Rel::BoolSharedSeq::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition rel.cpp:396
Test::Int::Rel::BoolVarXX
Test for simple relation involving shared Boolean variables
Definition rel.cpp:159
Test::Int::Rel::BoolVarXX::BoolVarXX
BoolVarXX(Gecode::IntRelType irt0)
Create and register test.
Definition rel.cpp:165
Test::Int::Rel::BoolVarXX::solution
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition rel.cpp:174
Test::Int::Rel::BoolVarXX::irt
Gecode::IntRelType irt
Integer relation type to propagate.
Definition rel.cpp:162
Test::Int::Rel::BoolVarXX::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition rel.cpp:178
Test::Int::Rel::BoolVarXY
Test for simple relation involving Boolean variables
Definition rel.cpp:118
Test::Int::Rel::BoolVarXY::irt
Gecode::IntRelType irt
Integer relation type to propagate.
Definition rel.cpp:121
Test::Int::Rel::BoolVarXY::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition rel.cpp:137
Test::Int::Rel::BoolVarXY::BoolVarXY
BoolVarXY(Gecode::IntRelType irt0, int n)
Create and register test.
Definition rel.cpp:124
Test::Int::Rel::BoolVarXY::solution
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition rel.cpp:129
Test::Int::Rel::BoolVarXY::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x, Gecode::Reify r)
Post reified constraint on x for r.
Definition rel.cpp:148
Test::Int::Rel::Create
Help class to create and register tests.
Definition rel.cpp:572
Test::Int::Rel::Create::Create
Create(void)
Perform creation and registration.
Definition rel.cpp:575
Test::Int::Rel::IntArrayDiff
Test for relation between differently sized arrays of integer variables
Definition rel.cpp:468
Test::Int::Rel::IntArrayDiff::solution
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition rel.cpp:485
Test::Int::Rel::IntArrayDiff::n
static const int n
How many variables in total.
Definition rel.cpp:473
Test::Int::Rel::IntArrayDiff::IntArrayDiff
IntArrayDiff(Gecode::IntRelType irt0, int m)
Create and register test.
Definition rel.cpp:478
Test::Int::Rel::IntArrayDiff::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition rel.cpp:493
Test::Int::Rel::IntArrayDiff::irt
Gecode::IntRelType irt
Integer relation type to propagate.
Definition rel.cpp:471
Test::Int::Rel::IntArrayDiff::n_fst
int n_fst
How big is the first array.
Definition rel.cpp:475
Test::Int::Rel::IntArrayInt
Test for relation between same sized arrays of integer variables and integers
Definition rel.cpp:439
Test::Int::Rel::IntArrayInt::irt
Gecode::IntRelType irt
Integer relation type to propagate.
Definition rel.cpp:442
Test::Int::Rel::IntArrayInt::solution
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition rel.cpp:448
Test::Int::Rel::IntArrayInt::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition rel.cpp:460
Test::Int::Rel::IntArrayInt::IntArrayInt
IntArrayInt(Gecode::IntRelType irt0)
Create and register test.
Definition rel.cpp:445
Test::Int::Rel::IntArrayVar
Test for relation between same sized arrays of integer variables
Definition rel.cpp:407
Test::Int::Rel::IntArrayVar::irt
Gecode::IntRelType irt
Integer relation type to propagate.
Definition rel.cpp:410
Test::Int::Rel::IntArrayVar::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition rel.cpp:427
Test::Int::Rel::IntArrayVar::IntArrayVar
IntArrayVar(Gecode::IntRelType irt0)
Create and register test.
Definition rel.cpp:413
Test::Int::Rel::IntArrayVar::solution
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition rel.cpp:416
Test::Int::Rel::IntInt
Test for simple relation involving integer variable and integer constant
Definition rel.cpp:185
Test::Int::Rel::IntInt::irt
Gecode::IntRelType irt
Integer relation type to propagate.
Definition rel.cpp:188
Test::Int::Rel::IntInt::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x, Gecode::Reify r)
Post reified constraint on x for r.
Definition rel.cpp:213
Test::Int::Rel::IntInt::c
int c
Integer constant.
Definition rel.cpp:190
Test::Int::Rel::IntInt::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition rel.cpp:205
Test::Int::Rel::IntInt::solution
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition rel.cpp:198
Test::Int::Rel::IntInt::IntInt
IntInt(Gecode::IntRelType irt0, int n, int c0)
Create and register test.
Definition rel.cpp:193
Test::Int::Rel::IntSeq
Test for sequence of relations between integer variables
Definition rel.cpp:261
Test::Int::Rel::IntSeq::solution
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition rel.cpp:272
Test::Int::Rel::IntSeq::IntSeq
IntSeq(int n, Gecode::IntRelType irt0, Gecode::IntPropLevel ipl)
Create and register test.
Definition rel.cpp:267
Test::Int::Rel::IntSeq::irt
Gecode::IntRelType irt
Integer relation type to propagate.
Definition rel.cpp:264
Test::Int::Rel::IntSeq::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition rel.cpp:288
Test::Int::Rel::IntSharedSeq
Test for sequence of relations between shared integer variables
Definition rel.cpp:294
Test::Int::Rel::IntSharedSeq::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition rel.cpp:322
Test::Int::Rel::IntSharedSeq::irt
Gecode::IntRelType irt
Integer relation type to propagate.
Definition rel.cpp:297
Test::Int::Rel::IntSharedSeq::solution
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition rel.cpp:305
Test::Int::Rel::IntSharedSeq::IntSharedSeq
IntSharedSeq(int n, Gecode::IntRelType irt0, Gecode::IntPropLevel ipl)
Create and register test.
Definition rel.cpp:300
Test::Int::Rel::IntVarXX
Test for simple relation involving shared integer variables
Definition rel.cpp:87
Test::Int::Rel::IntVarXX::IntVarXX
IntVarXX(Gecode::IntRelType irt0, Gecode::IntPropLevel ipl)
Create and register test.
Definition rel.cpp:93
Test::Int::Rel::IntVarXX::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition rel.cpp:107
Test::Int::Rel::IntVarXX::irt
Gecode::IntRelType irt
Integer relation type to propagate.
Definition rel.cpp:90
Test::Int::Rel::IntVarXX::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x, Gecode::Reify r)
Post reified constraint on x for r.
Definition rel.cpp:111
Test::Int::Rel::IntVarXX::solution
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition rel.cpp:103
Test::Int::Rel::IntVarXY
Test for simple relation involving integer variables
Definition rel.cpp:49
Test::Int::Rel::IntVarXY::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition rel.cpp:68
Test::Int::Rel::IntVarXY::irt
Gecode::IntRelType irt
Integer relation type to propagate.
Definition rel.cpp:52
Test::Int::Rel::IntVarXY::IntVarXY
IntVarXY(Gecode::IntRelType irt0, int n, Gecode::IntPropLevel ipl)
Create and register test.
Definition rel.cpp:55
Test::Int::Rel::IntVarXY::solution
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition rel.cpp:60
Test::Int::Rel::IntVarXY::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x, Gecode::Reify r)
Post reified constraint on x for r.
Definition rel.cpp:79
Test::Int::Test::ipl
Gecode::IntPropLevel ipl
Propagation level.
Definition int.hh:234
Test::Int::Test::str
static std::string str(Gecode::IntPropLevel ipl)
Map integer propagation level to string.
Definition int.hpp:209
Test::Int::Test::cmp
static bool cmp(T x, Gecode::IntRelType r, T y)
Compare x and y with respect to r.
Definition int.hpp:285
Test::Int::Test::contest
ConTestLevel contest
Whether to test for certain consistency.
Definition int.hh:236
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::IntPropLevel
IntPropLevel
Propagation levels for integer propagators.
Definition int.hh:974
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
minimodel.hh
Gecode
Gecode toplevel namespace
Gecode::channel
void channel(Home home, FloatVar x0, IntVar x1)
Post propagator for channeling a float and an integer variable .
Definition channel.cpp:41
Test::Int::Rel
Tests for relation constraints
Definition rel.cpp:41
Test::Int::Rel::c
Create c
Definition rel.cpp:621
Test::Int
Testing finite domain integers.
Definition int.cpp:40
Test::Int::CTL_NONE
@ CTL_NONE
No consistency-test.
Definition int.hh:140
Test::Int::CTL_DOMAIN
@ CTL_DOMAIN
Test for domain-consistency.
Definition int.hh:141
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