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

Method commit

examples/bin-packing.cpp:343–361  ·  view source on GitHub ↗

Perform commit for choice \a _c and alternative \a a

Source from the content-addressed store, hash-verified

341 }
342 /// Perform commit for choice \a _c and alternative \a a
343 virtual ExecStatus commit(Space& home, const Gecode::Choice& _c,
344 unsigned int a) {
345 const Choice& c = static_cast<const Choice&>(_c);
346 // This catches also the case that the choice has a single aternative only
347 if (a == 0) {
348 GECODE_ME_CHECK(bin[c.item].eq(home, c.same[0]));
349 } else {
350 Iter::Values::Array same(c.same, c.n_same);
351
352 GECODE_ME_CHECK(bin[c.item].minus_v(home, same));
353
354 for (int i = c.item+1; (i<bin.size()) &&
355 (size[i] == size[c.item]); i++) {
356 same.reset();
357 GECODE_ME_CHECK(bin[i].minus_v(home, same));
358 }
359 }
360 return ES_OK;
361 }
362 /// Print explanation
363 virtual void print(const Space&, const Gecode::Choice& _c,
364 unsigned int a,

Callers

nothing calls this directly

Calls 4

eqMethod · 0.45
minus_vMethod · 0.45
sizeMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected