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 namespace Gecode { namespace Float { namespace Trigonometric {
00035
00036
00037
00038
00039
00040
00041 template<class A, class B>
00042 forceinline
00043 ASin<A,B>::ASin(Home home, A x0, B x1)
00044 : MixBinaryPropagator<A,PC_FLOAT_BND,B,PC_FLOAT_BND>(home,x0,x1) {}
00045
00046 template<class A, class B>
00047 ExecStatus
00048 ASin<A,B>::post(Home home, A x0, B x1) {
00049 if (same(x0,x1)) {
00050 GECODE_ME_CHECK(x0.eq(home,0.0));
00051 } else {
00052 GECODE_ME_CHECK(x0.gq(home,-1.0));
00053 GECODE_ME_CHECK(x0.lq(home,1.0));
00054 GECODE_ME_CHECK(x1.eq(home,asin(x0.domain())));
00055 GECODE_ME_CHECK(x0.eq(home,sin(x1.domain())));
00056 (void) new (home) ASin<A,B>(home,x0,x1);
00057 }
00058 return ES_OK;
00059 }
00060
00061
00062 template<class A, class B>
00063 forceinline
00064 ASin<A,B>::ASin(Space& home, ASin<A,B>& p)
00065 : MixBinaryPropagator<A,PC_FLOAT_BND,B,PC_FLOAT_BND>(home,p) {}
00066
00067 template<class A, class B>
00068 Actor*
00069 ASin<A,B>::copy(Space& home) {
00070 return new (home) ASin<A,B>(home,*this);
00071 }
00072
00073 template<class A, class B>
00074 ExecStatus
00075 ASin<A,B>::propagate(Space& home, const ModEventDelta&) {
00076 if ((x0.max() < -1) || (x0.min() > 1)) return ES_FAILED;
00077 GECODE_ME_CHECK(x1.eq(home,asin(x0.domain())));
00078 GECODE_ME_CHECK(x0.eq(home,sin(x1.domain())));
00079 return (x0.assigned() || x1.assigned()) ? home.ES_SUBSUMED(*this) : ES_FIX;
00080 }
00081
00082
00083
00084
00085
00086
00087
00088 template<class A, class B>
00089 forceinline
00090 ACos<A,B>::ACos(Home home, A x0, B x1)
00091 : MixBinaryPropagator<A,PC_FLOAT_BND,B,PC_FLOAT_BND>(home,x0,x1) {}
00092
00093 template<class A, class B>
00094 ExecStatus
00095 ACos<A,B>::post(Home home, A x0, B x1) {
00096 if (same(x0,x1)) {
00097 GECODE_ME_CHECK(x0.gq(home,0.7390851332151));
00098 GECODE_ME_CHECK(x0.lq(home,0.7390851332152));
00099 bool mod;
00100 do {
00101 mod = false;
00102 GECODE_ME_CHECK_MODIFIED(mod,x0.eq(home,acos(x0.val())));
00103 } while (mod);
00104 } else {
00105 GECODE_ME_CHECK(x0.gq(home,-1.0));
00106 GECODE_ME_CHECK(x0.lq(home,1.0));
00107 GECODE_ME_CHECK(x1.eq(home,acos(x0.domain())));
00108 GECODE_ME_CHECK(x0.eq(home,cos(x1.domain())));
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, ACos<A,B>& p)
00118 : MixBinaryPropagator<A,PC_FLOAT_BND,B,PC_FLOAT_BND>(home,p) {}
00119
00120 template<class A, class B>
00121 Actor*
00122 ACos<A,B>::copy(Space& home) {
00123 return new (home) ACos<A,B>(home,*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