00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 namespace Gecode { namespace Float { namespace Trigonometric {
00039
00040
00041
00042
00043
00044
00045 template<class A, class B>
00046 forceinline
00047 ASin<A,B>::ASin(Home home, A x0, B x1)
00048 : MixBinaryPropagator<A,PC_FLOAT_BND,B,PC_FLOAT_BND>(home,x0,x1) {}
00049
00050 template<class A, class B>
00051 ExecStatus
00052 ASin<A,B>::post(Home home, A x0, B x1) {
00053 if (same(x0,x1)) {
00054 GECODE_ME_CHECK(x0.eq(home,0.0));
00055 } else {
00056 GECODE_ME_CHECK(x0.gq(home,-1.0));
00057 GECODE_ME_CHECK(x0.lq(home,1.0));
00058 (void) new (home) ASin<A,B>(home,x0,x1);
00059 }
00060 return ES_OK;
00061 }
00062
00063
00064 template<class A, class B>
00065 forceinline
00066 ASin<A,B>::ASin(Space& home, bool share, ASin<A,B>& p)
00067 : MixBinaryPropagator<A,PC_FLOAT_BND,B,PC_FLOAT_BND>(home,share,p) {}
00068
00069 template<class A, class B>
00070 Actor*
00071 ASin<A,B>::copy(Space& home, bool share) {
00072 return new (home) ASin<A,B>(home,share,*this);
00073 }
00074
00075 template<class A, class B>
00076 ExecStatus
00077 ASin<A,B>::propagate(Space& home, const ModEventDelta&) {
00078 if ((x0.max() < -1) || (x0.min() > 1)) return ES_FAILED;
00079 GECODE_ME_CHECK(x1.eq(home,asin(x0.domain())));
00080 GECODE_ME_CHECK(x0.eq(home,sin(x1.domain())));
00081 return (x0.assigned() || x1.assigned()) ? home.ES_SUBSUMED(*this) : ES_FIX;
00082 }
00083
00084
00085
00086
00087
00088
00089
00090 template<class A, class B>
00091 forceinline
00092 ACos<A,B>::ACos(Home home, A x0, B x1)
00093 : MixBinaryPropagator<A,PC_FLOAT_BND,B,PC_FLOAT_BND>(home,x0,x1) {}
00094
00095 template<class A, class B>
00096 ExecStatus
00097 ACos<A,B>::post(Home home, A x0, B x1) {
00098 if (same(x0,x1)) {
00099 GECODE_ME_CHECK(x0.gq(home,0.7390851332151));
00100 GECODE_ME_CHECK(x0.lq(home,0.7390851332152));
00101 bool mod;
00102 do {
00103 mod = false;
00104 GECODE_ME_CHECK_MODIFIED(mod,x0.eq(home,acos(x0.val())));
00105 } while (mod);
00106 } else {
00107 GECODE_ME_CHECK(x0.gq(home,-1.0));
00108 GECODE_ME_CHECK(x0.lq(home,1.0));
00109 (void) new (home) ACos<A,B>(home,x0,x1);
00110 }
00111 return ES_OK;
00112 }
00113
00114
00115 template<class A, class B>
00116 forceinline
00117 ACos<A,B>::ACos(Space& home, bool share, ACos<A,B>& p)
00118 : MixBinaryPropagator<A,PC_FLOAT_BND,B,PC_FLOAT_BND>(home,share,p) {}
00119
00120 template<class A, class B>
00121 Actor*
00122 ACos<A,B>::copy(Space& home, bool share) {
00123 return new (home) ACos<A,B>(home,share,*this);
00124 }
00125
00126 template<class A, class B>
00127 ExecStatus
00128 ACos<A,B>::propagate(Space& home, const ModEventDelta&) {
00129 if ((x0.max() < -1) || (x0.min() > 1)) return ES_FAILED;
00130 GECODE_ME_CHECK(x1.eq(home,acos(x0.domain())));
00131 GECODE_ME_CHECK(x0.eq(home,cos(x1.domain())));
00132 return (x0.assigned() || x1.assigned()) ? home.ES_SUBSUMED(*this) : ES_FIX;
00133 }
00134
00135 }}}
00136
00137
00138