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

Function p_int_in_reif

gecode/flatzinc/registry.cpp:860–879  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

858 }
859 }
860 void p_int_in_reif(FlatZincSpace& s, const ConExpr& ce, AST::Node *) {
861 IntSet d = s.arg2intset(ce[1]);
862 if (ce[0]->isBoolVar()) {
863 IntSetRanges dr(d);
864 Iter::Ranges::Singleton sr(0,1);
865 Iter::Ranges::Inter<IntSetRanges,Iter::Ranges::Singleton> i(dr,sr);
866 IntSet d01(i);
867 if (d01.size() == 0) {
868 rel(s, s.arg2BoolVar(ce[2]) == 0);
869 } else if (d01.max() == 0) {
870 rel(s, s.arg2BoolVar(ce[2]) == !s.arg2BoolVar(ce[0]));
871 } else if (d01.min() == 1) {
872 rel(s, s.arg2BoolVar(ce[2]) == s.arg2BoolVar(ce[0]));
873 } else {
874 rel(s, s.arg2BoolVar(ce[2]) == 1);
875 }
876 } else {
877 dom(s, s.arg2IntVar(ce[0]), d, s.arg2BoolVar(ce[2]));
878 }
879 }
880 void p_int_in_imp(FlatZincSpace& s, const ConExpr& ce, AST::Node *) {
881 IntSet d = s.arg2intset(ce[1]);
882 if (ce[0]->isBoolVar()) {

Callers 1

p_set_in_reifFunction · 0.85

Calls 9

arg2intsetMethod · 0.80
isBoolVarMethod · 0.80
arg2BoolVarMethod · 0.80
arg2IntVarMethod · 0.80
relFunction · 0.50
domFunction · 0.50
sizeMethod · 0.45
maxMethod · 0.45
minMethod · 0.45

Tested by

no test coverage detected