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

Method propagate

gecode/int/nvalues/bool-eq.hpp:117–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115
116 template<class VY>
117 ExecStatus
118 EqBool<VY>::propagate(Space& home, const ModEventDelta&) {
119 if (status == (VS_ZERO | VS_ONE)) {
120 GECODE_ME_CHECK(y.eq(home,2));
121 return home.ES_SUBSUMED(*this);
122 }
123
124 if (c.empty()) {
125 assert(status != 0);
126 GECODE_ME_CHECK(y.eq(home,1));
127 return home.ES_SUBSUMED(*this);
128 }
129
130 if (y.max() == 1) {
131 if (status == VS_ZERO) {
132 // Mark that everything is done
133 status = VS_ZERO | VS_ONE;
134 for (Advisors<ViewAdvisor<BoolView> > as(c); as(); ++as)
135 GECODE_ME_CHECK(as.advisor().view().zero(home));
136 return home.ES_SUBSUMED(*this);
137 }
138 if (status == VS_ONE) {
139 // Mark that everything is done
140 status = VS_ZERO | VS_ONE;
141 for (Advisors<ViewAdvisor<BoolView> > as(c); as(); ++as)
142 GECODE_ME_CHECK(as.advisor().view().one(home));
143 return home.ES_SUBSUMED(*this);
144 }
145 }
146
147 if (y.min() == 2) {
148 Advisors<ViewAdvisor<BoolView> > as(c);
149 assert(as());
150 ViewAdvisor<BoolView>& a(as.advisor());
151 ++as;
152 if (!as()) {
153 // Only a single view is left
154 if (status == VS_ZERO) {
155 GECODE_ME_CHECK(a.view().one(home));
156 } else if (status == VS_ONE) {
157 GECODE_ME_CHECK(a.view().zero(home));
158 } else {
159 return ES_FAILED;
160 }
161 return home.ES_SUBSUMED(*this);
162 }
163 }
164
165 return ES_FIX;
166 }
167
168}}}
169

Callers

nothing calls this directly

Calls 9

aFunction · 0.85
ES_SUBSUMEDMethod · 0.80
eqMethod · 0.45
emptyMethod · 0.45
maxMethod · 0.45
zeroMethod · 0.45
viewMethod · 0.45
oneMethod · 0.45
minMethod · 0.45

Tested by

no test coverage detected