| 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 |