| 1065 | } |
| 1066 | |
| 1067 | void p_global_cardinality_low_up(FlatZincSpace& s, const ConExpr& ce, |
| 1068 | AST::Node* ann) { |
| 1069 | IntVarArgs x = s.arg2intvarargs(ce[0]); |
| 1070 | IntArgs cover = s.arg2intargs(ce[1]); |
| 1071 | |
| 1072 | IntArgs lbound = s.arg2intargs(ce[2]); |
| 1073 | IntArgs ubound = s.arg2intargs(ce[3]); |
| 1074 | IntSetArgs y(cover.size()); |
| 1075 | for (int i=cover.size(); i--;) |
| 1076 | y[i] = IntSet(lbound[i],ubound[i]); |
| 1077 | |
| 1078 | IntSet cover_s(cover); |
| 1079 | Region re; |
| 1080 | IntVarRanges* xrs = re.alloc<IntVarRanges>(x.size()); |
| 1081 | for (int i=x.size(); i--;) |
| 1082 | xrs[i].init(x[i]); |
| 1083 | Iter::Ranges::NaryUnion u(re, xrs, x.size()); |
| 1084 | Iter::Ranges::ToValues<Iter::Ranges::NaryUnion> uv(u); |
| 1085 | for (; uv(); ++uv) { |
| 1086 | if (!cover_s.in(uv.val())) { |
| 1087 | cover << uv.val(); |
| 1088 | y << IntSet(0,x.size()); |
| 1089 | } |
| 1090 | } |
| 1091 | unshare(s, x); |
| 1092 | IntPropLevel ipl = s.ann2ipl(ann); |
| 1093 | if (ipl==IPL_DEF) |
| 1094 | ipl=IPL_BND; |
| 1095 | count(s, x, y, cover, ipl); |
| 1096 | } |
| 1097 | |
| 1098 | void p_global_cardinality_low_up_closed(FlatZincSpace& s, |
| 1099 | const ConExpr& ce, |
nothing calls this directly
no test coverage detected