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

Function p_set_in

gecode/flatzinc/registry.cpp:1931–1955  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1929 }
1930 }
1931 void p_set_in(FlatZincSpace& s, const ConExpr& ce, AST::Node *) {
1932 if (!ce[1]->isSetVar()) {
1933 IntSet d = s.arg2intset(ce[1]);
1934 if (ce[0]->isBoolVar()) {
1935 IntSetRanges dr(d);
1936 Iter::Ranges::Singleton sr(0,1);
1937 Iter::Ranges::Inter<IntSetRanges,Iter::Ranges::Singleton> i(dr,sr);
1938 IntSet d01(i);
1939 if (d01.size() == 0) {
1940 s.fail();
1941 } else {
1942 rel(s, s.arg2BoolVar(ce[0]), IRT_GQ, d01.min());
1943 rel(s, s.arg2BoolVar(ce[0]), IRT_LQ, d01.max());
1944 }
1945 } else {
1946 dom(s, s.arg2IntVar(ce[0]), d);
1947 }
1948 } else {
1949 if (!ce[0]->isIntVar()) {
1950 dom(s, s.arg2SetVar(ce[1]), SRT_SUP, ce[0]->getInt());
1951 } else {
1952 rel(s, s.arg2SetVar(ce[1]), SRT_SUP, s.arg2IntVar(ce[0]));
1953 }
1954 }
1955 }
1956 void p_set_rel_reif(FlatZincSpace& s, SetRelType srt, const ConExpr& ce) {
1957 rel(s, s.arg2SetVar(ce[0]), srt, s.arg2SetVar(ce[1]),
1958 s.arg2BoolVar(ce[2]));

Callers

nothing calls this directly

Calls 14

isSetVarMethod · 0.80
arg2intsetMethod · 0.80
isBoolVarMethod · 0.80
arg2BoolVarMethod · 0.80
arg2IntVarMethod · 0.80
isIntVarMethod · 0.80
arg2SetVarMethod · 0.80
getIntMethod · 0.80
relFunction · 0.50
domFunction · 0.50
sizeMethod · 0.45
failMethod · 0.45

Tested by

no test coverage detected