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

Function prop_dom

gecode/int/channel/dom.hpp:127–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125 // Propagate domain information from x to y
126 template<class View, class Offset>
127 ExecStatus
128 prop_dom(Space& home, int n, DomInfo<View,Offset>* x, Offset& ox,
129 DomInfo<View,Offset>* y, Offset& oy, ProcessStack& ya) {
130 for (int i=0; i<n; i++)
131 // Only views with not yet propagated missing values
132 if (x[i].dodom()) {
133 // Iterate the values in the complement of x[i]
134 ViewRanges<typename Offset::ViewType>
135 xir(ox(x[i].view));
136 Iter::Ranges::ComplVal<ViewRanges<typename Offset::ViewType> >
137 xirc(x[i].min,x[i].max,xir);
138 Iter::Ranges::ToValues<Iter::Ranges::ComplVal<
139 ViewRanges<typename Offset::ViewType> > > jv(xirc);
140 while (jv()) {
141 // j is not in the domain of x[i], so prune i from y[j]
142 int j = jv.val();
143 ModEvent me = oy(y[j].view).nq(home,i);
144 if (me_failed(me))
145 return ES_FAILED;
146 if (me_modified(me)) {
147 if (me == ME_INT_VAL) {
148 // Record that y[j] has been assigned and must be propagated
149 ya.push(j);
150 } else {
151 // Obvious as x[i] is different from j
152 y[j].removed(i);
153 }
154 }
155 ++jv;
156 }
157 // Update which values have been propagated and what are the new bounds
158 x[i].done(ox);
159 }
160 return ES_OK;
161 }
162
163 /*
164 * The actual propagator

Callers 1

propagateMethod · 0.85

Calls 8

me_failedFunction · 0.85
me_modifiedFunction · 0.85
dodomMethod · 0.45
valMethod · 0.45
nqMethod · 0.45
pushMethod · 0.45
removedMethod · 0.45
doneMethod · 0.45

Tested by

no test coverage detected