MCPcopy Create free account
hub / github.com/Gecode/gecode / post

Method post

test/set/mm-set.cpp:152–171  ·  view source on GitHub ↗

Post constraint on \a x

Source from the content-addressed store, hash-verified

150 }
151 /// Post constraint on \a x
152 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
153 using namespace Gecode;
154 SetVarArgs s(home,4,IntSet::empty,1,1);
155 Gecode::rel(home, (singleton(1) == s[0]) == (x[0] != x[2]));
156 Gecode::rel(home, (singleton(1) == s[1]) == (x[1] == 1));
157 Gecode::rel(home, (singleton(1) == s[2]) == (x[2] > 0));
158 Gecode::rel(home, (singleton(1) == s[3]) == (x[3] == 1));
159 Gecode::SetExpr reg[4] = {s[0],s[1],s[2],s[3]};
160 Gecode::SetExpr res = (c==0) ? IntSet::empty : singleton(1);
161 Gecode::SetExpr e = eval(bis,reg);
162 switch (srt) {
163 case Gecode::SRT_EQ: Gecode::rel(home, e == res); break;
164 case Gecode::SRT_NQ: Gecode::rel(home, e != res); break;
165 case Gecode::SRT_SUB: Gecode::rel(home, e <= res); break;
166 case Gecode::SRT_SUP: Gecode::rel(home, e >= res); break;
167 case Gecode::SRT_DISJ: Gecode::rel(home, e || res); break;
168 case Gecode::SRT_CMPL: Gecode::rel(home, e == -res); break;
169 default: GECODE_NEVER;
170 }
171 }
172 /// Post reified constraint on \a x
173 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x,
174 Gecode::Reify r) {

Callers

nothing calls this directly

Calls 5

evalFunction · 0.70
relFunction · 0.50
singletonFunction · 0.50
modeMethod · 0.45
varMethod · 0.45

Tested by

no test coverage detected