channel.hpp
Go to the documentation of this file.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
00039
00040 namespace Gecode { namespace Float { namespace Channel {
00041
00042 template<class A, class B>
00043 forceinline
00044 Channel<A,B>::Channel(Home home, A x0, B x1)
00045 : MixBinaryPropagator<A,PC_FLOAT_BND,B,Int::PC_INT_BND>(home,x0,x1) {}
00046
00047 template<class A, class B>
00048 forceinline
00049 Channel<A,B>::Channel(Space& home, bool share, Channel<A,B>& p)
00050 : MixBinaryPropagator<A,PC_FLOAT_BND,B,Int::PC_INT_BND>(home,share,p) {}
00051
00052 template<class A, class B>
00053 Actor*
00054 Channel<A,B>::copy(Space& home, bool share) {
00055 return new (home) Channel<A,B>(home,share,*this);
00056 }
00057
00058 template<class A, class B>
00059 ExecStatus
00060 Channel<A,B>::post(Home home, A x0, B x1) {
00061 GECODE_ME_CHECK(x0.eq(home,FloatVal(Int::Limits::min,
00062 Int::Limits::max)));
00063 (void) new (home) Channel<A,B>(home,x0,x1);
00064 return ES_OK;
00065 }
00066
00067 template<class A, class B>
00068 ExecStatus
00069 Channel<A,B>::propagate(Space& home, const ModEventDelta&) {
00070 GECODE_ME_CHECK(x1.gq(home,static_cast<int>(std::ceil(x0.min()))));
00071 GECODE_ME_CHECK(x1.lq(home,static_cast<int>(std::floor(x0.max()))));
00072 GECODE_ME_CHECK(x0.eq(home,FloatVal(x1.min(),x1.max())));
00073 return x0.assigned() ? home.ES_SUBSUMED(*this) : ES_FIX;
00074 }
00075
00076 }}}
00077
00078
00079