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

Method propagate

gecode/set/rel-op/partition.hpp:106–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104
105 template<class View0, class View1>
106 ExecStatus
107 PartitionN<View0,View1>::propagate(Space& home, const ModEventDelta& med) {
108
109 ModEvent me0 = View0::me(med);
110 ModEvent me1 = View1::me(med);
111 bool ubevent = Rel::testSetEventUB(me0, me1);
112 bool lbevent = Rel::testSetEventLB(me0, me1);
113 bool anybevent = Rel::testSetEventAnyB(me0, me1);
114 bool cardevent = Rel::testSetEventCard(me0, me1);
115
116 bool modified = false;
117 bool oldModified = false;
118
119 do {
120 oldModified = modified;
121 modified = false;
122 if (oldModified || anybevent)
123 GECODE_ES_CHECK(partitionNXiUB(home,modified, x, y,unionOfDets));
124 if (modified || oldModified || anybevent)
125 GECODE_ES_CHECK(partitionNXiLB(home,modified, x, y,unionOfDets));
126 if (modified || oldModified || ubevent)
127 GECODE_ES_CHECK(partitionNYUB(home,modified, x, y,unionOfDets));
128 if (modified || oldModified || lbevent)
129 GECODE_ES_CHECK(partitionNYLB(home,modified, x, y,unionOfDets));
130 if (modified || oldModified || ubevent)
131 GECODE_ES_CHECK(unionNXiUB(home,modified, x, y,unionOfDets));
132 if (modified || oldModified || cardevent)
133 GECODE_ES_CHECK(partitionNCard(home,modified, x, y,unionOfDets));
134 } while (modified);
135
136 //removing assigned sets from x, accumulating the value:
137 for(int i=0;i<x.size();i++) {
138 //Do not reverse! Eats away the end of the array!
139 while (i<x.size() && x[i].assigned()) {
140 GlbRanges<View0> det(x[i]);
141 unionOfDets.includeI(home,det);
142 x.move_lst(i);
143 }
144 }
145 // When we run out of variables, make a final check and dissolve:
146 if (x.size()==0) {
147 BndSetRanges all1(unionOfDets);
148 GECODE_ME_CHECK( y.intersectI(home,all1) );
149 BndSetRanges all2(unionOfDets);
150 GECODE_ME_CHECK( y.includeI(home,all2) );
151 unionOfDets.dispose(home);
152 return home.ES_SUBSUMED(*this);
153 }
154
155 return shared ? ES_NOFIX : ES_FIX;
156 }
157
158}}}
159

Callers

nothing calls this directly

Calls 15

testSetEventUBFunction · 0.85
testSetEventLBFunction · 0.85
testSetEventAnyBFunction · 0.85
testSetEventCardFunction · 0.85
partitionNXiUBFunction · 0.85
partitionNXiLBFunction · 0.85
partitionNYUBFunction · 0.85
partitionNYLBFunction · 0.85
unionNXiUBFunction · 0.85
partitionNCardFunction · 0.85
ES_SUBSUMEDMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected