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

Method propagate

gecode/set/rel/re-subset.hpp:102–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100
101 template<class View0, class View1, class CtrlView, ReifyMode rm>
102 ExecStatus
103 ReSubset<View0,View1,CtrlView,rm>::propagate(Space& home,
104 const ModEventDelta&) {
105 if (b.one()) {
106 if (rm == RM_PMI)
107 return home.ES_SUBSUMED(*this);
108 GECODE_REWRITE(*this,(Subset<View0,View1>::post(home(*this),x0,x1)));
109 }
110 if (b.zero()) {
111 if (rm == RM_IMP)
112 return home.ES_SUBSUMED(*this);
113 GECODE_REWRITE(*this,(NoSubset<View0,View1>::post(home(*this),x0,x1)));
114 }
115
116 // check whether cardinalities still allow subset
117 if (x0.cardMin() > x1.cardMax()) {
118 if (rm != RM_PMI)
119 GECODE_ME_CHECK(b.zero_none(home));
120 return home.ES_SUBSUMED(*this);
121 }
122
123 // check lub(x0) subset glb(x1)
124 {
125 LubRanges<View0> x0ub(x0);
126 GlbRanges<View1> x1lb(x1);
127 Iter::Ranges::Diff<LubRanges<View0>,GlbRanges<View1> > d(x0ub,x1lb);
128 if (!d()) {
129 if (rm != RM_IMP)
130 GECODE_ME_CHECK(b.one_none(home));
131 return home.ES_SUBSUMED(*this);
132 }
133 }
134
135 // check glb(x0) subset lub(x1)
136 {
137 GlbRanges<View0> x0lb(x0);
138 LubRanges<View1> x1ub(x1);
139 Iter::Ranges::Diff<GlbRanges<View0>,LubRanges<View1> > d(x0lb,x1ub);
140 if (d()) {
141 if (rm != RM_PMI)
142 GECODE_ME_CHECK(b.zero_none(home));
143 return home.ES_SUBSUMED(*this);
144 } else if (x0.assigned() && x1.assigned()) {
145 if (rm != RM_IMP)
146 GECODE_ME_CHECK(b.one_none(home));
147 return home.ES_SUBSUMED(*this);
148 }
149 }
150
151 if (x0.cardMin() > 0) {
152 LubRanges<View0> x0ub(x0);
153 LubRanges<View1> x1ub(x1);
154 Iter::Ranges::Inter<LubRanges<View0>,LubRanges<View1> >
155 i(x0ub,x1ub);
156 if (!i()) {
157 if (rm != RM_PMI)
158 GECODE_ME_CHECK(b.zero_none(home));
159 return home.ES_SUBSUMED(*this);

Callers

nothing calls this directly

Calls 11

ES_SUBSUMEDMethod · 0.80
postFunction · 0.50
dFunction · 0.50
iFunction · 0.50
oneMethod · 0.45
zeroMethod · 0.45
cardMinMethod · 0.45
cardMaxMethod · 0.45
zero_noneMethod · 0.45
one_noneMethod · 0.45
assignedMethod · 0.45

Tested by

no test coverage detected