element.hh
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 #ifndef __GECODE_SET_SELECT_HH__
00037 #define __GECODE_SET_SELECT_HH__
00038
00039 #include <gecode/set.hh>
00040
00041 #include <gecode/int/idx-view.hh>
00042 #include <gecode/int/element.hh>
00043 #include <gecode/set/rel.hh>
00044 #include <gecode/set/rel-op.hh>
00045
00046 namespace Gecode { namespace Int {
00047
00049 template<>
00050 class ViewToVarArg<Gecode::Set::SetView> {
00051 public:
00052 typedef Gecode::SetVarArgs argtype;
00053 };
00054
00056 template<>
00057 class ViewToVarArg<Gecode::Set::SingletonView> {
00058 public:
00059 typedef Gecode::IntVarArgs argtype;
00060 };
00061
00062 }}
00063
00064 namespace Gecode { namespace Set { namespace Element {
00065
00077 template<class View, class View0, class View1>
00078 class ElementIntersection : public Propagator {
00079 public:
00080 typedef Gecode::Int::IdxViewArray<View> IdxViewArray;
00081 protected:
00082 IntSet universe;
00083 IdxViewArray iv;
00084 View0 x0;
00085 View1 x1;
00086
00088 ElementIntersection(Space& home, ElementIntersection& p);
00090 ElementIntersection(Home home, IdxViewArray&,View0,View1,
00091 const IntSet& universe);
00092 public:
00094 virtual Actor* copy(Space& home);
00096 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00098 virtual void reschedule(Space& home);
00100 virtual size_t dispose(Space& home);
00102 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00108 static ExecStatus post(Home home,IdxViewArray& x, View0 y,
00109 View1 z, const IntSet& u);
00110 };
00111
00118 template<class View, class View0, class View1>
00119 class ElementUnion : public Propagator {
00120 public:
00121 typedef Gecode::Int::IdxViewArray<View> IdxViewArray;
00122 protected:
00123 IdxViewArray iv;
00124 View0 x0;
00125 View1 x1;
00126
00128 ElementUnion(Space& home, ElementUnion& p);
00130 ElementUnion(Home home,IdxViewArray&,View0,View1);
00131 public:
00133 virtual Actor* copy(Space& home);
00135 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00137 virtual void reschedule(Space& home);
00139 virtual size_t dispose(Space& home);
00141 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00147 static ExecStatus post(Home home,IdxViewArray& x,View0 y, View1 z);
00148 };
00149
00156 template<class SView, class RView>
00157 class ElementUnionConst : public Propagator {
00158 protected:
00159 SView x0;
00160 IntSet* iv;
00161 int n_iv;
00162 RView x1;
00163
00165 ElementUnionConst(Space& home, ElementUnionConst& p);
00167 ElementUnionConst(Home home, SView, const IntSetArgs&, RView);
00168 public:
00170 virtual Actor* copy(Space& home);
00172 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00174 virtual void reschedule(Space& home);
00176 virtual size_t dispose(Space& home);
00178 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00184 static ExecStatus post(Home home,SView z,const IntSetArgs& x,RView y);
00185 };
00186
00193 template<class SView, class RView>
00194 class ElementDisjoint : public Propagator {
00195 public:
00196 typedef Gecode::Int::IdxViewArray<SView> IdxViewArray;
00197 protected:
00198 IdxViewArray iv;
00199 RView x1;
00200
00202 ElementDisjoint(Space& home, ElementDisjoint& p);
00204 ElementDisjoint(Home home,IdxViewArray&,RView);
00205 public:
00207 virtual Actor* copy(Space& home);
00209 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00211 virtual void reschedule(Space& home);
00213 virtual size_t dispose(Space& home);
00215 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00217 static ExecStatus post(Home home,IdxViewArray& x,RView y);
00218 };
00219
00220 }}}
00221
00222 #include <gecode/set/element/inter.hpp>
00223 #include <gecode/set/element/union.hpp>
00224 #include <gecode/set/element/unionConst.hpp>
00225 #include <gecode/set/element/disjoint.hpp>
00226
00227 #endif
00228
00229
00230