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

Method post

test/int/circuit.cpp:178–195  ·  view source on GitHub ↗

Post circuit constraint on \a x

Source from the content-addressed store, hash-verified

176 }
177 /// Post circuit constraint on \a x
178 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
179 using namespace Gecode;
180 int n=x.size()-1;
181 IntArgs c(n*n);
182 for (int i=0; i<n; i++)
183 for (int j=0; j<n; j++)
184 c[i*n+j]=j;
185 IntVarArgs y(n);
186 if (offset > 0) {
187 for (int i=n; i--;)
188 y[i] = Gecode::expr(home, x[i]+offset);
189 Gecode::circuit(home, c, offset, y, x[n], ipl);
190 } else {
191 for (int i=0; i<n; i++)
192 y[i]=x[i];
193 circuit(home, c, y, x[n], ipl);
194 }
195 }
196 };
197
198 /// Simple test for path constraint with total cost

Callers

nothing calls this directly

Calls 3

circuitFunction · 0.85
exprFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected