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

Method propagate

gecode/set/rel-op/inter.hpp:61–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59
60 template<class View0, class View1, class View2>
61 ExecStatus
62 Intersection<View0,View1,View2>::propagate(Space& home, const ModEventDelta& med) {
63 // This propagator implements the constraint
64 // x2 = x0 \cap x1
65
66 bool x0ass = x0.assigned();
67 bool x1ass = x1.assigned();
68 bool x2ass = x2.assigned();
69
70 ModEvent me0 = View0::me(med);
71 ModEvent me1 = View1::me(med);
72 ModEvent me2 = View2::me(med);
73
74 bool x0lbmod = false;
75 bool x1lbmod = false;
76 bool modified = false;
77
78 do {
79
80 modified = false;
81 do {
82 // 4) glb(x2) <= glb(x0) \cap glb(x1)
83 {
84 GlbRanges<View0> x0lb(x0);
85 GlbRanges<View1> x1lb(x1);
86 Iter::Ranges::Inter<GlbRanges<View0>, GlbRanges<View1> >
87 i2(x0lb,x1lb);
88 GECODE_ME_CHECK_MODIFIED(modified, x2.includeI(home,i2) );
89 }
90
91 if (modified || Rel::testSetEventLB(me2) )
92 {
93 modified = false;
94 // 5) x2 <= x0
95 GlbRanges<View2> x2lb1(x2);
96 GECODE_ME_CHECK_MODIFIED(modified, x0.includeI(home,x2lb1) );
97 x0lbmod |= modified;
98
99 // 6) x2 <= x1
100 bool modified2=false;
101 GlbRanges<View2> x2lb2(x2);
102 GECODE_ME_CHECK_MODIFIED(modified2, x1.includeI(home,x2lb2) );
103 x1lbmod |= modified2;
104 modified |= modified2;
105 }
106
107 } while (modified);
108
109 modified = false;
110 do {
111 bool modifiedOld = modified;
112 modified = false;
113
114 if (Rel::testSetEventUB(me2) || Rel::testSetEventLB(me0)
115 || x0lbmod || modifiedOld)
116 {
117 // 1) lub(x2) \ glb(x0) => lub(x1)
118 GlbRanges<View0> x0lb(x0);

Callers

nothing calls this directly

Calls 15

testSetEventLBFunction · 0.85
testSetEventUBFunction · 0.85
interCardFunction · 0.85
ES_SUBSUMEDMethod · 0.80
sharedFunction · 0.70
postFunction · 0.50
assignedMethod · 0.45
includeIMethod · 0.45
excludeIMethod · 0.45
intersectIMethod · 0.45
cardMinMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected