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

Method post

test/int/cumulative.cpp:237–254  ·  view source on GitHub ↗

Post constraint on \a x

Source from the content-addressed store, hash-verified

235 }
236 /// Post constraint on \a x
237 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
238 int nn=(c >= 0) ? x.size() : x.size()-1;
239 int n=nn / 2;
240 Gecode::IntVarArgs s(n);
241 Gecode::BoolVarArgs m(n);
242
243 for (int i=0; i<n; i++) {
244 s[i]=(c >= 0) ? x[i] : Gecode::expr(home,x[i]+o,Gecode::IPL_DOM);
245 m[i]=Gecode::expr(home, x[n+i] > l);
246 }
247
248 if (c >= 0) {
249 Gecode::cumulative(home, c, s, p, u, m, ipl);
250 } else {
251 Gecode::rel(home, x[nn] <= -c);
252 Gecode::cumulative(home, x[nn], s, p, u, m, ipl);
253 }
254 }
255 };
256
257 /// Test for cumulative constraint with flexible mandatory tasks

Callers

nothing calls this directly

Calls 4

cumulativeFunction · 0.85
exprFunction · 0.50
relFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected