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

Method propagate

gecode/int/linear/bool-view.hpp:134–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

132
133 template<class XV, class YV>
134 ExecStatus
135 EqBoolView<XV,YV>::propagate(Space& home, const ModEventDelta&) {
136 int n = x.size();
137 for (int i=n; i--; )
138 if (x[i].one()) {
139 x[i]=x[--n]; c--;
140 } else if (x[i].zero()) {
141 x[i]=x[--n];
142 }
143 x.size(n);
144 GECODE_ME_CHECK(y.lq(home,n-c));
145 GECODE_ME_CHECK(y.gq(home,-c));
146 if (n == 0)
147 return home.ES_SUBSUMED(*this);
148 if (y.min()+c == n) {
149 assert(y.assigned());
150 for (int i=0; i<n; i++)
151 GECODE_ME_CHECK(x[i].one_none(home));
152 return home.ES_SUBSUMED(*this);
153 }
154 if (y.max()+c == 0) {
155 assert(y.assigned());
156 for (int i=0; i<n; i++)
157 GECODE_ME_CHECK(x[i].zero_none(home));
158 return home.ES_SUBSUMED(*this);
159 }
160 if (y.assigned())
161 GECODE_REWRITE(*this,EqBoolInt<XV>::post(home(*this),x,y.val()+c));
162 return ES_FIX;
163 }
164
165
166 /*

Callers

nothing calls this directly

Calls 14

ES_SUBSUMEDMethod · 0.80
postFunction · 0.70
sizeMethod · 0.45
oneMethod · 0.45
zeroMethod · 0.45
lqMethod · 0.45
gqMethod · 0.45
minMethod · 0.45
assignedMethod · 0.45
one_noneMethod · 0.45
maxMethod · 0.45
zero_noneMethod · 0.45

Tested by

no test coverage detected