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

Method post

test/int/mm-lin.cpp:398–424  ·  view source on GitHub ↗

Post constraint on \a x

Source from the content-addressed store, hash-verified

396 }
397 /// Post constraint on \a x
398 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
399 using namespace Gecode;
400 Gecode::LinIntExpr l_reg[3] = {channel(home,x[0]),x[1],x[2]};
401 Gecode::LinIntExpr r_reg[3] = {channel(home,x[3]),x[4],
402 channel(home,x[5])};
403 switch (irt) {
404 case IRT_EQ:
405 Gecode::rel(home, 0 == eval(l_lis,l_reg) - eval(r_lis,r_reg));
406 break;
407 case IRT_NQ:
408 Gecode::rel(home, eval(l_lis,l_reg) - eval(r_lis,r_reg) != 0);
409 break;
410 case IRT_LQ:
411 Gecode::rel(home, !(eval(l_lis,l_reg) > eval(r_lis,r_reg)));
412 break;
413 case IRT_LE:
414 Gecode::rel(home, eval(l_lis,l_reg) < eval(r_lis,r_reg));
415 break;
416 case IRT_GQ:
417 Gecode::rel(home, eval(l_lis,l_reg) >= eval(r_lis,r_reg));
418 break;
419 case IRT_GR:
420 Gecode::rel(home, !(eval(l_lis,l_reg) <= eval(r_lis,r_reg)));
421 break;
422 default: GECODE_NEVER;
423 }
424 }
425 /// Post constraint on \a x for \a r
426 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x,
427 Gecode::Reify r) {

Callers

nothing calls this directly

Calls 6

evalFunction · 0.70
channelFunction · 0.50
relFunction · 0.50
exprFunction · 0.50
modeMethod · 0.45
varMethod · 0.45

Tested by

no test coverage detected