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_INT_HH__
00037 #define __GECODE_SET_INT_HH__
00038
00039 #include <gecode/set.hh>
00040
00041 namespace Gecode { namespace Set { namespace Int {
00042
00054 template<class View>
00055 class MinElement :
00056 public MixBinaryPropagator<View,PC_SET_ANY,
00057 Gecode::Int::IntView,Gecode::Int::PC_INT_BND> {
00058 protected:
00059 using MixBinaryPropagator<View,PC_SET_ANY,
00060 Gecode::Int::IntView,Gecode::Int::PC_INT_BND>::x0;
00061 using MixBinaryPropagator<View,PC_SET_ANY,
00062 Gecode::Int::IntView,Gecode::Int::PC_INT_BND>::x1;
00064 MinElement(Space& home, MinElement& p);
00066 MinElement(Home home, View, Gecode::Int::IntView);
00067 public:
00069 virtual Actor* copy(Space& home);
00071 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00073 static ExecStatus post(Home home, View s, Gecode::Int::IntView x);
00074 };
00075
00082 template<class View>
00083 class NotMinElement :
00084 public MixBinaryPropagator<View,PC_SET_ANY,
00085 Gecode::Int::IntView,Gecode::Int::PC_INT_DOM> {
00086 protected:
00087 using MixBinaryPropagator<View,PC_SET_ANY,
00088 Gecode::Int::IntView,Gecode::Int::PC_INT_DOM>::x0;
00089 using MixBinaryPropagator<View,PC_SET_ANY,
00090 Gecode::Int::IntView,Gecode::Int::PC_INT_DOM>::x1;
00092 NotMinElement(Space& home, NotMinElement& p);
00094 NotMinElement(Home home, View, Gecode::Int::IntView);
00095 public:
00097 virtual Actor* copy(Space& home);
00099 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00101 static ExecStatus post(Home home, View s, Gecode::Int::IntView x);
00102 };
00103
00110 template<class View, ReifyMode rm>
00111 class ReMinElement :
00112 public Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
00113 Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView> {
00114 protected:
00115 using Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
00116 Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView>::x0;
00117 using Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
00118 Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView>::x1;
00119 using Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
00120 Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView>::b;
00122 ReMinElement(Space& home, ReMinElement& p);
00124 ReMinElement(Home home, View, Gecode::Int::IntView,
00125 Gecode::Int::BoolView);
00126 public:
00128 virtual Actor* copy(Space& home);
00130 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00132 static ExecStatus post(Home home, View s, Gecode::Int::IntView x,
00133 Gecode::Int::BoolView b);
00134 };
00135
00142 template<class View>
00143 class MaxElement :
00144 public MixBinaryPropagator<View,PC_SET_ANY,Gecode::Int::IntView,Gecode::Int::PC_INT_BND> {
00145 protected:
00146 using MixBinaryPropagator<View,PC_SET_ANY,
00147 Gecode::Int::IntView,Gecode::Int::PC_INT_BND>::x0;
00148 using MixBinaryPropagator<View,PC_SET_ANY,
00149 Gecode::Int::IntView,Gecode::Int::PC_INT_BND>::x1;
00151 MaxElement(Space& home, MaxElement& p);
00153 MaxElement(Home home, View, Gecode::Int::IntView);
00154 public:
00156 virtual Actor* copy(Space& home);
00158 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00160 static ExecStatus post(Home home, View s, Gecode::Int::IntView x);
00161 };
00162
00169 template<class View>
00170 class NotMaxElement :
00171 public MixBinaryPropagator<View,PC_SET_ANY,
00172 Gecode::Int::IntView,Gecode::Int::PC_INT_DOM> {
00173 protected:
00174 using MixBinaryPropagator<View,PC_SET_ANY,
00175 Gecode::Int::IntView,Gecode::Int::PC_INT_DOM>::x0;
00176 using MixBinaryPropagator<View,PC_SET_ANY,
00177 Gecode::Int::IntView,Gecode::Int::PC_INT_DOM>::x1;
00179 NotMaxElement(Space& home, NotMaxElement& p);
00181 NotMaxElement(Home home, View, Gecode::Int::IntView);
00182 public:
00184 virtual Actor* copy(Space& home);
00186 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00188 static ExecStatus post(Home home, View s, Gecode::Int::IntView x);
00189 };
00190
00197 template<class View, ReifyMode rm>
00198 class ReMaxElement :
00199 public Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
00200 Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView> {
00201 protected:
00202 using Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
00203 Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView>::x0;
00204 using Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
00205 Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView>::x1;
00206 using Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
00207 Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView>::b;
00209 ReMaxElement(Space& home, ReMaxElement& p);
00211 ReMaxElement(Home home, View, Gecode::Int::IntView, Gecode::Int::BoolView);
00212 public:
00214 virtual Actor* copy(Space& home);
00216 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00218 static ExecStatus post(Home home, View s, Gecode::Int::IntView x,
00219 Gecode::Int::BoolView b);
00220 };
00221
00228 template<class View>
00229 class Card :
00230 public MixBinaryPropagator<View,PC_SET_CARD,
00231 Gecode::Int::IntView,Gecode::Int::PC_INT_BND> {
00232 protected:
00233 using MixBinaryPropagator<View,PC_SET_CARD,
00234 Gecode::Int::IntView,Gecode::Int::PC_INT_BND>::x0;
00235 using MixBinaryPropagator<View,PC_SET_CARD,
00236 Gecode::Int::IntView,Gecode::Int::PC_INT_BND>::x1;
00238 Card(Space& home, Card& p);
00240 Card(Home home, View, Gecode::Int::IntView);
00241 public:
00243 virtual Actor* copy(Space& home);
00245 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00247 static ExecStatus post(Home home, View s, Gecode::Int::IntView x);
00248 };
00249
00256 template<class View>
00257 class Weights : public Propagator {
00258 protected:
00260 SharedArray<int> elements;
00262 SharedArray<int> weights;
00263
00265 View x;
00267 Gecode::Int::IntView y;
00268
00270 Weights(Space& home, Weights& p);
00272 Weights(Home home, const SharedArray<int>&, const SharedArray<int>&,
00273 View, Gecode::Int::IntView);
00274 public:
00276 virtual Actor* copy(Space& home);
00278 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00280 virtual void reschedule(Space& home);
00282 virtual size_t dispose(Space& home);
00284 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00286 static ExecStatus post(Home home,
00287 const SharedArray<int>& elements,
00288 const SharedArray<int>& weights,
00289 View x, Gecode::Int::IntView y);
00290 };
00291
00292 }}}
00293
00294 #include <gecode/set/int/minmax.hpp>
00295 #include <gecode/set/int/card.hpp>
00296 #include <gecode/set/int/weights.hpp>
00297
00298 #endif
00299
00300