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