58 bool in(
int i,
int x)
const {
67 :
SetTest(
"Precede::Single::"+
str(s0)+
"<"+
str(t0),4,ds,false),
72 for (
int i = 0 ; i < n ; i++) {
73 if (!in(s,
x[i]) && in(t,
x[i]))
75 if (in(s,
x[i]) && !in(t,
x[i]))
94 bool in(
int i,
int x)
const {
102 :
SetTest(
"Precede::Multi::"+
str(c0),4,ds,false), c(c0) {}
105 for (
int j=0; j<c.size()-1; j++)
106 for (
int i=0; i<
x.size(); i++) {
107 if (!in(c[j],
x[i]) && in(c[j+1],
x[i]))
109 if (in(c[j],
x[i]) && !in(c[j+1],
x[i]))
Passing integer arguments.
Range iterator for singleton range.
Range iterator producing subsets of an IntSet.
Test for multiple value precedence constraint
Multi(const Gecode::IntArgs &c0)
Create and register test.
virtual void post(Gecode::Space &home, Gecode::SetVarArray &x, Gecode::IntVarArray &)
Post constraint on x.
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
Test for single value precedence constraint
Single(int s0, int t0)
Create and register test.
virtual void post(Gecode::Space &home, Gecode::SetVarArray &x, Gecode::IntVarArray &)
Post constraint on x.
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
Generate all set assignments.
static std::string str(Gecode::SetRelType srt)
Map set relation to string.
SetTest(const std::string &s, int a, const Gecode::IntSet &d, bool r=false, int w=0)
Constructor.
void precede(Home home, const IntVarArgs &x, int s, int t, IntPropLevel=IPL_DEF)
Post propagator that s precedes t in x.
bool subset(I &i, J &j)
Check whether range iterator i is subset of range iterator j.
Gecode toplevel namespace
Post propagator for SetVar x
Tests for value precedence constraints
Multi _c(Gecode::IntArgs({1, 2, 3}))
Multi _e(Gecode::IntArgs({4, 2, 3, 1}))
Multi _d(Gecode::IntArgs({3, 2, 1}))