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

Method post

test/int/unary.cpp:173–186  ·  view source on GitHub ↗

Post constraint on \a x

Source from the content-addressed store, hash-verified

171 }
172 /// Post constraint on \a x
173 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
174 Gecode::IntVarArgs s(x.size()/2);
175 Gecode::IntVarArgs px(x.slice(x.size()/2));
176 Gecode::IntVarArgs e(home,x.size()/2,
177 Gecode::Int::Limits::min,
178 Gecode::Int::Limits::max);
179 for (int i=s.size(); i--;) {
180 s[i] = expr(home, off+x[i]);
181 rel(home, s[i]+px[i] == e[i]);
182 rel(home, _minP <= px[i]);
183 rel(home, _maxP >= px[i]);
184 }
185 Gecode::unary(home, s, px, e, ipl);
186 }
187 };
188
189 /// %Test for unary constraint with optional tasks

Callers

nothing calls this directly

Calls 5

unaryFunction · 0.85
exprFunction · 0.50
relFunction · 0.50
sizeMethod · 0.45
sliceMethod · 0.45

Tested by

no test coverage detected