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
00041
00042
00043
00044 #ifndef __GECODE_SET_BRANCH_HH__
00045 #define __GECODE_SET_BRANCH_HH__
00046
00047 #include <gecode/set.hh>
00048
00054 namespace Gecode { namespace Set { namespace Branch {
00055
00056
00057
00058
00059
00060
00061
00069 template<bool inc>
00070 class ValMin : public ValSelBase<SetView,int> {
00071 public:
00073 ValMin(void);
00075 ValMin(Space& home, const ValBranchOptions& vbo);
00077 int val(Space& home, SetView x) const;
00079 ModEvent tell(Space& home, unsigned int a, SetView x, int v);
00080 };
00081
00089 template<bool inc>
00090 class ValMed : public ValSelBase<SetView,int> {
00091 public:
00093 ValMed(void);
00095 ValMed(Space& home, const ValBranchOptions& vbo);
00097 int val(Space& home, SetView x) const;
00099 ModEvent tell(Space& home, unsigned int a, SetView x, int v);
00100 };
00101
00109 template<bool inc>
00110 class ValMax : public ValSelBase<SetView,int> {
00111 public:
00113 ValMax(void);
00115 ValMax(Space& home, const ValBranchOptions& vbo);
00117 int val(Space& home, SetView x) const;
00119 ModEvent tell(Space& home, unsigned int a, SetView x, int v);
00120 };
00121
00129 template<bool inc>
00130 class ValRnd {
00131 protected:
00133 ArchivedRandomGenerator r;
00134 public:
00136 typedef SetView View;
00138 typedef int Val;
00140 typedef ArchivedRandomGenerator Choice;
00142 static const unsigned int alternatives = 2;
00144 ValRnd(void);
00146 ValRnd(Space& home, const ValBranchOptions& vbo);
00148 int val(Space& home, SetView x);
00150 ModEvent tell(Space& home, unsigned int a, SetView x, int n);
00152 Choice choice(Space& home);
00154 Choice choice(const Space& home, Archive& e);
00156 void commit(Space& home, const Choice& c, unsigned a);
00158 void update(Space& home, bool share, ValRnd& vs);
00160 void dispose(Space& home);
00161 };
00162
00164 template<bool inc>
00165 class AssignValMin : public ValMin<inc> {
00166 public:
00168 static const unsigned int alternatives = 1;
00170 AssignValMin(void);
00172 AssignValMin(Space& home, const ValBranchOptions& vbo);
00173 };
00174
00176 template<bool inc>
00177 class AssignValMed : public ValMed<inc> {
00178 public:
00180 static const unsigned int alternatives = 1;
00182 AssignValMed(void);
00184 AssignValMed(Space& home, const ValBranchOptions& vbo);
00185 };
00186
00188 template<bool inc>
00189 class AssignValMax : public ValMax<inc> {
00190 public:
00192 static const unsigned int alternatives = 1;
00194 AssignValMax(void);
00196 AssignValMax(Space& home, const ValBranchOptions& vbo);
00197 };
00198
00200 template<bool inc>
00201 class AssignValRnd : public ValRnd<inc> {
00202 public:
00204 static const unsigned int alternatives = 1;
00206 AssignValRnd(void);
00208 AssignValRnd(Space& home, const ValBranchOptions& vbo);
00209 };
00210
00211
00212
00213
00214
00215
00222 class ByMinMin : public ViewSelBase<SetView> {
00223 private:
00225 int min;
00226 public:
00228 ByMinMin(void);
00230 ByMinMin(Space& home, const VarBranchOptions& vbo);
00232 ViewSelStatus init(Space& home, SetView x);
00234 ViewSelStatus select(Space& home, SetView x);
00235 };
00236
00243 class ByMinMax : public ViewSelBase<SetView> {
00244 private:
00246 int min;
00247 public:
00249 ByMinMax(void);
00251 ByMinMax(Space& home, const VarBranchOptions& vbo);
00253 ViewSelStatus init(Space& home, SetView x);
00255 ViewSelStatus select(Space& home, SetView x);
00256 };
00257
00264 class ByMaxMin : public ViewSelBase<SetView> {
00265 private:
00267 int max;
00268 public:
00270 ByMaxMin(void);
00272 ByMaxMin(Space& home, const VarBranchOptions& vbo);
00274 ViewSelStatus init(Space& home, SetView x);
00276 ViewSelStatus select(Space& home, SetView x);
00277 };
00278
00285 class ByMaxMax : public ViewSelBase<SetView> {
00286 private:
00288 int max;
00289 public:
00291 ByMaxMax(void);
00293 ByMaxMax(Space& home, const VarBranchOptions& vbo);
00295 ViewSelStatus init(Space& home, SetView x);
00297 ViewSelStatus select(Space& home, SetView x);
00298 };
00299
00306 class BySizeMin : public ViewSelBase<SetView> {
00307 private:
00309 unsigned int size;
00310 public:
00312 BySizeMin(void);
00314 BySizeMin(Space& home, const VarBranchOptions& vbo);
00316 ViewSelStatus init(Space& home, SetView x);
00318 ViewSelStatus select(Space& home, SetView x);
00319 };
00320
00327 class BySizeMax : public ViewSelBase<SetView> {
00328 private:
00330 unsigned int size;
00331 public:
00333 BySizeMax(void);
00335 BySizeMax(Space& home, const VarBranchOptions& vbo);
00337 ViewSelStatus init(Space& home, SetView x);
00339 ViewSelStatus select(Space& home, SetView x);
00340 };
00341
00349 class BySizeDegreeMin : public ViewSelBase<SetView> {
00350 protected:
00352 double sizedegree;
00353 public:
00355 BySizeDegreeMin(void);
00357 BySizeDegreeMin(Space& home, const VarBranchOptions& vbo);
00359 ViewSelStatus init(Space& home, SetView x);
00361 ViewSelStatus select(Space& home, SetView x);
00362 };
00363
00371 class BySizeDegreeMax : public ViewSelBase<SetView> {
00372 protected:
00374 double sizedegree;
00375 public:
00377 BySizeDegreeMax(void);
00379 BySizeDegreeMax(Space& home, const VarBranchOptions& vbo);
00381 ViewSelStatus init(Space& home, SetView x);
00383 ViewSelStatus select(Space& home, SetView x);
00384 };
00385
00393 class BySizeAfcMin : public ViewSelBase<SetView> {
00394 protected:
00396 double sizeafc;
00397 public:
00399 BySizeAfcMin(void);
00401 BySizeAfcMin(Space& home, const VarBranchOptions& vbo);
00403 ViewSelStatus init(Space& home, SetView x);
00405 ViewSelStatus select(Space& home, SetView x);
00406 };
00407
00415 class BySizeAfcMax : public ViewSelBase<SetView> {
00416 protected:
00418 double sizeafc;
00419 public:
00421 BySizeAfcMax(void);
00423 BySizeAfcMax(Space& home, const VarBranchOptions& vbo);
00425 ViewSelStatus init(Space& home, SetView x);
00427 ViewSelStatus select(Space& home, SetView x);
00428 };
00429
00430 }}}
00431
00432 #include <gecode/set/branch/select-val.hpp>
00433 #include <gecode/set/branch/select-view.hpp>
00434 #include <gecode/set/branch/post-val.hpp>
00435
00436 #endif
00437
00438