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

Method commit

gecode/int/ldsb/brancher.hpp:230–262  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

228 template<class View, int n, class Val, unsigned int a,
229 class Filter, class Print>
230 ExecStatus
231 LDSBBrancher<View,n,Val,a,Filter,Print>
232 ::commit(Space& home, const Choice& c, unsigned int b) {
233 const LDSBChoice<Val>& pvc
234 = static_cast<const LDSBChoice<Val>&>(c);
235 int choicePos = pvc.pos().pos;
236 int choiceVal = pvc.val();
237
238 if (b == 0) {
239 // Post the branching constraint.
240 ExecStatus fromBase = ViewValBrancher<View,n,Val,a,Filter,Print>
241 ::commit(home, c, b);
242 GECODE_ES_CHECK(fromBase);
243 for (int i = 0 ; i < this->_nsyms ; i++)
244 this->_syms[i]->update(Literal(choicePos, choiceVal));
245 } else if (b == 1) {
246 // Post the branching constraint.
247 ExecStatus fromBase = ViewValBrancher<View,n,Val,a,Filter,Print>
248 ::commit(home, c, b);
249 GECODE_ES_CHECK(fromBase);
250
251 // Post prunings.
252 int nliterals = pvc.nliterals();
253 const Literal* literals = pvc.literals();
254 for (int i = 0 ; i < nliterals ; i++) {
255 const Literal& l = literals[i];
256 ModEvent me = prune<View>(home, this->x[l._variable], l._value);
257 GECODE_ME_CHECK(me);
258 }
259 }
260
261 return ES_OK;
262 }
263
264 template<class View, int n, class Val, unsigned int a,
265 class Filter, class Print>

Callers

nothing calls this directly

Calls 6

LiteralClass · 0.85
nliteralsMethod · 0.80
literalsMethod · 0.80
posMethod · 0.45
valMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected