unary.icc
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 CpltSet {
00039
00040 template <class View>
00041 forceinline
00042 UnaryCpltSetPropagator<View>::UnaryCpltSetPropagator(Space* home, View& x0, bdd& d0)
00043 : Propagator(home), x(x0), d(d0) {
00044 force(home);
00045 x.subscribe(home, this, PC_CPLTSET_DOM);
00046 }
00047
00048 template <class View>
00049 forceinline
00050 UnaryCpltSetPropagator<View>::UnaryCpltSetPropagator(Space* home, bool share, UnaryCpltSetPropagator& p)
00051 : Propagator(home,share,p) {
00052 d = p.d;
00053 x.update(home, share, p.x);
00054 }
00055
00056 template <class View>
00057 forceinline PropCost
00058 UnaryCpltSetPropagator<View>::cost(ModEventDelta) const {
00059
00060
00061 if (manager.ctrue(x.dom()) || manager.ctrue(d)) {
00062 return PC_LINEAR_LO;
00063 } else {
00064 return PC_QUADRATIC_HI;
00065 }
00066 }
00067
00068 template <class View>
00069 Support::Symbol
00070 UnaryCpltSetPropagator<View>::ati(void) {
00071 return Reflection::mangle<View>("Gecode::CpltSet::UnaryCpltSetPropagator");
00072 }
00073
00074 template <class View>
00075 Reflection::ActorSpec
00076 UnaryCpltSetPropagator<View>::spec(const Space*,
00077 Reflection::VarMap&) const {
00078 throw Reflection::ReflectionException("Not implemented");
00079 }
00080
00081 template <class View>
00082 size_t
00083 UnaryCpltSetPropagator<View>::dispose(Space* home) {
00084
00085 unforce(home);
00086 if (!home->failed()) {
00087 x.cancel(home, this, PC_CPLTSET_DOM);
00088 }
00089 manager.dispose(d);
00090 Propagator::dispose(home);
00091 return sizeof(*this);
00092 }
00093
00094 template <class View>
00095 forceinline ExecStatus
00096 UnaryCpltSetPropagator<View>::post(Space* home, View& x0, bdd& d0) {
00097 (void) new (home) UnaryCpltSetPropagator(home, x0, d0);
00098 return ES_OK;
00099 }
00100
00101 template <class View>
00102 forceinline Actor*
00103 UnaryCpltSetPropagator<View>::copy(Space* home, bool share) {
00104 return new (home) UnaryCpltSetPropagator(home, share, *this);
00105 }
00106
00107 template <class View>
00108 forceinline ExecStatus
00109 UnaryCpltSetPropagator<View>::propagate(Space* home, ModEventDelta) {
00110
00111
00112
00113
00114
00115
00116
00117 ModEvent me = x.intersect(home, d);
00118 GECODE_ME_CHECK(me);
00119
00120
00121
00122
00123
00124 return ES_SUBSUMED(this, home);
00125 }
00126
00127
00128
00129
00130 }}
00131
00132