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

Method propagate

gecode/set/rel-op/union.hpp:74–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72
73 template<class View0, class View1, class View2>
74 ExecStatus
75 Union<View0,View1,View2>::propagate(Space& home, const ModEventDelta& med) {
76 // This propagator implements the constraint
77 // x2 = x0 u x1
78
79 bool x0ass = x0.assigned();
80 bool x1ass = x1.assigned();
81 bool x2ass = x2.assigned();
82
83 ModEvent me0 = View0::me(med);
84 ModEvent me1 = View1::me(med);
85 ModEvent me2 = View2::me(med);
86
87 bool x0ubmod = false;
88 bool x1ubmod = false;
89 bool modified = false;
90
91 do {
92
93 modified = false;
94 do {
95 // 4) lub(x2) <= lub(x0) u lub(x1)
96 {
97 LubRanges<View0> x0ub(x0);
98 LubRanges<View1> x1ub(x1);
99 Iter::Ranges::Union<LubRanges<View0>, LubRanges<View1> > u2(x0ub,x1ub);
100 GECODE_ME_CHECK_MODIFIED(modified, x2.intersectI(home,u2) );
101 }
102
103 if (modified || Rel::testSetEventUB(me2) )
104 {
105 modified = false;
106 // 5) x0 <= x2
107 LubRanges<View2> x2ub1(x2);
108 GECODE_ME_CHECK_MODIFIED(modified, x0.intersectI(home,x2ub1) );
109 x0ubmod |= modified;
110
111 // 6) x1 <= x2
112 bool modified2=false;
113 LubRanges<View2> x2ub2(x2);
114 GECODE_ME_CHECK_MODIFIED(modified2, x1.intersectI(home,x2ub2) );
115 x1ubmod |= modified2;
116 modified |= modified2;
117 }
118
119 } while (modified);
120
121 modified = false;
122 do {
123 bool modifiedOld = modified;
124 modified = false;
125
126 if (Rel::testSetEventLB(me2) || Rel::testSetEventUB(me0)
127 || x0ubmod || modifiedOld)
128 {
129 // 1) glb(x0) \ lub(x1) <= glb(x2)
130 GlbRanges<View2> x2lb(x2);
131 LubRanges<View0> x0ub(x0);

Callers

nothing calls this directly

Calls 15

testSetEventUBFunction · 0.85
testSetEventLBFunction · 0.85
unionCardFunction · 0.85
testSetEventAnyBFunction · 0.85
testSetEventCardFunction · 0.85
unionNXiUBFunction · 0.85
partitionNYUBFunction · 0.85
partitionNXiLBFunction · 0.85
partitionNYLBFunction · 0.85
unionNCardFunction · 0.85
ES_SUBSUMEDMethod · 0.80
sharedFunction · 0.70

Tested by

no test coverage detected