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
00039
00040 #ifndef __GECODE_SET_INT_HH__
00041 #define __GECODE_SET_INT_HH__
00042
00043 #include <gecode/set.hh>
00044
00045 namespace Gecode { namespace Set { namespace Int {
00046
00058 template<class View>
00059 class MinElement :
00060 public MixBinaryPropagator<View,PC_SET_ANY,
00061 Gecode::Int::IntView,Gecode::Int::PC_INT_BND> {
00062 protected:
00063 using MixBinaryPropagator<View,PC_SET_ANY,
00064 Gecode::Int::IntView,Gecode::Int::PC_INT_BND>::x0;
00065 using MixBinaryPropagator<View,PC_SET_ANY,
00066 Gecode::Int::IntView,Gecode::Int::PC_INT_BND>::x1;
00068 MinElement(Space& home, bool share,MinElement& p);
00070 MinElement(Home home, View, Gecode::Int::IntView);
00071 public:
00073 virtual Actor* copy(Space& home,bool);
00075 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00077 static ExecStatus post(Home home, View s, Gecode::Int::IntView x);
00078 };
00079
00086 template<class View>
00087 class NotMinElement :
00088 public MixBinaryPropagator<View,PC_SET_ANY,
00089 Gecode::Int::IntView,Gecode::Int::PC_INT_DOM> {
00090 protected:
00091 using MixBinaryPropagator<View,PC_SET_ANY,
00092 Gecode::Int::IntView,Gecode::Int::PC_INT_DOM>::x0;
00093 using MixBinaryPropagator<View,PC_SET_ANY,
00094 Gecode::Int::IntView,Gecode::Int::PC_INT_DOM>::x1;
00096 NotMinElement(Space& home, bool share,NotMinElement& p);
00098 NotMinElement(Home home, View, Gecode::Int::IntView);
00099 public:
00101 virtual Actor* copy(Space& home,bool);
00103 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00105 static ExecStatus post(Home home, View s, Gecode::Int::IntView x);
00106 };
00107
00114 template<class View, ReifyMode rm>
00115 class ReMinElement :
00116 public Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
00117 Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView> {
00118 protected:
00119 using Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
00120 Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView>::x0;
00121 using Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
00122 Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView>::x1;
00123 using Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
00124 Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView>::b;
00126 ReMinElement(Space& home, bool share,ReMinElement& p);
00128 ReMinElement(Home home, View, Gecode::Int::IntView,
00129 Gecode::Int::BoolView);
00130 public:
00132 virtual Actor* copy(Space& home,bool);
00134 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00136 static ExecStatus post(Home home, View s, Gecode::Int::IntView x,
00137 Gecode::Int::BoolView b);
00138 };
00139
00146 template<class View>
00147 class MaxElement :
00148 public MixBinaryPropagator<View,PC_SET_ANY,Gecode::Int::IntView,Gecode::Int::PC_INT_BND> {
00149 protected:
00150 using MixBinaryPropagator<View,PC_SET_ANY,
00151 Gecode::Int::IntView,Gecode::Int::PC_INT_BND>::x0;
00152 using MixBinaryPropagator<View,PC_SET_ANY,
00153 Gecode::Int::IntView,Gecode::Int::PC_INT_BND>::x1;
00155 MaxElement(Space& home, bool share,MaxElement& p);
00157 MaxElement(Home home, View, Gecode::Int::IntView);
00158 public:
00160 virtual Actor* copy(Space& home,bool);
00162 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00164 static ExecStatus post(Home home, View s, Gecode::Int::IntView x);
00165 };
00166
00173 template<class View>
00174 class NotMaxElement :
00175 public MixBinaryPropagator<View,PC_SET_ANY,
00176 Gecode::Int::IntView,Gecode::Int::PC_INT_DOM> {
00177 protected:
00178 using MixBinaryPropagator<View,PC_SET_ANY,
00179 Gecode::Int::IntView,Gecode::Int::PC_INT_DOM>::x0;
00180 using MixBinaryPropagator<View,PC_SET_ANY,
00181 Gecode::Int::IntView,Gecode::Int::PC_INT_DOM>::x1;
00183 NotMaxElement(Space& home, bool share,NotMaxElement& p);
00185 NotMaxElement(Home home, View, Gecode::Int::IntView);
00186 public:
00188 virtual Actor* copy(Space& home,bool);
00190 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00192 static ExecStatus post(Home home, View s, Gecode::Int::IntView x);
00193 };
00194
00201 template<class View, ReifyMode rm>
00202 class ReMaxElement :
00203 public Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
00204 Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView> {
00205 protected:
00206 using Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
00207 Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView>::x0;
00208 using Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
00209 Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView>::x1;
00210 using Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
00211 Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView>::b;
00213 ReMaxElement(Space& home, bool share,ReMaxElement& p);
00215 ReMaxElement(Home home, View, Gecode::Int::IntView, Gecode::Int::BoolView);
00216 public:
00218 virtual Actor* copy(Space& home,bool);
00220 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00222 static ExecStatus post(Home home, View s, Gecode::Int::IntView x,
00223 Gecode::Int::BoolView b);
00224 };
00225
00232 template<class View>
00233 class Card :
00234 public MixBinaryPropagator<View,PC_SET_CARD,
00235 Gecode::Int::IntView,Gecode::Int::PC_INT_BND> {
00236 protected:
00237 using MixBinaryPropagator<View,PC_SET_CARD,
00238 Gecode::Int::IntView,Gecode::Int::PC_INT_BND>::x0;
00239 using MixBinaryPropagator<View,PC_SET_CARD,
00240 Gecode::Int::IntView,Gecode::Int::PC_INT_BND>::x1;
00242 Card(Space& home, bool share,Card& p);
00244 Card(Home home, View, Gecode::Int::IntView);
00245 public:
00247 virtual Actor* copy(Space& home,bool);
00249 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00251 static ExecStatus post(Home home, View s, Gecode::Int::IntView x);
00252 };
00253
00260 template<class View>
00261 class Weights : public Propagator {
00262 protected:
00264 SharedArray<int> elements;
00266 SharedArray<int> weights;
00267
00269 View x;
00271 Gecode::Int::IntView y;
00272
00274 Weights(Space& home, bool share,Weights& p);
00276 Weights(Home home, const SharedArray<int>&, const SharedArray<int>&,
00277 View, Gecode::Int::IntView);
00278 public:
00280 virtual Actor* copy(Space& home,bool);
00282 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00284 virtual size_t dispose(Space& home);
00286 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00288 static ExecStatus post(Home home,
00289 const SharedArray<int>& elements,
00290 const SharedArray<int>& weights,
00291 View x, Gecode::Int::IntView y);
00292 };
00293
00294 }}}
00295
00296 #include <gecode/set/int/minmax.hpp>
00297 #include <gecode/set/int/card.hpp>
00298 #include <gecode/set/int/weights.hpp>
00299
00300 #endif
00301
00302