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

Method post

test/int/cumulative.cpp:129–145  ·  view source on GitHub ↗

Post constraint on \a x

Source from the content-addressed store, hash-verified

127 }
128 /// Post constraint on \a x
129 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
130 int n = (c >= 0) ? x.size() : x.size()-1;
131 Gecode::IntVarArgs xx;
132 if (o==0) {
133 xx=x.slice(0,1,n);
134 } else {
135 xx=Gecode::IntVarArgs(n);
136 for (int i=n; i--;)
137 xx[i]=Gecode::expr(home,x[i]+o,Gecode::IPL_DOM);
138 }
139 if (c >= 0) {
140 Gecode::cumulative(home, c, xx, p, u, ipl);
141 } else {
142 Gecode::rel(home, x[n] <= -c);
143 Gecode::cumulative(home, x[n], xx, p, u, ipl);
144 }
145 }
146 };
147
148

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected