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

Method propagate

gecode/int/arithmetic/mult.cpp:47–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45 }
46
47 ExecStatus
48 MultBnd::propagate(Space& home, const ModEventDelta&) {
49 if (pos(x0)) {
50 if (pos(x1) || pos(x2)) goto rewrite_ppp;
51 if (neg(x1) || neg(x2)) goto rewrite_pnn;
52 goto prop_pxx;
53 }
54 if (neg(x0)) {
55 if (neg(x1) || pos(x2)) goto rewrite_nnp;
56 if (pos(x1) || neg(x2)) goto rewrite_npn;
57 goto prop_nxx;
58 }
59 if (pos(x1)) {
60 if (pos(x2)) goto rewrite_ppp;
61 if (neg(x2)) goto rewrite_npn;
62 goto prop_xpx;
63 }
64 if (neg(x1)) {
65 if (pos(x2)) goto rewrite_nnp;
66 if (neg(x2)) goto rewrite_pnn;
67 goto prop_xnx;
68 }
69
70 assert(any(x0) && any(x1));
71 GECODE_ME_CHECK(x2.lq(home,std::max(mll(x0.max(),x1.max()),
72 mll(x0.min(),x1.min()))));
73 GECODE_ME_CHECK(x2.gq(home,std::min(mll(x0.min(),x1.max()),
74 mll(x0.max(),x1.min()))));
75
76 if (x0.assigned()) {
77 assert((x0.val() == 0) && (x2.val() == 0));
78 return home.ES_SUBSUMED(*this);
79 }
80
81 if (x1.assigned()) {
82 assert((x1.val() == 0) && (x2.val() == 0));
83 return home.ES_SUBSUMED(*this);
84 }
85
86 return ES_NOFIX;
87
88 prop_xpx:
89 std::swap(x0,x1);
90 prop_pxx:
91 assert(pos(x0) && any(x1) && any(x2));
92
93 GECODE_ME_CHECK(x2.lq(home,mll(x0.max(),x1.max())));
94 GECODE_ME_CHECK(x2.gq(home,mll(x0.max(),x1.min())));
95
96 if (pos(x2)) goto rewrite_ppp;
97 if (neg(x2)) goto rewrite_pnn;
98
99 GECODE_ME_CHECK(x1.lq(home,floor_div_xp(x2.max(),x0.min())));
100 GECODE_ME_CHECK(x1.gq(home,ceil_div_xp(x2.min(),x0.min())));
101
102 if (x0.assigned() && x1.assigned()) {
103 GECODE_ME_CHECK(x2.eq(home,mll(x0.val(),x1.val())));
104 return home.ES_SUBSUMED(*this);

Callers

nothing calls this directly

Calls 15

mllFunction · 0.85
floor_div_xpFunction · 0.85
ceil_div_xpFunction · 0.85
floor_div_xxFunction · 0.85
ceil_div_xxFunction · 0.85
ES_SUBSUMEDMethod · 0.80
ES_NOFIX_PARTIALMethod · 0.80
posFunction · 0.70
negFunction · 0.70
anyFunction · 0.70
maxFunction · 0.50
minFunction · 0.50

Tested by

no test coverage detected