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_HH__
00041 #define __GECODE_SET_HH__
00042
00043 #include <gecode/kernel.hh>
00044 #include <gecode/int.hh>
00045 #include <gecode/iter.hh>
00046
00047 #include <functional>
00048
00049
00050
00051
00052
00053 #if !defined(GECODE_STATIC_LIBS) && \
00054 (defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER))
00055
00056 #ifdef GECODE_BUILD_SET
00057 #define GECODE_SET_EXPORT __declspec( dllexport )
00058 #else
00059 #define GECODE_SET_EXPORT __declspec( dllimport )
00060 #endif
00061
00062 #else
00063
00064 #ifdef GECODE_GCC_HAS_CLASS_VISIBILITY
00065 #define GECODE_SET_EXPORT __attribute__ ((visibility("default")))
00066 #else
00067 #define GECODE_SET_EXPORT
00068 #endif
00069
00070 #endif
00071
00072
00073 #ifndef GECODE_BUILD_SET
00074 #define GECODE_LIBRARY_NAME "Set"
00075 #include <gecode/support/auto-link.hpp>
00076 #endif
00077
00078
00090 #include <gecode/set/exception.hpp>
00091
00092 namespace Gecode { namespace Set {
00093
00095 namespace Limits {
00097 const int max = (Gecode::Int::Limits::max / 2) - 1;
00099 const int min = -max;
00101 const unsigned int card = max-min+1;
00103 void check(int n, const char* l);
00105 void check(unsigned int n, const char* l);
00107 void check(const IntSet& s, const char* l);
00108 }
00109
00110 }}
00111
00112 #include <gecode/set/limits.hpp>
00113
00114 #include <gecode/set/var-imp.hpp>
00115
00116 namespace Gecode {
00117
00118 namespace Set {
00119 class SetView;
00120 }
00121
00127 class SetVar : public VarImpVar<Set::SetVarImp> {
00128 friend class SetVarArray;
00129 friend class SetVarArgs;
00130 using VarImpVar<Set::SetVarImp>::x;
00131 public:
00133
00134
00135 SetVar(void);
00137 SetVar(const SetVar& y);
00139 SetVar(const Set::SetView& y);
00140
00142 GECODE_SET_EXPORT SetVar(Space& home);
00143
00161 GECODE_SET_EXPORT
00162 SetVar(Space& home,int glbMin,int glbMax,int lubMin,int lubMax,
00163 unsigned int cardMin = 0,
00164 unsigned int cardMax = Set::Limits::card);
00165
00182 GECODE_SET_EXPORT
00183 SetVar(Space& home,const IntSet& glbD,int lubMin,int lubMax,
00184 unsigned int cardMin = 0,
00185 unsigned int cardMax = Set::Limits::card);
00186
00204 GECODE_SET_EXPORT
00205 SetVar(Space& home,int glbMin,int glbMax,const IntSet& lubD,
00206 unsigned int cardMin = 0,
00207 unsigned int cardMax = Set::Limits::card);
00208
00226 GECODE_SET_EXPORT
00227 SetVar(Space& home,const IntSet& glbD,const IntSet& lubD,
00228 unsigned int cardMin = 0,
00229 unsigned int cardMax = Set::Limits::card);
00231
00233
00234
00235 unsigned int glbSize(void) const;
00237 unsigned int lubSize(void) const;
00239 unsigned int unknownSize(void) const;
00241 unsigned int cardMin(void) const;
00243 unsigned int cardMax(void) const;
00245 int lubMin(void) const;
00247 int lubMax(void) const;
00249 int glbMin(void) const;
00251 int glbMax(void) const;
00253
00255
00256
00257 bool contains(int i) const;
00259 bool notContains(int i) const;
00261 };
00262
00268
00270 class SetVarGlbRanges {
00271 private:
00272 Set::GlbRanges<Set::SetVarImp*> iter;
00273 public:
00275
00276
00277 SetVarGlbRanges(void);
00279 SetVarGlbRanges(const SetVar& x);
00281
00283
00284
00285 bool operator ()(void) const;
00287 void operator ++(void);
00289
00291
00292
00293 int min(void) const;
00295 int max(void) const;
00297 unsigned int width(void) const;
00299 };
00300
00302 class SetVarLubRanges {
00303 private:
00304 Set::LubRanges<Set::SetVarImp*> iter;
00305 public:
00307
00308
00309 SetVarLubRanges(void);
00311 SetVarLubRanges(const SetVar& x);
00313
00315
00316
00317 bool operator ()(void) const;
00319 void operator ++(void);
00321
00323
00324
00325 int min(void) const;
00327 int max(void) const;
00329 unsigned int width(void) const;
00331 };
00332
00334 class SetVarUnknownRanges {
00335 private:
00336 Set::UnknownRanges<Set::SetVarImp*> iter;
00337 public:
00339
00340
00341 SetVarUnknownRanges(void);
00343 SetVarUnknownRanges(const SetVar& x);
00345
00347
00348
00349 bool operator ()(void) const;
00351 void operator ++(void);
00353
00355
00356
00357 int min(void) const;
00359 int max(void) const;
00361 unsigned int width(void) const;
00363 };
00364
00366 class SetVarGlbValues {
00367 private:
00368 Iter::Ranges::ToValues<SetVarGlbRanges> iter;
00369 public:
00371
00372
00373 SetVarGlbValues(void);
00375 SetVarGlbValues(const SetVar& x);
00377
00379
00380
00381 bool operator ()(void) const;
00383 void operator ++(void);
00385
00387
00388
00389 int val(void) const;
00391 };
00392
00394 class SetVarLubValues {
00395 private:
00396 Iter::Ranges::ToValues<SetVarLubRanges> iter;
00397 public:
00399
00400
00401 SetVarLubValues(void);
00403 SetVarLubValues(const SetVar& x);
00405
00407
00408
00409 bool operator ()(void) const;
00411 void operator ++(void);
00413
00415
00416
00417 int val(void) const;
00419 };
00420
00422 class SetVarUnknownValues {
00423 private:
00424 Iter::Ranges::ToValues<SetVarUnknownRanges> iter;
00425 public:
00427
00428
00429 SetVarUnknownValues(void);
00431 SetVarUnknownValues(const SetVar& x);
00433
00435
00436
00437 bool operator ()(void) const;
00439 void operator ++(void);
00441
00443
00444
00445 int val(void) const;
00447 };
00448
00450
00455 template<class Char, class Traits>
00456 std::basic_ostream<Char,Traits>&
00457 operator <<(std::basic_ostream<Char,Traits>& os, const SetVar& x);
00458
00459 }
00460
00461 #include <gecode/set/view.hpp>
00462
00463 namespace Gecode {
00473
00474 }
00475
00476 #include <gecode/set/array-traits.hpp>
00477
00478 namespace Gecode {
00479
00488 class SetVarArgs : public VarArgArray<SetVar> {
00489 public:
00491
00492
00493 SetVarArgs(void);
00495 explicit SetVarArgs(int n);
00497 SetVarArgs(const SetVarArgs& a);
00499 SetVarArgs(const VarArray<SetVar>& a);
00501 SetVarArgs(const std::vector<SetVar>& a);
00503 template<class InputIterator>
00504 SetVarArgs(InputIterator first, InputIterator last);
00511 GECODE_SET_EXPORT
00512 SetVarArgs(Space& home,int n,int glbMin,int glbMax,
00513 int lubMin,int lubMax,
00514 unsigned int minCard = 0,
00515 unsigned int maxCard = Set::Limits::card);
00522 GECODE_SET_EXPORT
00523 SetVarArgs(Space& home,int n,const IntSet& glb,
00524 int lubMin, int lubMax,
00525 unsigned int minCard = 0,
00526 unsigned int maxCard = Set::Limits::card);
00533 GECODE_SET_EXPORT
00534 SetVarArgs(Space& home,int n,int glbMin,int glbMax,
00535 const IntSet& lub,
00536 unsigned int minCard = 0,
00537 unsigned int maxCard = Set::Limits::card);
00544 GECODE_SET_EXPORT
00545 SetVarArgs(Space& home,int n,
00546 const IntSet& glb,const IntSet& lub,
00547 unsigned int minCard = 0,
00548 unsigned int maxCard = Set::Limits::card);
00550 };
00552
00568 class SetVarArray : public VarArray<SetVar> {
00569 public:
00571
00572
00573 SetVarArray(void);
00575 SetVarArray(const SetVarArray&);
00577 SetVarArray(Space& home, const SetVarArgs&);
00579 GECODE_SET_EXPORT SetVarArray(Space& home, int n);
00586 GECODE_SET_EXPORT
00587 SetVarArray(Space& home,int n,int glbMin,int glbMax,int lubMin,int lubMax,
00588 unsigned int minCard = 0,
00589 unsigned int maxCard = Set::Limits::card);
00596 GECODE_SET_EXPORT
00597 SetVarArray(Space& home,int n,const IntSet& glb, int lubMin, int lubMax,
00598 unsigned int minCard = 0,
00599 unsigned int maxCard = Set::Limits::card);
00606 GECODE_SET_EXPORT
00607 SetVarArray(Space& home,int n,int glbMin,int glbMax,const IntSet& lub,
00608 unsigned int minCard = 0,
00609 unsigned int maxCard = Set::Limits::card);
00616 GECODE_SET_EXPORT
00617 SetVarArray(Space& home,int n,
00618 const IntSet& glb,const IntSet& lub,
00619 unsigned int minCard = 0,
00620 unsigned int maxCard = Set::Limits::card);
00622 };
00623
00624 }
00625
00626 #include <gecode/set/array.hpp>
00627
00628 namespace Gecode {
00629
00641 enum SetRelType {
00642 SRT_EQ,
00643 SRT_NQ,
00644 SRT_SUB,
00645 SRT_SUP,
00646 SRT_DISJ,
00647 SRT_CMPL,
00648 SRT_LQ,
00649 SRT_LE,
00650 SRT_GQ,
00651 SRT_GR
00652 };
00653
00658 enum SetOpType {
00659 SOT_UNION,
00660 SOT_DUNION,
00661 SOT_INTER,
00662 SOT_MINUS
00663 };
00664
00671
00672 GECODE_SET_EXPORT void
00673 dom(Home home, SetVar x, SetRelType r, int i);
00675 GECODE_SET_EXPORT void
00676 dom(Home home, const SetVarArgs& x, SetRelType r, int i);
00678 GECODE_SET_EXPORT void
00679 dom(Home home, SetVar x, SetRelType r, int i, int j);
00681 GECODE_SET_EXPORT void
00682 dom(Home home, const SetVarArgs& x, SetRelType r, int i, int j);
00684 GECODE_SET_EXPORT void
00685 dom(Home home, SetVar x, SetRelType r, const IntSet& s);
00687 GECODE_SET_EXPORT void
00688 dom(Home home, const SetVarArgs& x, SetRelType r, const IntSet& s);
00690 GECODE_SET_EXPORT void
00691 cardinality(Home home, SetVar x, unsigned int i, unsigned int j);
00693 GECODE_SET_EXPORT void
00694 cardinality(Home home, const SetVarArgs& x, unsigned int i, unsigned int j);
00696 GECODE_SET_EXPORT void
00697 dom(Home home, SetVar x, SetRelType rt, int i, Reify r);
00699 GECODE_SET_EXPORT void
00700 dom(Home home, SetVar x, SetRelType rt, int i, int j, Reify r);
00702 GECODE_SET_EXPORT void
00703 dom(Home home, SetVar x, SetRelType rt, const IntSet& s, Reify r);
00705 GECODE_SET_EXPORT void
00706 dom(Home home, SetVar x, SetVar d);
00708 GECODE_SET_EXPORT void
00709 dom(Home home, const SetVarArgs& x, const SetVarArgs& d);
00711
00712
00719
00720 GECODE_SET_EXPORT void
00721 rel(Home home, SetVar x, SetRelType r, SetVar y);
00723 GECODE_SET_EXPORT void
00724 rel(Home home, SetVar x, SetRelType rt, SetVar y, Reify r);
00726 GECODE_SET_EXPORT void
00727 rel(Home home, SetVar s, SetRelType r, IntVar x);
00729 GECODE_SET_EXPORT void
00730 rel(Home home, IntVar x, SetRelType r, SetVar s);
00732 GECODE_SET_EXPORT void
00733 rel(Home home, SetVar s, SetRelType rt, IntVar x, Reify r);
00735 GECODE_SET_EXPORT void
00736 rel(Home home, IntVar x, SetRelType rt, SetVar s, Reify r);
00738 GECODE_SET_EXPORT void
00739 rel(Home home, SetVar s, IntRelType rt, IntVar x);
00741 void
00742 rel(Home home, IntVar x, IntRelType rt, SetVar s);
00744 GECODE_SET_EXPORT void
00745 rel(Home home, SetVar s, IntRelType rt, IntVar x, Reify r);
00747 void
00748 rel(Home home, IntVar x, IntRelType rt, SetVar s, Reify r);
00750
00751 }
00752
00753 #include <gecode/set/int.hpp>
00754
00755 namespace Gecode {
00756
00763
00764 GECODE_SET_EXPORT void
00765 rel(Home home, SetVar x, SetOpType op, SetVar y, SetRelType r, SetVar z);
00767 GECODE_SET_EXPORT void
00768 rel(Home home, SetOpType op, const SetVarArgs& x, SetVar y);
00770 GECODE_SET_EXPORT void
00771 rel(Home home, SetOpType op, const SetVarArgs& x, const IntSet& z, SetVar y);
00773 GECODE_SET_EXPORT void
00774 rel(Home home, SetOpType op, const IntVarArgs& x, const IntSet& z, SetVar y);
00776 GECODE_SET_EXPORT void
00777 rel(Home home, SetOpType op, const IntVarArgs& x, SetVar y);
00779 GECODE_SET_EXPORT void
00780 rel(Home home, const IntSet& x, SetOpType op, SetVar y,
00781 SetRelType r, SetVar z);
00783 GECODE_SET_EXPORT void
00784 rel(Home home, SetVar x, SetOpType op, const IntSet& y,
00785 SetRelType r, SetVar z);
00787 GECODE_SET_EXPORT void
00788 rel(Home home, SetVar x, SetOpType op, SetVar y,
00789 SetRelType r, const IntSet& z);
00791 GECODE_SET_EXPORT void
00792 rel(Home home, const IntSet& x, SetOpType op, SetVar y, SetRelType r,
00793 const IntSet& z);
00795 GECODE_SET_EXPORT void
00796 rel(Home home, SetVar x, SetOpType op, const IntSet& y, SetRelType r,
00797 const IntSet& z);
00802 GECODE_SET_EXPORT void
00803 ite(Home home, BoolVar b, SetVar x, SetVar y, SetVar z);
00805
00806
00813
00814 GECODE_SET_EXPORT void
00815 convex(Home home, SetVar x);
00817 GECODE_SET_EXPORT void
00818 convex(Home home, SetVar x, SetVar y);
00820
00821
00828
00829 GECODE_SET_EXPORT void
00830 sequence(Home home, const SetVarArgs& x);
00832 GECODE_SET_EXPORT void
00833 sequence(Home home, const SetVarArgs& y, SetVar x);
00835
00836
00843
00844 GECODE_SET_EXPORT void
00845 atmostOne(Home home, const SetVarArgs& x, unsigned int c);
00847
00856 GECODE_SET_EXPORT void
00857 min(Home home, SetVar s, IntVar x);
00861 GECODE_SET_EXPORT void
00862 notMin(Home home, SetVar s, IntVar x);
00866 GECODE_SET_EXPORT void
00867 min(Home home, SetVar s, IntVar x, Reify r);
00871 GECODE_SET_EXPORT void
00872 max(Home home, SetVar s, IntVar x);
00876 GECODE_SET_EXPORT void
00877 notMax(Home home, SetVar s, IntVar x);
00881 GECODE_SET_EXPORT void
00882 max(Home home, SetVar s, IntVar x, Reify r);
00886 GECODE_SET_EXPORT void
00887 cardinality(Home home, SetVar s, IntVar x);
00891 GECODE_SET_EXPORT void
00892 cardinality(Home home, SetVar s, IntVar x, Reify r);
00905 GECODE_SET_EXPORT void
00906 weights(Home home, IntSharedArray elements, IntSharedArray weights,
00907 SetVar x, IntVar y);
00908
00909
00916
00917 GECODE_SET_EXPORT void
00918 channel(Home home, const IntVarArgs& x,const SetVarArgs& y);
00920 GECODE_SET_EXPORT void
00921 channelSorted(Home home, const IntVarArgs& x, SetVar y);
00923 GECODE_SET_EXPORT void
00924 channel(Home home, const BoolVarArgs& x, SetVar y);
00926 GECODE_SET_EXPORT void
00927 channel(Home home, const SetVarArgs& x, const SetVarArgs& y);
00929
00930
00942 GECODE_SET_EXPORT void
00943 precede(Home home, const SetVarArgs& x, int s, int t);
00947 GECODE_SET_EXPORT void
00948 precede(Home home, const SetVarArgs& x, const IntArgs& c);
00949
00950
00972 GECODE_SET_EXPORT void
00973 element(Home home, SetOpType op, const SetVarArgs& x, SetVar y, SetVar z,
00974 const IntSet& u = IntSet(Set::Limits::min,Set::Limits::max));
00984 GECODE_SET_EXPORT void
00985 element(Home home, SetOpType op, const IntVarArgs& x, SetVar y, SetVar z,
00986 const IntSet& u = IntSet(Set::Limits::min,Set::Limits::max));
00996 GECODE_SET_EXPORT void
00997 element(Home home, SetOpType op, const IntSetArgs& x, SetVar y, SetVar z,
00998 const IntSet& u = IntSet(Set::Limits::min,Set::Limits::max));
01008 GECODE_SET_EXPORT void
01009 element(Home home, SetOpType op, const IntArgs& x, SetVar y, SetVar z,
01010 const IntSet& u = IntSet(Set::Limits::min,Set::Limits::max));
01016 GECODE_SET_EXPORT void
01017 element(Home home, const SetVarArgs& x, IntVar y, SetVar z);
01023 GECODE_SET_EXPORT void
01024 element(Home home, const IntSetArgs& s, IntVar y, SetVar z);
01030 GECODE_SET_EXPORT void
01031 element(Home home, const IntSetArgs& a,
01032 IntVar x, int w, IntVar y, int h, SetVar z);
01038 GECODE_SET_EXPORT void
01039 element(Home home, const SetVarArgs& a,
01040 IntVar x, int w, IntVar y, int h, SetVar z);
01042
01043
01054
01055 GECODE_SET_EXPORT void
01056 wait(Home home, SetVar x, std::function<void(Space& home)> c);
01058 GECODE_SET_EXPORT void
01059 wait(Home home, const SetVarArgs& x, std::function<void(Space& home)> c);
01061
01062 }
01063
01064
01065 namespace Gecode {
01066
01080 typedef std::function<bool(const Space& home, SetVar x, int i)>
01081 SetBranchFilter;
01092 typedef std::function<double(const Space& home, SetVar x, int i)>
01093 SetBranchMerit;
01094
01105 typedef std::function<int(const Space& home, SetVar x, int i)>
01106 SetBranchVal;
01107
01119 typedef std::function<void(Space& home, unsigned int a,
01120 SetVar x, int i, int n)>
01121 SetBranchCommit;
01122
01123 }
01124
01125 #include <gecode/set/branch/traits.hpp>
01126
01127 namespace Gecode {
01128
01134 class SetAFC : public AFC {
01135 public:
01143 SetAFC(void);
01145 SetAFC(const SetAFC& a);
01147 SetAFC& operator =(const SetAFC& a);
01155 SetAFC(Home home, const SetVarArgs& x, double d=1.0, bool share=true);
01166 void init(Home home, const SetVarArgs& x, double d=1.0, bool share=true);
01167 };
01168
01169 }
01170
01171 #include <gecode/set/branch/afc.hpp>
01172
01173 namespace Gecode {
01174
01175
01181 class SetAction : public Action {
01182 public:
01190 SetAction(void);
01192 SetAction(const SetAction& a);
01194 SetAction& operator =(const SetAction& a);
01203 GECODE_SET_EXPORT
01204 SetAction(Home home, const SetVarArgs& x, double d=1.0,
01205 SetBranchMerit bm=nullptr);
01217 GECODE_SET_EXPORT void
01218 init(Home home, const SetVarArgs& x, double d=1.0,
01219 SetBranchMerit bm=nullptr);
01220 };
01221
01222 }
01223
01224 #include <gecode/set/branch/action.hpp>
01225
01226 namespace Gecode {
01227
01233 class SetCHB : public CHB {
01234 public:
01242 SetCHB(void);
01244 SetCHB(const SetCHB& chb);
01246 SetCHB& operator =(const SetCHB& chb);
01255 GECODE_SET_EXPORT
01256 SetCHB(Home home, const SetVarArgs& x, SetBranchMerit bm=nullptr);
01268 GECODE_SET_EXPORT void
01269 init(Home home, const SetVarArgs& x, SetBranchMerit bm=nullptr);
01270 };
01271
01272 }
01273
01274 #include <gecode/set/branch/chb.hpp>
01275
01276 namespace Gecode {
01277
01279 typedef std::function<void(const Space &home, const Brancher& b,
01280 unsigned int a,
01281 SetVar x, int i, const int& n,
01282 std::ostream& o)>
01283 SetVarValPrint;
01284
01285 }
01286
01287 namespace Gecode {
01288
01294 class SetVarBranch : public VarBranch<SetVar> {
01295 public:
01297 enum Select {
01298 SEL_NONE = 0,
01299 SEL_RND,
01300 SEL_MERIT_MIN,
01301 SEL_MERIT_MAX,
01302 SEL_DEGREE_MIN,
01303 SEL_DEGREE_MAX,
01304 SEL_AFC_MIN,
01305 SEL_AFC_MAX,
01306 SEL_ACTION_MIN,
01307 SEL_ACTION_MAX,
01308 SEL_CHB_MIN,
01309 SEL_CHB_MAX,
01310 SEL_MIN_MIN,
01311 SEL_MIN_MAX,
01312 SEL_MAX_MIN,
01313 SEL_MAX_MAX,
01314 SEL_SIZE_MIN,
01315 SEL_SIZE_MAX,
01316 SEL_DEGREE_SIZE_MIN,
01317 SEL_DEGREE_SIZE_MAX,
01318 SEL_AFC_SIZE_MIN,
01319 SEL_AFC_SIZE_MAX,
01320 SEL_ACTION_SIZE_MIN,
01321 SEL_ACTION_SIZE_MAX,
01322 SEL_CHB_SIZE_MIN,
01323 SEL_CHB_SIZE_MAX
01324 };
01325 protected:
01327 Select s;
01328 public:
01330 SetVarBranch(void);
01332 SetVarBranch(Rnd r);
01334 SetVarBranch(Select s, BranchTbl t);
01336 SetVarBranch(Select s, double d, BranchTbl t);
01338 SetVarBranch(Select s, SetAFC a, BranchTbl t);
01340 SetVarBranch(Select s, SetAction a, BranchTbl t);
01342 SetVarBranch(Select s, SetCHB c, BranchTbl t);
01344 SetVarBranch(Select s, SetBranchMerit mf, BranchTbl t);
01346 Select select(void) const;
01348 void expand(Home home, const SetVarArgs& x);
01349 };
01350
01356
01357 SetVarBranch SET_VAR_NONE(void);
01359 SetVarBranch SET_VAR_RND(Rnd r);
01361 SetVarBranch SET_VAR_MERIT_MIN(SetBranchMerit bm, BranchTbl tbl=nullptr);
01363 SetVarBranch SET_VAR_MERIT_MAX(SetBranchMerit bm, BranchTbl tbl=nullptr);
01365 SetVarBranch SET_VAR_DEGREE_MIN(BranchTbl tbl=nullptr);
01367 SetVarBranch SET_VAR_DEGREE_MAX(BranchTbl tbl=nullptr);
01369 SetVarBranch SET_VAR_AFC_MIN(double d=1.0, BranchTbl tbl=nullptr);
01371 SetVarBranch SET_VAR_AFC_MIN(SetAFC a, BranchTbl tbl=nullptr);
01373 SetVarBranch SET_VAR_AFC_MAX(double d=1.0, BranchTbl tbl=nullptr);
01375 SetVarBranch SET_VAR_AFC_MAX(SetAFC a, BranchTbl tbl=nullptr);
01377 SetVarBranch SET_VAR_ACTION_MIN(double d=1.0, BranchTbl tbl=nullptr);
01379 SetVarBranch SET_VAR_ACTION_MIN(SetAction a, BranchTbl tbl=nullptr);
01381 SetVarBranch SET_VAR_ACTION_MAX(double d=1.0, BranchTbl tbl=nullptr);
01383 SetVarBranch SET_VAR_ACTION_MAX(SetAction a, BranchTbl tbl=nullptr);
01385 SetVarBranch SET_VAR_CHB_MIN(BranchTbl tbl=nullptr);
01387 SetVarBranch SET_VAR_CHB_MIN(SetCHB c, BranchTbl tbl=nullptr);
01389 SetVarBranch SET_VAR_CHB_MAX(BranchTbl tbl=nullptr);
01391 SetVarBranch SET_VAR_CHB_MAX(SetCHB c, BranchTbl tbl=nullptr);
01393 SetVarBranch SET_VAR_MIN_MIN(BranchTbl tbl=nullptr);
01395 SetVarBranch SET_VAR_MIN_MAX(BranchTbl tbl=nullptr);
01397 SetVarBranch SET_VAR_MAX_MIN(BranchTbl tbl=nullptr);
01399 SetVarBranch SET_VAR_MAX_MAX(BranchTbl tbl=nullptr);
01401 SetVarBranch SET_VAR_SIZE_MIN(BranchTbl tbl=nullptr);
01403 SetVarBranch SET_VAR_SIZE_MAX(BranchTbl tbl=nullptr);
01405 SetVarBranch SET_VAR_DEGREE_SIZE_MIN(BranchTbl tbl=nullptr);
01407 SetVarBranch SET_VAR_DEGREE_SIZE_MAX(BranchTbl tbl=nullptr);
01409 SetVarBranch SET_VAR_AFC_SIZE_MIN(double d=1.0, BranchTbl tbl=nullptr);
01411 SetVarBranch SET_VAR_AFC_SIZE_MIN(SetAFC a, BranchTbl tbl=nullptr);
01413 SetVarBranch SET_VAR_AFC_SIZE_MAX(double d=1.0, BranchTbl tbl=nullptr);
01415 SetVarBranch SET_VAR_AFC_SIZE_MAX(SetAFC a, BranchTbl tbl=nullptr);
01417 SetVarBranch SET_VAR_ACTION_SIZE_MIN(double d=1.0, BranchTbl tbl=nullptr);
01419 SetVarBranch SET_VAR_ACTION_SIZE_MIN(SetAction a, BranchTbl tbl=nullptr);
01421 SetVarBranch SET_VAR_ACTION_SIZE_MAX(double d=1.0, BranchTbl tbl=nullptr);
01423 SetVarBranch SET_VAR_ACTION_SIZE_MAX(SetAction a, BranchTbl tbl=nullptr);
01425 SetVarBranch SET_VAR_CHB_SIZE_MIN(BranchTbl tbl=nullptr);
01427 SetVarBranch SET_VAR_CHB_SIZE_MIN(SetCHB c, BranchTbl tbl=nullptr);
01429 SetVarBranch SET_VAR_CHB_SIZE_MAX(BranchTbl tbl=nullptr);
01431 SetVarBranch SET_VAR_CHB_SIZE_MAX(SetCHB c, BranchTbl tbl=nullptr);
01433
01434 }
01435
01436 #include <gecode/set/branch/var.hpp>
01437
01438 namespace Gecode {
01439
01445 class SetValBranch : public ValBranch<SetVar> {
01446 public:
01448 enum Select {
01449 SEL_MIN_INC,
01450 SEL_MIN_EXC,
01451 SEL_MED_INC,
01452 SEL_MED_EXC,
01453 SEL_MAX_INC,
01454 SEL_MAX_EXC,
01455 SEL_RND_INC,
01456 SEL_RND_EXC,
01457 SEL_VAL_COMMIT
01458 };
01459 protected:
01461 Select s;
01462 public:
01464 SetValBranch(Select s = SEL_MIN_INC);
01466 SetValBranch(Select s, Rnd r);
01468 SetValBranch(SetBranchVal v, SetBranchCommit c);
01470 Select select(void) const;
01471 };
01472
01478
01479 SetValBranch SET_VAL_MIN_INC(void);
01481 SetValBranch SET_VAL_MIN_EXC(void);
01483 SetValBranch SET_VAL_MED_INC(void);
01485 SetValBranch SET_VAL_MED_EXC(void);
01487 SetValBranch SET_VAL_MAX_INC(void);
01489 SetValBranch SET_VAL_MAX_EXC(void);
01491 SetValBranch SET_VAL_RND_INC(Rnd r);
01493 SetValBranch SET_VAL_RND_EXC(Rnd r);
01501 SetValBranch SET_VAL(SetBranchVal v, SetBranchCommit c=nullptr);
01503
01504 }
01505
01506 #include <gecode/set/branch/val.hpp>
01507
01508 namespace Gecode {
01509
01515 class SetAssign : public ValBranch<SetVar> {
01516 public:
01518 enum Select {
01519 SEL_MIN_INC,
01520 SEL_MIN_EXC,
01521 SEL_MED_INC,
01522 SEL_MED_EXC,
01523 SEL_MAX_INC,
01524 SEL_MAX_EXC,
01525 SEL_RND_INC,
01526 SEL_RND_EXC,
01527 SEL_VAL_COMMIT
01528 };
01529 protected:
01531 Select s;
01532 public:
01534 SetAssign(Select s = SEL_MIN_INC);
01536 SetAssign(Select s, Rnd r);
01538 SetAssign(SetBranchVal v, SetBranchCommit c);
01540 Select select(void) const;
01541 };
01542
01548
01549 SetAssign SET_ASSIGN_MIN_INC(void);
01551 SetAssign SET_ASSIGN_MIN_EXC(void);
01553 SetAssign SET_ASSIGN_MED_INC(void);
01555 SetAssign SET_ASSIGN_MED_EXC(void);
01557 SetAssign SET_ASSIGN_MAX_INC(void);
01559 SetAssign SET_ASSIGN_MAX_EXC(void);
01561 SetAssign SET_ASSIGN_RND_INC(Rnd r);
01563 SetAssign SET_ASSIGN_RND_EXC(Rnd r);
01570 SetAssign SET_ASSIGN(SetBranchVal v, SetBranchCommit c=nullptr);
01572
01573 }
01574
01575 #include <gecode/set/branch/assign.hpp>
01576
01577 namespace Gecode {
01578
01584 GECODE_SET_EXPORT void
01585 branch(Home home, const SetVarArgs& x,
01586 SetVarBranch vars, SetValBranch vals,
01587 SetBranchFilter bf=nullptr,
01588 SetVarValPrint vvp=nullptr);
01594 GECODE_SET_EXPORT void
01595 branch(Home home, const SetVarArgs& x,
01596 TieBreak<SetVarBranch> vars, SetValBranch vals,
01597 SetBranchFilter bf=nullptr,
01598 SetVarValPrint vvp=nullptr);
01604 GECODE_SET_EXPORT void
01605 branch(Home home, SetVar x, SetValBranch vals,
01606 SetVarValPrint vvp=nullptr);
01612 GECODE_SET_EXPORT void
01613 assign(Home home, const SetVarArgs& x, SetAssign vals,
01614 SetBranchFilter bf=nullptr,
01615 SetVarValPrint vvp=nullptr);
01621 GECODE_SET_EXPORT void
01622 assign(Home home, SetVar x, SetAssign vals,
01623 SetVarValPrint vvp=nullptr);
01624
01625 }
01626
01627
01628 namespace Gecode {
01630 GECODE_SET_EXPORT SymmetryHandle VariableSymmetry(const SetVarArgs& x);
01636 GECODE_SET_EXPORT
01637 SymmetryHandle VariableSequenceSymmetry(const SetVarArgs& x, int ss);
01644 GECODE_SET_EXPORT void
01645 branch(Home home, const SetVarArgs& x,
01646 SetVarBranch vars, SetValBranch vals,
01647 const Symmetries& syms,
01648 SetBranchFilter bf=nullptr,
01649 SetVarValPrint vvp=nullptr);
01656 GECODE_SET_EXPORT void
01657 branch(Home home, const SetVarArgs& x,
01658 TieBreak<SetVarBranch> vars, SetValBranch vals,
01659 const Symmetries& syms,
01660 SetBranchFilter bf=nullptr,
01661 SetVarValPrint vvp=nullptr);
01662 }
01663
01664 namespace Gecode {
01665
01666
01667
01668
01669
01670
01671
01672
01673
01674
01675
01676
01677
01678
01679
01680
01681
01682
01683
01684
01685
01686
01687 GECODE_SET_EXPORT void
01688 relax(Home home, const SetVarArgs& x, const SetVarArgs& sx,
01689 Rnd r, double p);
01690
01691 }
01692
01693 #include <gecode/set/trace/trace-view.hpp>
01694
01695 namespace Gecode {
01696
01706 class SetTraceDelta {
01707 protected:
01709 public:
01711 class Glb
01712 : public Iter::Ranges::Diff<Set::GlbRanges<Set::SetView>,
01713 Iter::Ranges::RangeList> {
01714 protected:
01716 Iter::Ranges::RangeList o;
01718 Set::GlbRanges<Set::SetView> n;
01719 public:
01721
01722
01723 Glb(RangeList* o, Set::SetView n);
01725 };
01726 Glb _glb;
01728 class Lub
01729 : public Iter::Ranges::Diff<Iter::Ranges::RangeList,
01730 Set::LubRanges<Set::SetView> > {
01731 protected:
01733 Iter::Ranges::RangeList o;
01735 Set::LubRanges<Set::SetView> n;
01736 public:
01738
01739
01740 Lub(RangeList* o, Set::SetView n);
01742 };
01743 Lub _lub;
01745
01746
01747 SetTraceDelta(Set::SetTraceView o, Set::SetView n, const Delta& d);
01749
01750
01751
01752 Glb& glb(void);
01754 Lub& lub(void);
01756 };
01757
01758 }
01759
01760 #include <gecode/set/trace/delta.hpp>
01761
01762 #include <gecode/set/trace/traits.hpp>
01763
01764 namespace Gecode {
01765
01770 typedef ViewTracer<Set::SetView> SetTracer;
01775 typedef ViewTraceRecorder<Set::SetView> SetTraceRecorder;
01776
01781 class GECODE_SET_EXPORT StdSetTracer : public SetTracer {
01782 protected:
01784 std::ostream& os;
01785 public:
01787 StdSetTracer(std::ostream& os0 = std::cerr);
01789 virtual void init(const Space& home, const SetTraceRecorder& t);
01791 virtual void prune(const Space& home, const SetTraceRecorder& t,
01792 const ViewTraceInfo& vti, int i, SetTraceDelta& d);
01794 virtual void fix(const Space& home, const SetTraceRecorder& t);
01796 virtual void fail(const Space& home, const SetTraceRecorder& t);
01798 virtual void done(const Space& home, const SetTraceRecorder& t);
01800 static StdSetTracer def;
01801 };
01802
01803
01808 GECODE_SET_EXPORT void
01809 trace(Home home, const SetVarArgs& x,
01810 TraceFilter tf,
01811 int te = (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE),
01812 SetTracer& t = StdSetTracer::def);
01817 void
01818 trace(Home home, const SetVarArgs& x,
01819 int te = (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE),
01820 SetTracer& t = StdSetTracer::def);
01821
01822 }
01823
01824 #include <gecode/set/trace.hpp>
01825
01826 #endif
01827
01828
01829