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

Method propagate

gecode/int/member/prop.hpp:132–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130
131 template<class View>
132 ExecStatus
133 Prop<View>::propagate(Space& home, const ModEventDelta& med) {
134 // Add assigned views to value set
135 if (View::me(med) == ME_INT_VAL)
136 add(home,vs,x);
137
138 // Eliminate views from x
139 eliminate(home);
140
141 if (x.size() == 0) {
142 // y must have values in the value set
143 ValSet::Ranges vsr(vs);
144 GECODE_ME_CHECK(y.inter_r(home,vsr,false));
145 return home.ES_SUBSUMED(*this);
146 }
147
148 // Constrain y to union of x and value set
149 Region r;
150
151 assert(x.size() > 0);
152 ValSet::Ranges vsr(vs);
153 ViewRanges<View> xsr(x[0]);
154 Iter::Ranges::NaryUnion u(r,vsr,xsr);
155 for (int i=1; i<x.size(); i++) {
156 ViewRanges<View> xir(x[i]);
157 u |= xir;
158 }
159
160 GECODE_ME_CHECK(y.inter_r(home,u,false));
161
162 // Check whether all values in y are already in the value set
163 if (vs.subset(y))
164 return home.ES_SUBSUMED(*this);
165
166 return ES_FIX;
167 }
168
169}}}
170

Callers

nothing calls this directly

Calls 6

addFunction · 0.85
ES_SUBSUMEDMethod · 0.80
subsetMethod · 0.80
eliminateFunction · 0.50
sizeMethod · 0.45
inter_rMethod · 0.45

Tested by

no test coverage detected