MCPcopy Create free account
hub / github.com/Gecode/gecode / ExecStatus resubscribe

Function ExecStatus resubscribe

gecode/int/bool/clause.hpp:137–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

135
136 template<class VX, class VY>
137 forceinline ExecStatus
138 resubscribe(Space& home, Propagator& p,
139 VX& x0, ViewArray<VX>& x,
140 VY& x1, ViewArray<VY>& y) {
141 if (x0.zero()) {
142 int n = x.size();
143 for (int i=n; i--; )
144 if (x[i].one()) {
145 x.size(n);
146 return home.ES_SUBSUMED(p);
147 } else if (x[i].zero()) {
148 x[i] = x[--n];
149 } else {
150 // Rewrite if there is just one view left
151 if ((i == 0) && (y.size() == 0)) {
152 VX z = x[0]; x.size(0);
153 GECODE_REWRITE(p,(BinOrTrue<VX,VY>::post(home(p),z,x1)));
154 }
155 // Move to x0 and subscribe
156 x0=x[i]; x[i]=x[--n];
157 x.size(n);
158 x0.subscribe(home,p,PC_BOOL_VAL,false);
159 return ES_FIX;
160 }
161 // All x-views have been assigned!
162 ViewArray<VY> z(home,y.size()+1);
163 for (int i=0; i<y.size(); i++)
164 z[i]=y[i];
165 z[y.size()] = x1;
166 GECODE_REWRITE(p,(NaryOrTrue<VY>::post(home(p),z)));
167 }
168 return ES_FIX;
169 }
170
171 template<class VX, class VY>
172 ExecStatus

Callers

nothing calls this directly

Calls 6

ES_SUBSUMEDMethod · 0.80
postFunction · 0.50
zeroMethod · 0.45
sizeMethod · 0.45
oneMethod · 0.45
subscribeMethod · 0.45

Tested by

no test coverage detected