Generated on Fri Mar 20 15:56:19 2015 for Gecode by doxygen 1.6.3

set.hh

Go to the documentation of this file.
00001 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
00002 /*
00003  *  Main authors:
00004  *     Guido Tack <tack@gecode.org>
00005  *     Christian Schulte <schulte@gecode.org>
00006  *
00007  *  Contributing authors:
00008  *     Gabor Szokoli <szokoli@gecode.org>
00009  *
00010  *  Copyright:
00011  *     Guido Tack, 2004
00012  *     Christian Schulte, 2004
00013  *     Gabor Szokoli, 2004
00014  *
00015  *  Last modified:
00016  *     $Date: 2014-04-28 20:54:50 +0200 (Mon, 28 Apr 2014) $ by $Author: schulte $
00017  *     $Revision: 14116 $
00018  *
00019  *  This file is part of Gecode, the generic constraint
00020  *  development environment:
00021  *     http://www.gecode.org
00022  *
00023  *  Permission is hereby granted, free of charge, to any person obtaining
00024  *  a copy of this software and associated documentation files (the
00025  *  "Software"), to deal in the Software without restriction, including
00026  *  without limitation the rights to use, copy, modify, merge, publish,
00027  *  distribute, sublicense, and/or sell copies of the Software, and to
00028  *  permit persons to whom the Software is furnished to do so, subject to
00029  *  the following conditions:
00030  *
00031  *  The above copyright notice and this permission notice shall be
00032  *  included in all copies or substantial portions of the Software.
00033  *
00034  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00035  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00036  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00037  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00038  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00039  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00040  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00041  *
00042  */
00043 
00044 #ifndef __GECODE_SET_HH__
00045 #define __GECODE_SET_HH__
00046 
00047 #include <gecode/kernel.hh>
00048 #include <gecode/int.hh>
00049 #include <gecode/iter.hh>
00050 
00051 /*
00052  * Configure linking
00053  *
00054  */
00055 #if !defined(GECODE_STATIC_LIBS) && \
00056     (defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER))
00057 
00058 #ifdef GECODE_BUILD_SET
00059 #define GECODE_SET_EXPORT __declspec( dllexport )
00060 #else
00061 #define GECODE_SET_EXPORT __declspec( dllimport )
00062 #endif
00063 
00064 #else
00065 
00066 #ifdef GECODE_GCC_HAS_CLASS_VISIBILITY
00067 #define GECODE_SET_EXPORT __attribute__ ((visibility("default")))
00068 #else
00069 #define GECODE_SET_EXPORT
00070 #endif
00071 
00072 #endif
00073 
00074 // Configure auto-linking
00075 #ifndef GECODE_BUILD_SET
00076 #define GECODE_LIBRARY_NAME "Set"
00077 #include <gecode/support/auto-link.hpp>
00078 #endif
00079 
00080 
00092 #include <gecode/set/exception.hpp>
00093 
00094 namespace Gecode { namespace Set {
00095 
00097   namespace Limits {
00099     const int max = (Gecode::Int::Limits::max / 2) - 1;
00101     const int min = -max;
00103     const unsigned int card = max-min+1;
00105     void check(int n, const char* l);
00107     void check(unsigned int n, const char* l);
00109     void check(const IntSet& s, const char* l);
00110   }
00111 
00112 }}
00113 
00114 #include <gecode/set/limits.hpp>
00115 
00116 #include <gecode/set/var-imp.hpp>
00117 
00118 namespace Gecode {
00119 
00120   namespace Set {
00121     class SetView;
00122   }
00123 
00129   class SetVar : public VarImpVar<Set::SetVarImp> {
00130     friend class SetVarArray;
00131     friend class SetVarArgs;
00132     using VarImpVar<Set::SetVarImp>::x;
00133   public:
00135 
00136 
00137     SetVar(void);
00139     SetVar(const SetVar& y);
00141     SetVar(const Set::SetView& y);
00142 
00144     GECODE_SET_EXPORT SetVar(Space& home);
00145 
00163     GECODE_SET_EXPORT
00164     SetVar(Space& home,int glbMin,int glbMax,int lubMin,int lubMax,
00165            unsigned int cardMin = 0,
00166            unsigned int cardMax = Set::Limits::card);
00167 
00184     GECODE_SET_EXPORT
00185     SetVar(Space& home,const IntSet& glbD,int lubMin,int lubMax,
00186            unsigned int cardMin = 0,
00187            unsigned int cardMax = Set::Limits::card);
00188 
00206     GECODE_SET_EXPORT
00207     SetVar(Space& home,int glbMin,int glbMax,const IntSet& lubD,
00208            unsigned int cardMin = 0,
00209            unsigned int cardMax = Set::Limits::card);
00210 
00228     GECODE_SET_EXPORT
00229     SetVar(Space& home,const IntSet& glbD,const IntSet& lubD,
00230            unsigned int cardMin = 0,
00231            unsigned int cardMax = Set::Limits::card);
00233 
00235 
00236 
00237     unsigned int glbSize(void) const;
00239     unsigned int lubSize(void) const;
00241     unsigned int unknownSize(void) const;
00243     unsigned int cardMin(void) const;
00245     unsigned int cardMax(void) const;
00247     int lubMin(void) const;
00249     int lubMax(void) const;
00251     int glbMin(void) const;
00253     int glbMax(void) const;
00255 
00257 
00258 
00259     bool contains(int i) const;
00261     bool notContains(int i) const;
00263   };
00264 
00270 
00272   class SetVarGlbRanges {
00273   private:
00274     Set::GlbRanges<Set::SetVarImp*> iter;
00275   public:
00277 
00278 
00279     SetVarGlbRanges(void);
00281     SetVarGlbRanges(const SetVar& x);
00283 
00285 
00286 
00287     bool operator ()(void) const;
00289     void operator ++(void);
00291 
00293 
00294 
00295     int min(void) const;
00297     int max(void) const;
00299     unsigned int width(void) const;
00301   };
00302 
00304   class SetVarLubRanges {
00305   private:
00306     Set::LubRanges<Set::SetVarImp*> iter;
00307   public:
00309 
00310 
00311     SetVarLubRanges(void);
00313     SetVarLubRanges(const SetVar& x);
00315 
00317 
00318 
00319     bool operator ()(void) const;
00321     void operator ++(void);
00323 
00325 
00326 
00327     int min(void) const;
00329     int max(void) const;
00331     unsigned int width(void) const;
00333   };
00334 
00336   class SetVarUnknownRanges {
00337   private:
00338     Set::UnknownRanges<Set::SetVarImp*> iter;
00339   public:
00341 
00342 
00343     SetVarUnknownRanges(void);
00345     SetVarUnknownRanges(const SetVar& x);
00347 
00349 
00350 
00351     bool operator ()(void) const;
00353     void operator ++(void);
00355 
00357 
00358 
00359     int min(void) const;
00361     int max(void) const;
00363     unsigned int width(void) const;
00365   };
00366 
00368   class SetVarGlbValues {
00369   private:
00370     Iter::Ranges::ToValues<SetVarGlbRanges> iter;
00371   public:
00373 
00374 
00375     SetVarGlbValues(void);
00377     SetVarGlbValues(const SetVar& x);
00379 
00381 
00382 
00383     bool operator ()(void) const;
00385     void operator ++(void);
00387 
00389 
00390 
00391     int  val(void) const;
00393   };
00394 
00396   class SetVarLubValues {
00397   private:
00398     Iter::Ranges::ToValues<SetVarLubRanges> iter;
00399   public:
00401 
00402 
00403     SetVarLubValues(void);
00405     SetVarLubValues(const SetVar& x);
00407 
00409 
00410 
00411     bool operator ()(void) const;
00413     void operator ++(void);
00415 
00417 
00418 
00419     int  val(void) const;
00421   };
00422 
00424   class SetVarUnknownValues {
00425   private:
00426     Iter::Ranges::ToValues<SetVarUnknownRanges> iter;
00427   public:
00429 
00430 
00431     SetVarUnknownValues(void);
00433     SetVarUnknownValues(const SetVar& x);
00435 
00437 
00438 
00439     bool operator ()(void) const;
00441     void operator ++(void);
00443 
00445 
00446 
00447     int  val(void) const;
00449   };
00450 
00452 
00457   template<class Char, class Traits>
00458   std::basic_ostream<Char,Traits>&
00459   operator <<(std::basic_ostream<Char,Traits>& os, const SetVar& x);
00460 
00461 }
00462 
00463 #include <gecode/set/view.hpp>
00464 
00465 namespace Gecode {
00475 
00476 }
00477 
00478 #include <gecode/set/array-traits.hpp>
00479 
00480 namespace Gecode {
00481 
00490   class SetVarArgs : public VarArgArray<SetVar> {
00491   public:
00493 
00494 
00495     SetVarArgs(void) {}
00497     explicit SetVarArgs(int n) : VarArgArray<SetVar>(n) {}
00499     SetVarArgs(const SetVarArgs& a) : VarArgArray<SetVar>(a) {}
00501     SetVarArgs(const VarArray<SetVar>& a) : VarArgArray<SetVar>(a) {}
00503     SetVarArgs(const std::vector<SetVar>& a) : VarArgArray<SetVar>(a) {}
00505     template<class InputIterator>
00506     SetVarArgs(InputIterator first, InputIterator last)
00507     : VarArgArray<SetVar>(first,last) {}
00514     GECODE_SET_EXPORT
00515     SetVarArgs(Space& home,int n,int glbMin,int glbMax,
00516                int lubMin,int lubMax,
00517                unsigned int minCard = 0,
00518                unsigned int maxCard = Set::Limits::card);
00525     GECODE_SET_EXPORT
00526     SetVarArgs(Space& home,int n,const IntSet& glb,
00527                int lubMin, int lubMax,
00528                unsigned int minCard = 0,
00529                unsigned int maxCard = Set::Limits::card);
00536     GECODE_SET_EXPORT
00537     SetVarArgs(Space& home,int n,int glbMin,int glbMax,
00538                const IntSet& lub,
00539                unsigned int minCard = 0,
00540                unsigned int maxCard = Set::Limits::card);
00547     GECODE_SET_EXPORT
00548     SetVarArgs(Space& home,int n,
00549                const IntSet& glb,const IntSet& lub,
00550                unsigned int minCard = 0,
00551                unsigned int maxCard = Set::Limits::card);
00553   };
00555 
00571   class SetVarArray : public VarArray<SetVar> {
00572   public:
00574 
00575 
00576     SetVarArray(void);
00578     SetVarArray(const SetVarArray&);
00580     SetVarArray(Space& home, const SetVarArgs&);
00582     GECODE_SET_EXPORT SetVarArray(Space& home, int n);
00589     GECODE_SET_EXPORT
00590     SetVarArray(Space& home,int n,int glbMin,int glbMax,int lubMin,int lubMax,
00591                 unsigned int minCard = 0,
00592                 unsigned int maxCard = Set::Limits::card);
00599     GECODE_SET_EXPORT
00600     SetVarArray(Space& home,int n,const IntSet& glb, int lubMin, int lubMax,
00601                 unsigned int minCard = 0,
00602                 unsigned int maxCard = Set::Limits::card);
00609     GECODE_SET_EXPORT
00610     SetVarArray(Space& home,int n,int glbMin,int glbMax,const IntSet& lub,
00611                 unsigned int minCard = 0,
00612                 unsigned int maxCard = Set::Limits::card);
00619     GECODE_SET_EXPORT
00620     SetVarArray(Space& home,int n,
00621                 const IntSet& glb,const IntSet& lub,
00622                 unsigned int minCard = 0,
00623                 unsigned int maxCard = Set::Limits::card);
00625   };
00626 
00627 }
00628 
00629 #include <gecode/set/array.hpp>
00630 
00631 namespace Gecode {
00632 
00644   enum SetRelType {
00645     SRT_EQ,   
00646     SRT_NQ,   
00647     SRT_SUB,  
00648     SRT_SUP,  
00649     SRT_DISJ, 
00650     SRT_CMPL, 
00651     SRT_LQ,   
00652     SRT_LE,   
00653     SRT_GQ,   
00654     SRT_GR    
00655   };
00656 
00661   enum SetOpType {
00662     SOT_UNION,  
00663     SOT_DUNION, 
00664     SOT_INTER,  
00665     SOT_MINUS   
00666   };
00667 
00675 
00677   GECODE_SET_EXPORT void
00678   dom(Home home, SetVar x, SetRelType r, int i);
00680   GECODE_SET_EXPORT void
00681   dom(Home home, const SetVarArgs& x, SetRelType r, int i);
00683   GECODE_SET_EXPORT void
00684   dom(Home home, SetVar x, SetRelType r, int i, int j);
00686   GECODE_SET_EXPORT void
00687   dom(Home home, const SetVarArgs& x, SetRelType r, int i, int j);
00689   GECODE_SET_EXPORT void
00690   dom(Home home, SetVar x, SetRelType r, const IntSet& s);
00692   GECODE_SET_EXPORT void
00693   dom(Home home, const SetVarArgs& x, SetRelType r, const IntSet& s);
00695   GECODE_SET_EXPORT void
00696   cardinality(Home home, SetVar x, unsigned int i, unsigned int j);
00698   GECODE_SET_EXPORT void
00699   cardinality(Home home, const SetVarArgs& x, unsigned int i, unsigned int j);
00701   GECODE_SET_EXPORT void
00702   dom(Home home, SetVar x, SetRelType rt, int i, Reify r);
00704   GECODE_SET_EXPORT void
00705   dom(Home home, SetVar x, SetRelType rt, int i, int j, Reify r);
00707   GECODE_SET_EXPORT void
00708   dom(Home home, SetVar x, SetRelType rt, const IntSet& s, Reify r);
00710   GECODE_SET_EXPORT void
00711   dom(Home home, SetVar x, SetVar d);
00713   GECODE_SET_EXPORT void
00714   dom(Home home, const SetVarArgs& x, const SetVarArgs& d);
00716 
00717 
00725 
00727   GECODE_SET_EXPORT void
00728   rel(Home home, SetVar x, SetRelType r, SetVar y);
00729 
00731   GECODE_SET_EXPORT void
00732   rel(Home home, SetVar x, SetRelType rt, SetVar y, Reify r);
00733 
00735   GECODE_SET_EXPORT void
00736   rel(Home home, SetVar s, SetRelType r, IntVar x);
00737 
00739   GECODE_SET_EXPORT void
00740   rel(Home home, IntVar x, SetRelType r, SetVar s);
00741 
00743   GECODE_SET_EXPORT void
00744   rel(Home home, SetVar s, SetRelType rt, IntVar x, Reify r);
00745 
00747   GECODE_SET_EXPORT void
00748   rel(Home home, IntVar x, SetRelType rt, SetVar s, Reify r);
00749 
00751   GECODE_SET_EXPORT void
00752   rel(Home home, SetVar s, IntRelType r, IntVar x);
00753 
00755   GECODE_SET_EXPORT void
00756   rel(Home home, IntVar x, IntRelType r, SetVar s);
00757 
00759 
00767 
00769   GECODE_SET_EXPORT void
00770   rel(Home home, SetVar x, SetOpType op, SetVar y, SetRelType r, SetVar z);
00771 
00773   GECODE_SET_EXPORT void
00774   rel(Home home, SetOpType op, const SetVarArgs& x, SetVar y);
00775 
00777   GECODE_SET_EXPORT void
00778   rel(Home home, SetOpType op, const SetVarArgs& x, const IntSet& z, SetVar y);
00779 
00781   GECODE_SET_EXPORT void
00782   rel(Home home, SetOpType op, const IntVarArgs& x, const IntSet& z, SetVar y);
00783 
00785   GECODE_SET_EXPORT void
00786   rel(Home home, SetOpType op, const IntVarArgs& x, SetVar y);
00787 
00789   GECODE_SET_EXPORT void
00790   rel(Home home, const IntSet& x, SetOpType op, SetVar y,
00791       SetRelType r, SetVar z);
00792 
00794   GECODE_SET_EXPORT void
00795   rel(Home home, SetVar x, SetOpType op, const IntSet& y,
00796       SetRelType r, SetVar z);
00797 
00799   GECODE_SET_EXPORT void
00800   rel(Home home, SetVar x, SetOpType op, SetVar y,
00801       SetRelType r, const IntSet& z);
00802 
00804   GECODE_SET_EXPORT void
00805   rel(Home home, const IntSet& x, SetOpType op, SetVar y, SetRelType r,
00806       const IntSet& z);
00807 
00809   GECODE_SET_EXPORT void
00810   rel(Home home, SetVar x, SetOpType op, const IntSet& y, SetRelType r,
00811       const IntSet& z);
00812 
00814 
00815 
00822 
00824   GECODE_SET_EXPORT void
00825   convex(Home home, SetVar x);
00826 
00828   GECODE_SET_EXPORT void
00829   convex(Home home, SetVar x, SetVar y);
00830 
00832 
00839 
00841   GECODE_SET_EXPORT void
00842   sequence(Home home, const SetVarArgs& x);
00843 
00845   GECODE_SET_EXPORT void
00846   sequence(Home home, const SetVarArgs& y, SetVar x);
00847 
00849 
00856 
00857 
00859   GECODE_SET_EXPORT void
00860   atmostOne(Home home, const SetVarArgs& x, unsigned int c);
00861 
00863 
00871 
00874   GECODE_SET_EXPORT void
00875   min(Home home, SetVar s, IntVar x);
00876 
00879   GECODE_SET_EXPORT void
00880   notMin(Home home, SetVar s, IntVar x);
00881 
00884   GECODE_SET_EXPORT void
00885   min(Home home, SetVar s, IntVar x, Reify r);
00886 
00889   GECODE_SET_EXPORT void
00890   max(Home home, SetVar s, IntVar x);
00891 
00894   GECODE_SET_EXPORT void
00895   notMax(Home home, SetVar s, IntVar x);
00896 
00899   GECODE_SET_EXPORT void
00900   max(Home home, SetVar s, IntVar x, Reify r);
00901 
00903   GECODE_SET_EXPORT void
00904   cardinality(Home home, SetVar s, IntVar x);
00905 
00916   GECODE_SET_EXPORT void
00917   weights(Home home, IntSharedArray elements, IntSharedArray weights,
00918           SetVar x, IntVar y);
00919 
00921 
00929 
00931   GECODE_SET_EXPORT void
00932   channel(Home home, const IntVarArgs& x,const SetVarArgs& y);
00933 
00935   GECODE_SET_EXPORT void
00936   channelSorted(Home home, const IntVarArgs& x, SetVar y);
00937 
00939   GECODE_SET_EXPORT void
00940   channel(Home home, const BoolVarArgs& x, SetVar y);
00941 
00943   GECODE_SET_EXPORT void
00944   channel(Home home, const SetVarArgs& x, const SetVarArgs& y);
00945 
00947 
00959   GECODE_SET_EXPORT void
00960   precede(Home home, const SetVarArgs& x, int s, int t);
00964   GECODE_SET_EXPORT void
00965   precede(Home home, const SetVarArgs& x, const IntArgs& c);
00966 
00980 
00990   GECODE_SET_EXPORT void
00991   element(Home home, SetOpType op, const SetVarArgs& x, SetVar y, SetVar z,
00992     const IntSet& u = IntSet(Set::Limits::min,Set::Limits::max));
00993 
01003   GECODE_SET_EXPORT void
01004   element(Home home, SetOpType op, const IntVarArgs& x, SetVar y, SetVar z,
01005           const IntSet& u = IntSet(Set::Limits::min,Set::Limits::max));
01006 
01016   GECODE_SET_EXPORT void
01017   element(Home home, SetOpType op, const IntSetArgs& x, SetVar y, SetVar z,
01018           const IntSet& u = IntSet(Set::Limits::min,Set::Limits::max));
01019 
01029   GECODE_SET_EXPORT void
01030   element(Home home, SetOpType op, const IntArgs& x, SetVar y, SetVar z,
01031           const IntSet& u = IntSet(Set::Limits::min,Set::Limits::max));
01032 
01038   GECODE_SET_EXPORT void
01039   element(Home home, const SetVarArgs& x, IntVar y, SetVar z);
01040 
01046   GECODE_SET_EXPORT void
01047   element(Home home, const IntSetArgs& s, IntVar y, SetVar z);
01048 
01054   GECODE_SET_EXPORT void
01055   element(Home home, const IntSetArgs& a, 
01056           IntVar x, int w, IntVar y, int h, SetVar z);
01062   GECODE_SET_EXPORT void
01063   element(Home home, const SetVarArgs& a, 
01064           IntVar x, int w, IntVar y, int h, SetVar z);
01066 
01077 
01078   GECODE_SET_EXPORT void
01079   wait(Home home, SetVar x, void (*c)(Space& home));
01081   GECODE_SET_EXPORT void
01082   wait(Home home, const SetVarArgs& x, void (*c)(Space& home));
01084 
01085 }
01086 
01087 namespace Gecode {
01088 
01102   typedef bool (*SetBranchFilter)(const Space& home, SetVar x, int i);
01103 
01114   typedef double (*SetBranchMerit)(const Space& home, SetVar x, int i);
01115 
01126   typedef int (*SetBranchVal)(const Space& home, SetVar x, int i);
01127 
01139   typedef void (*SetBranchCommit)(Space& home, unsigned int a,
01140                                   SetVar x, int i, int n);
01141 
01142 }
01143 
01144 #include <gecode/set/branch/traits.hpp>
01145 
01146 namespace Gecode {
01147 
01153   class SetAFC : public AFC {
01154   public:
01162     SetAFC(void);
01164     SetAFC(const SetAFC& a);
01166     SetAFC& operator =(const SetAFC& a);      
01168     SetAFC(Home home, const SetVarArgs& x, double d=1.0);
01176     void init(Home, const SetVarArgs& x, double d=1.0);
01177   };
01178 
01179 }
01180 
01181 #include <gecode/set/branch/afc.hpp>
01182 
01183 namespace Gecode {
01184 
01185 
01191   class SetActivity : public Activity {
01192   public:
01200     SetActivity(void);
01202     SetActivity(const SetActivity& a);
01204     SetActivity& operator =(const SetActivity& a);      
01213     GECODE_SET_EXPORT 
01214     SetActivity(Home home, const SetVarArgs& x, double d=1.0,
01215                 SetBranchMerit bm=NULL);
01227     GECODE_SET_EXPORT void
01228     init(Home, const SetVarArgs& x, double d=1.0,
01229          SetBranchMerit bm=NULL);
01230   };
01231 
01232 }
01233 
01234 #include <gecode/set/branch/activity.hpp>
01235 
01236 namespace Gecode {
01237 
01239   typedef void (*SetVarValPrint)(const Space &home, const BrancherHandle& bh,
01240                                  unsigned int a,
01241                                  SetVar x, int i, const int& n,
01242                                  std::ostream& o);
01243 
01244 }
01245 
01246 namespace Gecode {
01247 
01253   class SetVarBranch : public VarBranch {
01254   public:
01256     enum Select {
01257       SEL_NONE = 0,        
01258       SEL_RND,             
01259       SEL_MERIT_MIN,       
01260       SEL_MERIT_MAX,       
01261       SEL_DEGREE_MIN,      
01262       SEL_DEGREE_MAX,      
01263       SEL_AFC_MIN,         
01264       SEL_AFC_MAX,         
01265       SEL_ACTIVITY_MIN,    
01266       SEL_ACTIVITY_MAX,    
01267       SEL_MIN_MIN,         
01268       SEL_MIN_MAX,         
01269       SEL_MAX_MIN,         
01270       SEL_MAX_MAX,         
01271       SEL_SIZE_MIN,        
01272       SEL_SIZE_MAX,        
01273       SEL_DEGREE_SIZE_MIN, 
01274       SEL_DEGREE_SIZE_MAX, 
01275       SEL_AFC_SIZE_MIN,    
01276       SEL_AFC_SIZE_MAX,    
01277       SEL_ACTIVITY_SIZE_MIN, 
01278       SEL_ACTIVITY_SIZE_MAX  
01279     };
01280   protected:
01282     Select s;
01283   public:
01285     SetVarBranch(void);
01287     SetVarBranch(Rnd r);
01289     SetVarBranch(Select s, BranchTbl t);
01291     SetVarBranch(Select s, double d, BranchTbl t);
01293     SetVarBranch(Select s, AFC a, BranchTbl t);
01295     SetVarBranch(Select s, Activity a, BranchTbl t);
01297     SetVarBranch(Select s, VoidFunction mf, BranchTbl t);
01299     Select select(void) const;
01301     void expand(Home home, const SetVarArgs& x);
01302   };
01303 
01309 
01310   SetVarBranch SET_VAR_NONE(void);
01312   SetVarBranch SET_VAR_RND(Rnd r);
01314   SetVarBranch SET_VAR_MERIT_MIN(SetBranchMerit bm, BranchTbl tbl=NULL);
01316   SetVarBranch SET_VAR_MERIT_MAX(SetBranchMerit bm, BranchTbl tbl=NULL);
01318   SetVarBranch SET_VAR_DEGREE_MIN(BranchTbl tbl=NULL);
01320   SetVarBranch SET_VAR_DEGREE_MAX(BranchTbl tbl=NULL);
01322   SetVarBranch SET_VAR_AFC_MIN(double d=1.0, BranchTbl tbl=NULL);
01324   SetVarBranch SET_VAR_AFC_MIN(SetAFC a, BranchTbl tbl=NULL);
01326   SetVarBranch SET_VAR_AFC_MAX(double d=1.0, BranchTbl tbl=NULL);
01328   SetVarBranch SET_VAR_AFC_MAX(SetAFC a, BranchTbl tbl=NULL);
01330   SetVarBranch SET_VAR_ACTIVITY_MIN(double d=1.0, BranchTbl tbl=NULL);    
01332   SetVarBranch SET_VAR_ACTIVITY_MIN(SetActivity a, BranchTbl tbl=NULL);    
01334   SetVarBranch SET_VAR_ACTIVITY_MAX(double d=1.0, BranchTbl tbl=NULL);     
01336   SetVarBranch SET_VAR_ACTIVITY_MAX(SetActivity a, BranchTbl tbl=NULL);     
01338   SetVarBranch SET_VAR_MIN_MIN(BranchTbl tbl=NULL);         
01340   SetVarBranch SET_VAR_MIN_MAX(BranchTbl tbl=NULL);
01342   SetVarBranch SET_VAR_MAX_MIN(BranchTbl tbl=NULL); 
01344   SetVarBranch SET_VAR_MAX_MAX(BranchTbl tbl=NULL);
01346   SetVarBranch SET_VAR_SIZE_MIN(BranchTbl tbl=NULL);
01348   SetVarBranch SET_VAR_SIZE_MAX(BranchTbl tbl=NULL);
01350   SetVarBranch SET_VAR_DEGREE_SIZE_MIN(BranchTbl tbl=NULL);
01352   SetVarBranch SET_VAR_DEGREE_SIZE_MAX(BranchTbl tbl=NULL);
01354   SetVarBranch SET_VAR_AFC_SIZE_MIN(double d=1.0, BranchTbl tbl=NULL);
01356   SetVarBranch SET_VAR_AFC_SIZE_MIN(SetAFC a, BranchTbl tbl=NULL);
01358   SetVarBranch SET_VAR_AFC_SIZE_MAX(double d=1.0, BranchTbl tbl=NULL);
01360   SetVarBranch SET_VAR_AFC_SIZE_MAX(SetAFC a, BranchTbl tbl=NULL);
01362   SetVarBranch SET_VAR_ACTIVITY_SIZE_MIN(double d=1.0, BranchTbl tbl=NULL);
01364   SetVarBranch SET_VAR_ACTIVITY_SIZE_MIN(SetActivity a, BranchTbl tbl=NULL);
01366   SetVarBranch SET_VAR_ACTIVITY_SIZE_MAX(double d=1.0, BranchTbl tbl=NULL);
01368   SetVarBranch SET_VAR_ACTIVITY_SIZE_MAX(SetActivity a, BranchTbl tbl=NULL);
01370 
01371 }
01372 
01373 #include <gecode/set/branch/var.hpp>
01374 
01375 namespace Gecode {
01376 
01382   class SetValBranch : public ValBranch {
01383   public:
01385     enum Select {
01386       SEL_MIN_INC,   
01387       SEL_MIN_EXC,   
01388       SEL_MED_INC,   
01389       SEL_MED_EXC,   
01390       SEL_MAX_INC,   
01391       SEL_MAX_EXC,   
01392       SEL_RND_INC,   
01393       SEL_RND_EXC,   
01394       SEL_VAL_COMMIT 
01395     };
01396   protected:
01398     Select s;
01399   public:
01401     SetValBranch(Select s = SEL_MIN_INC);
01403     SetValBranch(Select s, Rnd r);
01405     SetValBranch(VoidFunction v, VoidFunction c);
01407     Select select(void) const;
01408   };
01409 
01415 
01416   SetValBranch SET_VAL_MIN_INC(void);
01418   SetValBranch SET_VAL_MIN_EXC(void);
01420   SetValBranch SET_VAL_MED_INC(void);
01422   SetValBranch SET_VAL_MED_EXC(void);
01424   SetValBranch SET_VAL_MAX_INC(void);
01426   SetValBranch SET_VAL_MAX_EXC(void);
01428   SetValBranch SET_VAL_RND_INC(Rnd r);
01430   SetValBranch SET_VAL_RND_EXC(Rnd r);
01438   SetValBranch SET_VAL(SetBranchVal v, SetBranchCommit c=NULL);
01440 
01441 }
01442 
01443 #include <gecode/set/branch/val.hpp>
01444 
01445 namespace Gecode {
01446 
01452   class SetAssign : public ValBranch {
01453   public:
01455     enum Select {
01456       SEL_MIN_INC,   
01457       SEL_MIN_EXC,   
01458       SEL_MED_INC,   
01459       SEL_MED_EXC,   
01460       SEL_MAX_INC,   
01461       SEL_MAX_EXC,   
01462       SEL_RND_INC,   
01463       SEL_RND_EXC,   
01464       SEL_VAL_COMMIT 
01465     };
01466   protected:
01468     Select s;
01469   public:
01471     SetAssign(Select s = SEL_MIN_INC);
01473     SetAssign(Select s, Rnd r);
01475     SetAssign(VoidFunction v, VoidFunction c);
01477     Select select(void) const;
01478   };
01479 
01485 
01486   SetAssign SET_ASSIGN_MIN_INC(void);
01488   SetAssign SET_ASSIGN_MIN_EXC(void);
01490   SetAssign SET_ASSIGN_MED_INC(void);
01492   SetAssign SET_ASSIGN_MED_EXC(void);
01494   SetAssign SET_ASSIGN_MAX_INC(void);
01496   SetAssign SET_ASSIGN_MAX_EXC(void);
01498   SetAssign SET_ASSIGN_RND_INC(Rnd r);
01500   SetAssign SET_ASSIGN_RND_EXC(Rnd r);
01507   SetAssign SET_ASSIGN(SetBranchVal v, SetBranchCommit c=NULL);
01509 
01510 }
01511 
01512 #include <gecode/set/branch/assign.hpp>
01513 
01514 namespace Gecode {
01515 
01521   GECODE_SET_EXPORT BrancherHandle
01522   branch(Home home, const SetVarArgs& x,
01523          SetVarBranch vars, SetValBranch vals, 
01524          SetBranchFilter bf=NULL,
01525          SetVarValPrint vvp=NULL);
01531   GECODE_SET_EXPORT BrancherHandle
01532   branch(Home home, const SetVarArgs& x,
01533          TieBreak<SetVarBranch> vars, SetValBranch vals,
01534          SetBranchFilter bf=NULL,
01535          SetVarValPrint vvp=NULL);
01541   GECODE_SET_EXPORT BrancherHandle
01542   branch(Home home, SetVar x, SetValBranch vals,
01543          SetVarValPrint vvp=NULL);
01549   GECODE_SET_EXPORT BrancherHandle
01550   assign(Home home, const SetVarArgs& x, SetAssign vals,
01551          SetBranchFilter bf=NULL,
01552          SetVarValPrint vvp=NULL);
01558   GECODE_SET_EXPORT BrancherHandle
01559   assign(Home home, SetVar x, SetAssign vals,
01560          SetVarValPrint vvp=NULL);
01561 
01562 }
01563 
01564 // LDSB-related declarations.
01565 namespace Gecode {
01567   GECODE_SET_EXPORT SymmetryHandle VariableSymmetry(const SetVarArgs& x);
01573   GECODE_SET_EXPORT
01574   SymmetryHandle VariableSequenceSymmetry(const SetVarArgs& x, int ss);
01581   GECODE_SET_EXPORT BrancherHandle
01582   branch(Home home, const SetVarArgs& x,
01583          SetVarBranch vars, SetValBranch vals,
01584          const Symmetries& syms,
01585          SetBranchFilter bf=NULL,
01586          SetVarValPrint vvp=NULL);
01593   GECODE_SET_EXPORT BrancherHandle
01594   branch(Home home, const SetVarArgs& x,
01595          TieBreak<SetVarBranch> vars, SetValBranch vals,
01596          const Symmetries& syms, 
01597          SetBranchFilter bf=NULL,
01598          SetVarValPrint vvp=NULL);
01599 }
01600 
01601 #endif
01602 
01603 // IFDEF: GECODE_HAS_SET_VARS
01604 // STATISTICS: set-post