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

Method propagate

gecode/float/arithmetic/pow-nroot.hpp:94–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92
93 template<class A, class B>
94 ExecStatus
95 Pow<A,B>::propagate(Space& home, const ModEventDelta&) {
96 if ((x0.min() == 0.0) && (x0.max() == 0.0)) return ES_FAILED;
97 GECODE_ME_CHECK(x1.eq(home,pow(x0.domain(),m_n)));
98
99 if ((x1.min() == 0.0) && (x1.max() == 0.0)) {
100 GECODE_ME_CHECK(x1.eq(home,0.0));
101 return home.ES_SUBSUMED(*this);
102 }
103
104 if ((m_n % 2) == 0) {
105 if (x0.min() >= 0)
106 GECODE_ME_CHECK(x0.eq(home,nroot(x1.domain(),m_n)));
107 else if (x0.max() <= 0)
108 GECODE_ME_CHECK(x0.eq(home,-nroot(x1.domain(),m_n)));
109 else
110 GECODE_ME_CHECK(x0.eq(home,
111 hull(
112 nroot(x1.domain(),m_n),
113 -nroot(x1.domain(),m_n)
114 )
115 ));
116 } else {
117 GECODE_ME_CHECK(x0.eq(home,nroot(x1.domain(),m_n)));
118 }
119 return x0.assigned() ? home.ES_SUBSUMED(*this) : ES_FIX;
120 }
121
122 /*
123 * Bounds consistent square root operator

Callers

nothing calls this directly

Calls 9

ES_SUBSUMEDMethod · 0.80
powFunction · 0.50
nrootFunction · 0.50
hullFunction · 0.50
minMethod · 0.45
maxMethod · 0.45
eqMethod · 0.45
domainMethod · 0.45
assignedMethod · 0.45

Tested by

no test coverage detected