lq.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 namespace Gecode { namespace Int { namespace Bool {
00039
00040
00041
00042
00043
00044
00045 template<class BV>
00046 forceinline
00047 Lq<BV>::Lq(Home home, BV b0, BV b1)
00048 : BoolBinary<BV,BV>(home,b0,b1) {}
00049
00050 template<class BV>
00051 forceinline
00052 Lq<BV>::Lq(Space& home, bool share, Lq<BV>& p)
00053 : BoolBinary<BV,BV>(home,share,p) {}
00054
00055 template<class BV>
00056 Actor*
00057 Lq<BV>::copy(Space& home, bool share) {
00058 return new (home) Lq<BV>(home,share,*this);
00059 }
00060
00061 template<class BV>
00062 inline ExecStatus
00063 Lq<BV>::post(Home home, BV b0, BV b1) {
00064 if (b0.zero()) {
00065 return ES_OK;
00066 } else if (b0.one()) {
00067 GECODE_ME_CHECK(b1.one(home));
00068 } else if (b1.zero()) {
00069 GECODE_ME_CHECK(b0.zero(home));
00070 } else if (b1.one()) {
00071 return ES_OK;
00072 } else {
00073 (void) new (home) Lq<BV>(home,b0,b1);
00074 }
00075 return ES_OK;
00076 }
00077
00078 template<class BV>
00079 ExecStatus
00080 Lq<BV>::propagate(Space& home, const ModEventDelta&) {
00081 #define GECODE_INT_STATUS(S0,S1) \
00082 ((BV::S0<<(1*BV::BITS))|(BV::S1<<(0*BV::BITS)))
00083 switch ((x0.status()<<(1*BV::BITS)) | (x1.status()<<(0*BV::BITS))) {
00084 case GECODE_INT_STATUS(NONE,NONE):
00085 GECODE_NEVER;
00086 case GECODE_INT_STATUS(NONE,ZERO):
00087 GECODE_ME_CHECK(x0.zero_none(home)); break;
00088 case GECODE_INT_STATUS(NONE,ONE):
00089 case GECODE_INT_STATUS(ZERO,NONE):
00090 case GECODE_INT_STATUS(ZERO,ZERO):
00091 case GECODE_INT_STATUS(ZERO,ONE):
00092 break;
00093 case GECODE_INT_STATUS(ONE,NONE):
00094 GECODE_ME_CHECK(x1.one_none(home)); break;
00095 case GECODE_INT_STATUS(ONE,ZERO):
00096 return ES_FAILED;
00097 case GECODE_INT_STATUS(ONE,ONE):
00098 break;
00099 default:
00100 GECODE_NEVER;
00101 }
00102 return home.ES_SUBSUMED(*this);
00103 #undef GECODE_INT_STATUS
00104 }
00105
00106
00107
00108
00109
00110
00111 template<class BV>
00112 forceinline ExecStatus
00113 Le<BV>::post(Home home, BV b0, BV b1) {
00114 GECODE_ME_CHECK(b0.zero(home));
00115 GECODE_ME_CHECK(b1.one(home));
00116 return ES_OK;
00117 }
00118
00119 }}}
00120
00121
00122