Generated on Tue May 22 09:39:53 2018 for Gecode by doxygen 1.6.3

int.hh

Go to the documentation of this file.
00001 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
00002 /*
00003  *  Main authors:
00004  *     Christian Schulte <schulte@gecode.org>
00005  *     Guido Tack <tack@gecode.org>
00006  *
00007  *  Contributing authors:
00008  *     Stefano Gualandi <stefano.gualandi@gmail.com>
00009  *     Mikael Lagerkvist <lagerkvist@gecode.org>
00010  *     David Rijsman <David.Rijsman@quintiq.com>
00011  *
00012  *  Copyright:
00013  *     Stefano Gualandi, 2013
00014  *     Mikael Lagerkvist, 2006
00015  *     David Rijsman, 2009
00016  *     Christian Schulte, 2002
00017  *     Guido Tack, 2004
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_INT_HH__
00045 #define __GECODE_INT_HH__
00046 
00047 #include <climits>
00048 #include <cfloat>
00049 #include <iostream>
00050 
00051 #include <vector>
00052 
00053 #include <functional>
00054 
00055 #include <gecode/kernel.hh>
00056 #include <gecode/search.hh>
00057 #include <gecode/iter.hh>
00058 
00059 /*
00060  * Configure linking
00061  *
00062  */
00063 #if !defined(GECODE_STATIC_LIBS) && \
00064     (defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER))
00065 
00066 #ifdef GECODE_BUILD_INT
00067 #define GECODE_INT_EXPORT __declspec( dllexport )
00068 #else
00069 #define GECODE_INT_EXPORT __declspec( dllimport )
00070 #endif
00071 
00072 #else
00073 
00074 #ifdef GECODE_GCC_HAS_CLASS_VISIBILITY
00075 #define GECODE_INT_EXPORT __attribute__ ((visibility("default")))
00076 #else
00077 #define GECODE_INT_EXPORT
00078 #endif
00079 
00080 #endif
00081 
00082 // Configure auto-linking
00083 #ifndef GECODE_BUILD_INT
00084 #define GECODE_LIBRARY_NAME "Int"
00085 #include <gecode/support/auto-link.hpp>
00086 #endif
00087 
00099 #include <gecode/int/exception.hpp>
00100 
00101 namespace Gecode { namespace Int {
00102 
00110   namespace Limits {
00112     const int max = INT_MAX - 1;
00114     const int min = -max;
00116     const int infinity = max + 1;
00118     const long long int llmax =  LLONG_MAX - 1;
00120     const long long int llmin = -llmax;
00122     const long long int llinfinity = llmax + 1;
00124     bool valid(int n);
00126     bool valid(long long int n);
00128     void check(int n, const char* l);
00130     void check(long long int n, const char* l);
00132     void positive(int n, const char* l);
00134     void positive(long long int n, const char* l);
00136     void nonnegative(int n, const char* l);
00138     void nonnegative(long long int n, const char* l);
00140     bool overflow_add(int n, int m);
00142     bool overflow_add(long long int n, long long int m);
00144     bool overflow_sub(int n, int m);
00146     bool overflow_sub(long long int n, long long int m);
00148     bool overflow_mul(int n, int m);
00150     bool overflow_mul(long long int n, long long int m);
00151   }
00152 
00153 }}
00154 
00155 #include <gecode/int/limits.hpp>
00156 
00157 namespace Gecode {
00158 
00159   class IntSetRanges;
00160 
00161   template<class I> class IntSetInit;
00162 
00170   class IntSet : public SharedHandle {
00171     friend class IntSetRanges;
00172     template<class I> friend class IntSetInit;
00173   private:
00175     class Range {
00176     public:
00177       int min, max;
00178     };
00179     class IntSetObject : public SharedHandle::Object {
00180     public:
00182       unsigned int size;
00184       int n;
00186       Range* r;
00188       GECODE_INT_EXPORT static IntSetObject* allocate(int m);
00190       GECODE_INT_EXPORT bool in(int n) const;
00192       GECODE_INT_EXPORT virtual ~IntSetObject(void);
00193     };
00195     class MinInc;
00197     GECODE_INT_EXPORT void normalize(Range* r, int n);
00199     GECODE_INT_EXPORT void init(int n, int m);
00201     GECODE_INT_EXPORT void init(const int r[], int n);
00203     GECODE_INT_EXPORT void init(const int r[][2], int n);
00204   public:
00206 
00207 
00208     IntSet(void);
00213     IntSet(int n, int m);
00215     IntSet(const int r[],   int n);
00221     IntSet(const int r[][2], int n);
00223     template<class I>
00224     explicit IntSet(I& i);
00226     template<class I>
00227     explicit IntSet(const I& i);
00229 
00231 
00232 
00233     int ranges(void) const;
00235     int min(int i) const;
00237     int max(int i) const;
00239     unsigned int width(int i) const;
00241 
00243 
00244 
00245     bool in(int n) const;
00247     unsigned int size(void) const;
00249     unsigned int width(void) const;
00251     int min(void) const;
00253     int max(void) const;
00255 
00257 
00258 
00259     GECODE_INT_EXPORT static const IntSet empty;
00261   };
00262 
00268   class IntSetRanges {
00269   private:
00271     const IntSet::Range* i;
00273     const IntSet::Range* e;
00274   public:
00276 
00277 
00278     IntSetRanges(void);
00280     IntSetRanges(const IntSet& s);
00282     void init(const IntSet& s);
00284 
00286 
00287 
00288     bool operator ()(void) const;
00290     void operator ++(void);
00292 
00294 
00295 
00296     int min(void) const;
00298     int max(void) const;
00300     unsigned int width(void) const;
00302   };
00303 
00309   class IntSetValues : public Iter::Ranges::ToValues<IntSetRanges> {
00310   public:
00312 
00313 
00314     IntSetValues(void);
00316     IntSetValues(const IntSet& s);
00318     void init(const IntSet& s);
00320   };
00321 
00326   template<class Char, class Traits>
00327   std::basic_ostream<Char,Traits>&
00328   operator <<(std::basic_ostream<Char,Traits>& os, const IntSet& s);
00329 
00330 }
00331 
00332 #include <gecode/int/int-set-1.hpp>
00333 
00334 #include <gecode/int/var-imp.hpp>
00335 
00336 namespace Gecode {
00337 
00338   namespace Int {
00339     class IntView;
00340   }
00341 
00347   class IntVar : public VarImpVar<Int::IntVarImp> {
00348     friend class IntVarArray;
00349     friend class IntVarArgs;
00350   private:
00351     using VarImpVar<Int::IntVarImp>::x;
00358     void _init(Space& home, int min, int max);
00365     void _init(Space& home, const IntSet& d);
00366   public:
00368 
00369 
00370     IntVar(void);
00372     IntVar(const IntVar& y);
00374     IntVar(const Int::IntView& y);
00386     GECODE_INT_EXPORT IntVar(Space& home, int min, int max);
00398     GECODE_INT_EXPORT IntVar(Space& home, const IntSet& d);
00400 
00402 
00403 
00404     int min(void) const;
00406     int max(void) const;
00408     int med(void) const;
00416     int val(void) const;
00417 
00419     unsigned int size(void) const;
00421     unsigned int width(void) const;
00423     unsigned int regret_min(void) const;
00425     unsigned int regret_max(void) const;
00427 
00429 
00430 
00431     bool range(void) const;
00433     bool in(int n) const;
00435   };
00436 
00441   template<class Char, class Traits>
00442   std::basic_ostream<Char,Traits>&
00443   operator <<(std::basic_ostream<Char,Traits>& os, const IntVar& x);
00444 
00449   class IntVarRanges : public Int::IntVarImpFwd {
00450   public:
00452 
00453 
00454     IntVarRanges(void);
00456     IntVarRanges(const IntVar& x);
00458     void init(const IntVar& x);
00460   };
00461 
00466   class IntVarValues : public Iter::Ranges::ToValues<IntVarRanges> {
00467   public:
00469 
00470 
00471     IntVarValues(void);
00473     IntVarValues(const IntVar& x);
00475     void init(const IntVar& x);
00477   };
00478 
00479   namespace Int {
00480     class BoolView;
00481   }
00482 
00488   class BoolVar : public VarImpVar<Int::BoolVarImp> {
00489     friend class BoolVarArray;
00490     friend class BoolVarArgs;
00491   private:
00492     using VarImpVar<Int::BoolVarImp>::x;
00499     void _init(Space& home, int min, int max);
00500   public:
00502 
00503 
00504     BoolVar(void);
00506     BoolVar(const BoolVar& y);
00508     BoolVar(const Int::BoolView& y);
00520     GECODE_INT_EXPORT BoolVar(Space& home, int min, int max);
00522 
00524 
00525 
00526     int min(void) const;
00528     int max(void) const;
00530     int med(void) const;
00538     int val(void) const;
00539 
00541     unsigned int size(void) const;
00543     unsigned int width(void) const;
00545     unsigned int regret_min(void) const;
00547     unsigned int regret_max(void) const;
00549 
00551 
00552 
00553     bool range(void) const;
00555     bool in(int n) const;
00557 
00559 
00560 
00561     bool zero(void) const;
00563     bool one(void) const;
00565     bool none(void) const;
00567   };
00568 
00573   template<class Char, class Traits>
00574   std::basic_ostream<Char,Traits>&
00575   operator <<(std::basic_ostream<Char,Traits>& os, const BoolVar& x);
00576 
00577 }
00578 
00579 
00580 #include <gecode/int/view.hpp>
00581 #include <gecode/int/propagator.hpp>
00582 
00583 namespace Gecode {
00584 
00594 
00595   typedef ArgArray<IntSet> IntSetArgs;
00596 
00597 }
00598 
00599 #include <gecode/int/array-traits.hpp>
00600 
00601 namespace Gecode {
00602 
00604   class IntArgs : public PrimArgArray<int> {
00605   public:
00607 
00608 
00609     IntArgs(void);
00611     explicit IntArgs(int n);
00613     IntArgs(const SharedArray<int>& x);
00615     IntArgs(const std::vector<int>& x);
00617     template<class InputIterator>
00618     IntArgs(InputIterator first, InputIterator last);
00620     GECODE_INT_EXPORT
00621     IntArgs(int n, int e0, ...);
00623     IntArgs(int n, const int* e);
00625     IntArgs(const PrimArgArray<int>& a);
00626 
00628     static IntArgs create(int n, int start, int inc=1);
00630   };
00631 
00633   class IntVarArgs : public VarArgArray<IntVar> {
00634   public:
00636 
00637 
00638     IntVarArgs(void) {}
00640     explicit IntVarArgs(int n) : VarArgArray<IntVar>(n) {}
00642     IntVarArgs(const IntVarArgs& a) : VarArgArray<IntVar>(a) {}
00644     IntVarArgs(const VarArray<IntVar>& a) : VarArgArray<IntVar>(a) {}
00646     IntVarArgs(const std::vector<IntVar>& a) : VarArgArray<IntVar>(a) {}
00648     template<class InputIterator>
00649     IntVarArgs(InputIterator first, InputIterator last)
00650     : VarArgArray<IntVar>(first,last) {}
00662     GECODE_INT_EXPORT
00663     IntVarArgs(Space& home, int n, int min, int max);
00675     GECODE_INT_EXPORT
00676     IntVarArgs(Space& home, int n, const IntSet& s);
00678   };
00687   class BoolVarArgs : public VarArgArray<BoolVar> {
00688   public:
00690 
00691 
00692     BoolVarArgs(void) {}
00694     explicit BoolVarArgs(int n) : VarArgArray<BoolVar>(n) {}
00696     BoolVarArgs(const BoolVarArgs& a) : VarArgArray<BoolVar>(a) {}
00698     BoolVarArgs(const VarArray<BoolVar>& a)
00699      : VarArgArray<BoolVar>(a) {}
00701     BoolVarArgs(const std::vector<BoolVar>& a) : VarArgArray<BoolVar>(a) {}
00703     template<class InputIterator>
00704     BoolVarArgs(InputIterator first, InputIterator last)
00705     : VarArgArray<BoolVar>(first,last) {}
00717     GECODE_INT_EXPORT
00718     BoolVarArgs(Space& home, int n, int min, int max);
00720   };
00722 
00738   class IntVarArray : public VarArray<IntVar> {
00739   public:
00741 
00742 
00743     IntVarArray(void);
00745     IntVarArray(Space& home, int n);
00747     IntVarArray(const IntVarArray& a);
00749     IntVarArray(Space& home, const IntVarArgs& a);
00761     GECODE_INT_EXPORT
00762     IntVarArray(Space& home, int n, int min, int max);
00774     GECODE_INT_EXPORT
00775     IntVarArray(Space& home, int n, const IntSet& s);
00777   };
00778 
00783   class BoolVarArray : public VarArray<BoolVar> {
00784   public:
00786 
00787 
00788     BoolVarArray(void);
00790     BoolVarArray(Space& home, int n);
00792     BoolVarArray(const BoolVarArray& a);
00794     BoolVarArray(Space& home, const BoolVarArgs& a);
00806     GECODE_INT_EXPORT
00807     BoolVarArray(Space& home, int n, int min, int max);
00809   };
00810 
00811 }
00812 
00813 #include <gecode/int/int-set-2.hpp>
00814 
00815 #include <gecode/int/array.hpp>
00816 
00817 namespace Gecode {
00818 
00823   enum ReifyMode {
00830     RM_EQV,
00837     RM_IMP,
00844     RM_PMI
00845   };
00846 
00851   class Reify {
00852   protected:
00854     BoolVar x;
00856     ReifyMode rm;
00857   public:
00859     Reify(void);
00861     Reify(BoolVar x, ReifyMode rm=RM_EQV);
00863     BoolVar var(void) const;
00865     ReifyMode mode(void) const;
00867     void var(BoolVar x);
00869     void mode(ReifyMode rm);
00870   };
00871 
00876   Reify eqv(BoolVar x);
00877 
00882   Reify imp(BoolVar x);
00883 
00888   Reify pmi(BoolVar x);
00889 
00890 }
00891 
00892 #include <gecode/int/reify.hpp>
00893 
00894 namespace Gecode {
00895 
00900   enum IntRelType {
00901     IRT_EQ, 
00902     IRT_NQ, 
00903     IRT_LQ, 
00904     IRT_LE, 
00905     IRT_GQ, 
00906     IRT_GR  
00907   };
00908 
00910   IntRelType swap(IntRelType irt);
00911 
00913   IntRelType neg(IntRelType irt);
00914 
00915 }
00916 
00917 #include <gecode/int/irt.hpp>
00918 
00919 namespace Gecode {
00920 
00925   enum BoolOpType {
00926     BOT_AND, 
00927     BOT_OR,  
00928     BOT_IMP, 
00929     BOT_EQV, 
00930     BOT_XOR  
00931   };
00932 
00949   enum IntPropLevel {
00951     IPL_DEF = 0, 
00952     IPL_VAL = 1, 
00953     IPL_BND = 2, 
00954     IPL_DOM = 3, 
00955 
00956     IPL_BASIC = 4,    
00957     IPL_ADVANCED = 8, 
00958     IPL_BASIC_ADVANCED = IPL_BASIC | IPL_ADVANCED 
00959   };
00960 
00962   IntPropLevel vbd(IntPropLevel ipl);
00963 
00965   IntPropLevel ba(IntPropLevel ipl);
00966 
00967 }
00968 
00969 #include <gecode/int/ipl.hpp>
00970 
00971 namespace Gecode {
00972 
00978   enum TaskType {
00979     TT_FIXP, //< Task with fixed processing time
00980     TT_FIXS, //< Task with fixed start time
00981     TT_FIXE  //< Task with fixed end time
00982   };
00983 
00989   typedef PrimArgArray<TaskType> TaskTypeArgs;
00990 
00992   template<>
00993   class ArrayTraits<PrimArgArray<TaskType> > {
00994   public:
00995     typedef TaskTypeArgs StorageType;
00996     typedef TaskType     ValueType;
00997     typedef TaskTypeArgs ArgsType;
00998   };
00999 
01000 
01008 
01009   GECODE_INT_EXPORT void
01010   dom(Home home, IntVar x, int n,
01011       IntPropLevel ipl=IPL_DEF);
01013   GECODE_INT_EXPORT void
01014   dom(Home home, const IntVarArgs& x, int n,
01015       IntPropLevel ipl=IPL_DEF);
01016 
01018   GECODE_INT_EXPORT void
01019   dom(Home home, IntVar x, int l, int m,
01020       IntPropLevel ipl=IPL_DEF);
01022   GECODE_INT_EXPORT void
01023   dom(Home home, const IntVarArgs& x, int l, int m,
01024       IntPropLevel ipl=IPL_DEF);
01025 
01027   GECODE_INT_EXPORT void
01028   dom(Home home, IntVar x, const IntSet& s,
01029       IntPropLevel ipl=IPL_DEF);
01031   GECODE_INT_EXPORT void
01032   dom(Home home, const IntVarArgs& x, const IntSet& s,
01033       IntPropLevel ipl=IPL_DEF);
01034 
01036   GECODE_INT_EXPORT void
01037   dom(Home home, IntVar x, int n, Reify r,
01038       IntPropLevel ipl=IPL_DEF);
01040   GECODE_INT_EXPORT void
01041   dom(Home home, IntVar x, int l, int m, Reify r,
01042       IntPropLevel ipl=IPL_DEF);
01044   GECODE_INT_EXPORT void
01045   dom(Home home, IntVar x, const IntSet& s, Reify r,
01046       IntPropLevel ipl=IPL_DEF);
01047 
01049   GECODE_INT_EXPORT void
01050   dom(Home home, IntVar x, IntVar d,
01051       IntPropLevel ipl=IPL_DEF);
01053   GECODE_INT_EXPORT void
01054   dom(Home home, BoolVar x, BoolVar d,
01055       IntPropLevel ipl=IPL_DEF);
01057   GECODE_INT_EXPORT void
01058   dom(Home home, const IntVarArgs& x, const IntVarArgs& d,
01059       IntPropLevel ipl=IPL_DEF);
01061   GECODE_INT_EXPORT void
01062   dom(Home home, const BoolVarArgs& x, const BoolVarArgs& d,
01063       IntPropLevel ipl=IPL_DEF);
01065 
01066 
01077   GECODE_INT_EXPORT void
01078   rel(Home home, IntVar x0, IntRelType irt, IntVar x1,
01079       IntPropLevel ipl=IPL_DEF);
01086   GECODE_INT_EXPORT void
01087   rel(Home home, const IntVarArgs& x, IntRelType irt, IntVar y,
01088       IntPropLevel ipl=IPL_DEF);
01092   GECODE_INT_EXPORT void
01093   rel(Home home, IntVar x, IntRelType irt, int c,
01094       IntPropLevel ipl=IPL_DEF);
01098   GECODE_INT_EXPORT void
01099   rel(Home home, const IntVarArgs& x, IntRelType irt, int c,
01100       IntPropLevel ipl=IPL_DEF);
01107   GECODE_INT_EXPORT void
01108   rel(Home home, IntVar x0, IntRelType irt, IntVar x1, Reify r,
01109       IntPropLevel ipl=IPL_DEF);
01116   GECODE_INT_EXPORT void
01117   rel(Home home, IntVar x, IntRelType irt, int c, Reify r,
01118       IntPropLevel ipl=IPL_DEF);
01133   GECODE_INT_EXPORT void
01134   rel(Home home, const IntVarArgs& x, IntRelType irt,
01135       IntPropLevel ipl=IPL_DEF);
01150   GECODE_INT_EXPORT void
01151   rel(Home home, const IntVarArgs& x, IntRelType irt, const IntVarArgs& y,
01152       IntPropLevel ipl=IPL_DEF);
01166   GECODE_INT_EXPORT void
01167   rel(Home home, const IntVarArgs& x, IntRelType irt, const IntArgs& y,
01168       IntPropLevel ipl=IPL_DEF);
01182   GECODE_INT_EXPORT void
01183   rel(Home home, const IntArgs& x, IntRelType irt, const IntVarArgs& y,
01184       IntPropLevel ipl=IPL_DEF);
01185 
01193   GECODE_INT_EXPORT void
01194   rel(Home home, BoolVar x0, IntRelType irt, BoolVar x1,
01195       IntPropLevel ipl=IPL_DEF);
01199   GECODE_INT_EXPORT void
01200   rel(Home home, BoolVar x0, IntRelType irt, BoolVar x1, Reify r,
01201       IntPropLevel ipl=IPL_DEF);
01205   GECODE_INT_EXPORT void
01206   rel(Home home, const BoolVarArgs& x, IntRelType irt, BoolVar y,
01207       IntPropLevel ipl=IPL_DEF);
01215   GECODE_INT_EXPORT void
01216   rel(Home home, BoolVar x, IntRelType irt, int n,
01217       IntPropLevel ipl=IPL_DEF);
01225   GECODE_INT_EXPORT void
01226   rel(Home home, BoolVar x, IntRelType irt, int n, Reify r,
01227       IntPropLevel ipl=IPL_DEF);
01235   GECODE_INT_EXPORT void
01236   rel(Home home, const BoolVarArgs& x, IntRelType irt, int n,
01237       IntPropLevel ipl=IPL_DEF);
01250   GECODE_INT_EXPORT void
01251   rel(Home home, const BoolVarArgs& x, IntRelType irt, const BoolVarArgs& y,
01252       IntPropLevel ipl=IPL_DEF);
01265   GECODE_INT_EXPORT void
01266   rel(Home home, const BoolVarArgs& x, IntRelType irt, const IntArgs& y,
01267       IntPropLevel ipl=IPL_DEF);
01280   GECODE_INT_EXPORT void
01281   rel(Home home, const IntArgs& x, IntRelType irt, const BoolVarArgs& y,
01282       IntPropLevel ipl=IPL_DEF);
01293   GECODE_INT_EXPORT void
01294   rel(Home home, const BoolVarArgs& x, IntRelType irt,
01295       IntPropLevel ipl=IPL_DEF);
01301   GECODE_INT_EXPORT void
01302   rel(Home home, BoolVar x0, BoolOpType o, BoolVar x1, BoolVar x2,
01303       IntPropLevel ipl=IPL_DEF);
01312   GECODE_INT_EXPORT void
01313   rel(Home home, BoolVar x0, BoolOpType o, BoolVar x1, int n,
01314       IntPropLevel ipl=IPL_DEF);
01324   GECODE_INT_EXPORT void
01325   rel(Home home, BoolOpType o, const BoolVarArgs& x, BoolVar y,
01326       IntPropLevel ipl=IPL_DEF);
01339   GECODE_INT_EXPORT void
01340   rel(Home home, BoolOpType o, const BoolVarArgs& x, int n,
01341       IntPropLevel ipl=IPL_DEF);
01352   GECODE_INT_EXPORT void
01353   clause(Home home, BoolOpType o, const BoolVarArgs& x, const BoolVarArgs& y,
01354          BoolVar z, IntPropLevel ipl=IPL_DEF);
01368   GECODE_INT_EXPORT void
01369   clause(Home home, BoolOpType o, const BoolVarArgs& x, const BoolVarArgs& y,
01370          int n, IntPropLevel ipl=IPL_DEF);
01380   GECODE_INT_EXPORT void
01381   ite(Home home, BoolVar b, IntVar x, IntVar y, IntVar z,
01382       IntPropLevel ipl=IPL_DEF);
01389   GECODE_INT_EXPORT void
01390   ite(Home home, BoolVar b, BoolVar x, BoolVar y, BoolVar z,
01391       IntPropLevel ipl=IPL_DEF);
01392 
01393 
01405   GECODE_INT_EXPORT void
01406   precede(Home home, const IntVarArgs& x, int s, int t,
01407           IntPropLevel=IPL_DEF);
01415   GECODE_INT_EXPORT void
01416   precede(Home home, const IntVarArgs& x, const IntArgs& c,
01417           IntPropLevel=IPL_DEF);
01418 
01419 
01425 
01426   GECODE_INT_EXPORT void
01427   member(Home home, const IntVarArgs& x, IntVar y,
01428          IntPropLevel ipl=IPL_DEF);
01430   GECODE_INT_EXPORT void
01431   member(Home home, const BoolVarArgs& x, BoolVar y,
01432          IntPropLevel ipl=IPL_DEF);
01434   GECODE_INT_EXPORT void
01435   member(Home home, const IntVarArgs& x, IntVar y, Reify r,
01436          IntPropLevel ipl=IPL_DEF);
01438   GECODE_INT_EXPORT void
01439   member(Home home, const BoolVarArgs& x, BoolVar y, Reify r,
01440          IntPropLevel ipl=IPL_DEF);
01442 
01443 
01450 
01451   typedef SharedArray<int> IntSharedArray;
01457   GECODE_INT_EXPORT void
01458   element(Home home, IntSharedArray n, IntVar x0, IntVar x1,
01459           IntPropLevel ipl=IPL_DEF);
01465   GECODE_INT_EXPORT void
01466   element(Home home, IntSharedArray n, IntVar x0, BoolVar x1,
01467           IntPropLevel ipl=IPL_DEF);
01473   GECODE_INT_EXPORT void
01474   element(Home home, IntSharedArray n, IntVar x0, int x1,
01475           IntPropLevel ipl=IPL_DEF);
01481   GECODE_INT_EXPORT void
01482   element(Home home, const IntVarArgs& x, IntVar y0, IntVar y1,
01483           IntPropLevel ipl=IPL_DEF);
01489   GECODE_INT_EXPORT void
01490   element(Home home, const IntVarArgs& x, IntVar y0, int y1,
01491           IntPropLevel ipl=IPL_DEF);
01493   GECODE_INT_EXPORT void
01494   element(Home home, const BoolVarArgs& x, IntVar y0, BoolVar y1,
01495           IntPropLevel ipl=IPL_DEF);
01497   GECODE_INT_EXPORT void
01498   element(Home home, const BoolVarArgs& x, IntVar y0, int y1,
01499           IntPropLevel ipl=IPL_DEF);
01500 
01513   GECODE_INT_EXPORT void
01514   element(Home home, IntSharedArray a,
01515           IntVar x, int w, IntVar y, int h, IntVar z,
01516           IntPropLevel ipl=IPL_DEF);
01529   GECODE_INT_EXPORT void
01530   element(Home home, IntSharedArray a,
01531           IntVar x, int w, IntVar y, int h, BoolVar z,
01532           IntPropLevel ipl=IPL_DEF);
01548   GECODE_INT_EXPORT void
01549   element(Home home, const IntVarArgs& a,
01550           IntVar x, int w, IntVar y, int h, IntVar z,
01551           IntPropLevel ipl=IPL_DEF);
01564   GECODE_INT_EXPORT void
01565   element(Home home, const BoolVarArgs& a,
01566           IntVar x, int w, IntVar y, int h, BoolVar z,
01567           IntPropLevel ipl=IPL_DEF);
01569 
01570 
01585   GECODE_INT_EXPORT void
01586   distinct(Home home, const IntVarArgs& x,
01587            IntPropLevel ipl=IPL_DEF);
01600   GECODE_INT_EXPORT void
01601   distinct(Home home, const IntArgs& n, const IntVarArgs& x,
01602            IntPropLevel ipl=IPL_DEF);
01617   GECODE_INT_EXPORT void
01618   distinct(Home home, const BoolVarArgs& b, const IntVarArgs& x,
01619            IntPropLevel ipl=IPL_DEF);
01632   GECODE_INT_EXPORT void
01633   distinct(Home home, const IntVarArgs& x, int c,
01634            IntPropLevel ipl=IPL_DEF);
01636 
01637 
01655   GECODE_INT_EXPORT void
01656   channel(Home home, const IntVarArgs& x, const IntVarArgs& y,
01657           IntPropLevel ipl=IPL_DEF);
01658 
01672   GECODE_INT_EXPORT void
01673   channel(Home home, const IntVarArgs& x, int xoff,
01674           const IntVarArgs& y, int yoff,
01675           IntPropLevel ipl=IPL_DEF);
01676 
01678   GECODE_INT_EXPORT void
01679   channel(Home home, BoolVar x0, IntVar x1,
01680           IntPropLevel ipl=IPL_DEF);
01682   void
01683   channel(Home home, IntVar x0, BoolVar x1,
01684           IntPropLevel ipl=IPL_DEF);
01690   GECODE_INT_EXPORT void
01691   channel(Home home, const BoolVarArgs& x, IntVar y, int o=0,
01692           IntPropLevel ipl=IPL_DEF);
01694 
01695 }
01696 
01697 #include <gecode/int/channel.hpp>
01698 
01699 namespace Gecode {
01700 
01717   GECODE_INT_EXPORT void
01718   sorted(Home home, const IntVarArgs& x, const IntVarArgs& y,
01719          IntPropLevel ipl=IPL_DEF);
01720 
01732   GECODE_INT_EXPORT void
01733   sorted(Home home, const IntVarArgs& x, const IntVarArgs& y,
01734          const IntVarArgs& z,
01735          IntPropLevel ipl=IPL_DEF);
01737 
01738 
01757   GECODE_INT_EXPORT void
01758   count(Home home, const IntVarArgs& x, int n, IntRelType irt, int m,
01759         IntPropLevel ipl=IPL_DEF);
01764   GECODE_INT_EXPORT void
01765   count(Home home, const IntVarArgs& x, const IntSet& y, IntRelType irt, int m,
01766         IntPropLevel ipl=IPL_DEF);
01774   GECODE_INT_EXPORT void
01775   count(Home home, const IntVarArgs& x, IntVar y, IntRelType irt, int m,
01776         IntPropLevel ipl=IPL_DEF);
01784   GECODE_INT_EXPORT void
01785   count(Home home, const IntVarArgs& x, const IntArgs& y, IntRelType irt, int m,
01786         IntPropLevel ipl=IPL_DEF);
01791   GECODE_INT_EXPORT void
01792   count(Home home, const IntVarArgs& x, int n, IntRelType irt, IntVar z,
01793         IntPropLevel ipl=IPL_DEF);
01798   GECODE_INT_EXPORT void
01799   count(Home home, const IntVarArgs& x, const IntSet& y, IntRelType irt, IntVar z,
01800         IntPropLevel ipl=IPL_DEF);
01808   GECODE_INT_EXPORT void
01809   count(Home home, const IntVarArgs& x, IntVar y, IntRelType irt, IntVar z,
01810         IntPropLevel ipl=IPL_DEF);
01818   GECODE_INT_EXPORT void
01819   count(Home home, const IntVarArgs& x, const IntArgs& y, IntRelType irt, IntVar z,
01820         IntPropLevel ipl=IPL_DEF);
01821 
01835   GECODE_INT_EXPORT void
01836   count(Home home, const IntVarArgs& x, const IntVarArgs& c,
01837         IntPropLevel ipl=IPL_DEF);
01838 
01852   GECODE_INT_EXPORT void
01853   count(Home home, const IntVarArgs& x, const IntSetArgs& c,
01854         IntPropLevel ipl=IPL_DEF);
01855 
01872   GECODE_INT_EXPORT void
01873   count(Home home, const IntVarArgs& x,
01874         const IntVarArgs& c, const IntArgs& v,
01875         IntPropLevel ipl=IPL_DEF);
01876 
01893   GECODE_INT_EXPORT void
01894   count(Home home, const IntVarArgs& x,
01895         const IntSetArgs& c, const IntArgs& v,
01896         IntPropLevel ipl=IPL_DEF);
01897 
01914   GECODE_INT_EXPORT void
01915   count(Home home, const IntVarArgs& x,
01916         const IntSet& c, const IntArgs& v,
01917         IntPropLevel ipl=IPL_DEF);
01918 
01920 
01935   GECODE_INT_EXPORT void
01936   nvalues(Home home, const IntVarArgs& x, IntRelType irt, int y,
01937           IntPropLevel ipl=IPL_DEF);
01941   GECODE_INT_EXPORT void
01942   nvalues(Home home, const IntVarArgs& x, IntRelType irt, IntVar y,
01943           IntPropLevel ipl=IPL_DEF);
01947   GECODE_INT_EXPORT void
01948   nvalues(Home home, const BoolVarArgs& x, IntRelType irt, int y,
01949           IntPropLevel ipl=IPL_DEF);
01953   GECODE_INT_EXPORT void
01954   nvalues(Home home, const BoolVarArgs& x, IntRelType irt, IntVar y,
01955           IntPropLevel ipl=IPL_DEF);
01957 
01978   GECODE_INT_EXPORT void
01979   sequence(Home home, const IntVarArgs& x, const IntSet& s,
01980            int q, int l, int u, IntPropLevel ipl=IPL_DEF);
01981 
01996   GECODE_INT_EXPORT void
01997   sequence(Home home, const BoolVarArgs& x, const IntSet& s,
01998            int q, int l, int u, IntPropLevel ipl=IPL_DEF);
01999 
02001 
02023   class DFA : public SharedHandle {
02024   private:
02026     class DFAI;
02028     GECODE_INT_EXPORT
02029     bool equal(const DFA& d) const;
02030   public:
02032     class Transition {
02033     public:
02034       int i_state; 
02035       int symbol;  
02036       int o_state; 
02037 
02038       Transition(void);
02040       Transition(int i_state0, int symbol0, int o_state0);
02041     };
02043     class Transitions {
02044     private:
02046       const Transition* c_trans;
02048       const Transition* e_trans;
02049     public:
02051       Transitions(const DFA& d);
02053       Transitions(const DFA& d, int n);
02055       bool operator ()(void) const;
02057       void operator ++(void);
02059       int i_state(void) const;
02061       int symbol(void) const;
02063       int o_state(void) const;
02064     };
02066     class Symbols {
02067     private:
02069       const Transition* c_trans;
02071       const Transition* e_trans;
02072     public:
02074       Symbols(const DFA& d);
02076       bool operator ()(void) const;
02078       void operator ++(void);
02080       int val(void) const;
02081     };
02082   public:
02083     friend class Transitions;
02085     DFA(void);
02097     GECODE_INT_EXPORT
02098     DFA(int s, Transition t[], int f[], bool minimize=true);
02100     DFA(const DFA& d);
02102     GECODE_INT_EXPORT
02103     bool operator ==(const DFA& d) const;
02105     bool operator !=(const DFA& d) const;
02107     int n_states(void) const;
02109     int n_transitions(void) const;
02111     unsigned int n_symbols(void) const;
02113     unsigned int max_degree(void) const;
02115     int final_fst(void) const;
02117     int final_lst(void) const;
02119     int symbol_min(void) const;
02121     int symbol_max(void) const;
02123     std::size_t hash(void) const;
02124   };
02125 
02126 }
02127 
02128 #include <gecode/int/extensional/dfa.hpp>
02129 
02130 namespace Gecode {
02131 
02140   class TupleSet : public SharedHandle {
02141   public:
02146     typedef int* Tuple;
02148     typedef Gecode::Support::BitSetData BitSetData;
02150     class Range {
02151     public:
02153       int min;
02155       int max;
02157       BitSetData* s;
02159       unsigned int width(void) const;
02161       const BitSetData* supports(unsigned int n_words, int n) const;
02162     };
02163   protected:
02165     class ValueData {
02166     public:
02168       unsigned int n;
02170       Range* r;
02172       unsigned int start(int n) const;
02173     };
02178     class GECODE_VTABLE_EXPORT Data : public SharedHandle::Object {
02179     protected:
02181       static const int n_initial_free = 1024;
02182     public:
02184       int arity;
02186       unsigned int n_words;
02188       int n_tuples;
02190       int n_free;
02192       int min;
02194       int max;
02196       std::size_t key;
02198       int* td;
02200       ValueData* vd;
02202       Range* range;
02204       BitSetData* support;
02205 
02207       Tuple add(void);
02209       Tuple get(int i) const;
02211       static void set(BitSetData* d, unsigned int n);
02213       static bool get(const BitSetData* d, unsigned int n);
02215       unsigned int tuple2idx(Tuple t) const;
02217       const Range* fst(int i) const;
02219       const Range* lst(int i) const;
02221       GECODE_INT_EXPORT
02222       void finalize(void);
02224       GECODE_INT_EXPORT
02225       void resize(void);
02227       bool finalized(void) const;
02229       Data(int a);
02231       GECODE_INT_EXPORT
02232       virtual ~Data(void);
02233     };
02234 
02236     Data& data(void) const;
02238     Data& raw(void) const;
02240     GECODE_INT_EXPORT
02241     void _add(const IntArgs& t);
02243     GECODE_INT_EXPORT
02244     bool equal(const TupleSet& t) const;
02245   public:
02247 
02248 
02249     TupleSet(void);
02251     GECODE_INT_EXPORT
02252     TupleSet(int a);
02254     GECODE_INT_EXPORT
02255     void init(int a);
02257     GECODE_INT_EXPORT
02258     TupleSet(const TupleSet& t);
02260     GECODE_INT_EXPORT
02261     TupleSet& operator =(const TupleSet& t);
02263     GECODE_INT_EXPORT
02264     TupleSet(int a, const DFA& dfa);
02266     operator bool(void) const;
02268     bool operator ==(const TupleSet& t) const;
02270     bool operator !=(const TupleSet& t) const;
02272 
02274 
02275 
02276     TupleSet& add(const IntArgs& t);
02278     GECODE_INT_EXPORT
02279     TupleSet& add(int n, ...);
02281     bool finalized(void) const;
02283     void finalize(void);
02285 
02287 
02288 
02289     int arity(void) const;
02291     int tuples(void) const;
02293     unsigned int words(void) const;
02295     Tuple operator [](int i) const;
02297     int min(void) const;
02299     int max(void) const;
02301     std::size_t hash(void) const;
02303 
02305 
02306 
02307     const Range* fst(int i) const;
02309     const Range* lst(int i) const;
02311     class Ranges {
02312     protected:
02314       const Range* c;
02316       const Range* l;
02317     public:
02319 
02320 
02321       Ranges(const TupleSet& ts, int i);
02323 
02325 
02326 
02327       bool operator ()(void) const;
02329       void operator ++(void);
02331 
02333 
02334 
02335       int min(void) const;
02337       int max(void) const;
02339       unsigned int width(void) const;
02341     };
02343   };
02344 
02345 }
02346 
02347 #include <gecode/int/extensional/tuple-set.hpp>
02348 
02349 namespace Gecode {
02350 
02363   GECODE_INT_EXPORT void
02364   extensional(Home home, const IntVarArgs& x, DFA d,
02365               IntPropLevel ipl=IPL_DEF);
02366 
02379   GECODE_INT_EXPORT void
02380   extensional(Home home, const BoolVarArgs& x, DFA d,
02381               IntPropLevel ipl=IPL_DEF);
02382 
02393   GECODE_INT_EXPORT void
02394   extensional(Home home, const IntVarArgs& x, const TupleSet& t,
02395               IntPropLevel ipl=IPL_DEF);
02396 
02407   GECODE_INT_EXPORT void
02408   extensional(Home home, const BoolVarArgs& x, const TupleSet& t,
02409               IntPropLevel ipl=IPL_DEF);
02410 }
02411 
02412 namespace Gecode {
02413 
02425   GECODE_INT_EXPORT void
02426   min(Home home, IntVar x0, IntVar x1, IntVar x2,
02427       IntPropLevel ipl=IPL_DEF);
02435   GECODE_INT_EXPORT void
02436   min(Home home, const IntVarArgs& x, IntVar y,
02437       IntPropLevel ipl=IPL_DEF);
02443   GECODE_INT_EXPORT void
02444   max(Home home, IntVar x0, IntVar x1, IntVar x2,
02445       IntPropLevel ipl=IPL_DEF);
02453   GECODE_INT_EXPORT void
02454   max(Home home, const IntVarArgs& x, IntVar y,
02455       IntPropLevel ipl=IPL_DEF);
02456 
02466   GECODE_INT_EXPORT void
02467   argmin(Home home, const IntVarArgs& x, IntVar y, bool tiebreak=true,
02468          IntPropLevel ipl=IPL_DEF);
02478   GECODE_INT_EXPORT void
02479   argmin(Home home, const IntVarArgs& x, int o, IntVar y, bool tiebreak=true,
02480          IntPropLevel ipl=IPL_DEF);
02490   GECODE_INT_EXPORT void
02491   argmax(Home home, const IntVarArgs& x, IntVar y, bool tiebreak=true,
02492          IntPropLevel ipl=IPL_DEF);
02502   GECODE_INT_EXPORT void
02503   argmax(Home home, const IntVarArgs& x, int o, IntVar y, bool tiebreak=true,
02504          IntPropLevel ipl=IPL_DEF);
02505 
02511   GECODE_INT_EXPORT void
02512   abs(Home home, IntVar x0, IntVar x1,
02513       IntPropLevel ipl=IPL_DEF);
02514 
02520   GECODE_INT_EXPORT void
02521   mult(Home home, IntVar x0, IntVar x1, IntVar x2,
02522        IntPropLevel ipl=IPL_DEF);
02523 
02528   GECODE_INT_EXPORT void
02529   divmod(Home home, IntVar x0, IntVar x1, IntVar x2, IntVar x3,
02530          IntPropLevel ipl=IPL_DEF);
02531 
02536   GECODE_INT_EXPORT void
02537   div(Home home, IntVar x0, IntVar x1, IntVar x2,
02538       IntPropLevel ipl=IPL_DEF);
02539 
02544   GECODE_INT_EXPORT void
02545   mod(Home home, IntVar x0, IntVar x1, IntVar x2,
02546       IntPropLevel ipl=IPL_DEF);
02547 
02553   GECODE_INT_EXPORT void
02554   sqr(Home home, IntVar x0, IntVar x1,
02555       IntPropLevel ipl=IPL_DEF);
02556 
02562   GECODE_INT_EXPORT void
02563   sqrt(Home home, IntVar x0, IntVar x1,
02564        IntPropLevel ipl=IPL_DEF);
02565 
02574   GECODE_INT_EXPORT void
02575   pow(Home home, IntVar x0, int n, IntVar x1,
02576       IntPropLevel ipl=IPL_DEF);
02577 
02586   GECODE_INT_EXPORT void
02587   nroot(Home home, IntVar x0, int n, IntVar x1,
02588        IntPropLevel ipl=IPL_DEF);
02589 
02591 
02627   GECODE_INT_EXPORT void
02628   linear(Home home, const IntVarArgs& x,
02629          IntRelType irt, int c,
02630          IntPropLevel ipl=IPL_DEF);
02634   GECODE_INT_EXPORT void
02635   linear(Home home, const IntVarArgs& x,
02636          IntRelType irt, IntVar y,
02637          IntPropLevel ipl=IPL_DEF);
02641   GECODE_INT_EXPORT void
02642   linear(Home home, const IntVarArgs& x,
02643          IntRelType irt, int c, Reify r,
02644          IntPropLevel ipl=IPL_DEF);
02648   GECODE_INT_EXPORT void
02649   linear(Home home, const IntVarArgs& x,
02650          IntRelType irt, IntVar y, Reify r,
02651          IntPropLevel ipl=IPL_DEF);
02658   GECODE_INT_EXPORT void
02659   linear(Home home, const IntArgs& a, const IntVarArgs& x,
02660          IntRelType irt, int c,
02661          IntPropLevel ipl=IPL_DEF);
02668   GECODE_INT_EXPORT void
02669   linear(Home home, const IntArgs& a, const IntVarArgs& x,
02670          IntRelType irt, IntVar y,
02671          IntPropLevel ipl=IPL_DEF);
02678   GECODE_INT_EXPORT void
02679   linear(Home home, const IntArgs& a, const IntVarArgs& x,
02680          IntRelType irt, int c, Reify r,
02681          IntPropLevel ipl=IPL_DEF);
02688   GECODE_INT_EXPORT void
02689   linear(Home home, const IntArgs& a, const IntVarArgs& x,
02690          IntRelType irt, IntVar y, Reify r,
02691          IntPropLevel ipl=IPL_DEF);
02692 
02693 
02721   GECODE_INT_EXPORT void
02722   linear(Home home, const BoolVarArgs& x,
02723          IntRelType irt, int c,
02724          IntPropLevel ipl=IPL_DEF);
02728   GECODE_INT_EXPORT void
02729   linear(Home home, const BoolVarArgs& x,
02730          IntRelType irt, int c, Reify r,
02731          IntPropLevel ipl=IPL_DEF);
02735   GECODE_INT_EXPORT void
02736   linear(Home home, const BoolVarArgs& x,
02737          IntRelType irt, IntVar y,
02738          IntPropLevel ipl=IPL_DEF);
02742   GECODE_INT_EXPORT void
02743   linear(Home home, const BoolVarArgs& x,
02744          IntRelType irt, IntVar y, Reify r,
02745          IntPropLevel ipl=IPL_DEF);
02752   GECODE_INT_EXPORT void
02753   linear(Home home, const IntArgs& a, const BoolVarArgs& x,
02754          IntRelType irt, int c,
02755          IntPropLevel ipl=IPL_DEF);
02762   GECODE_INT_EXPORT void
02763   linear(Home home, const IntArgs& a, const BoolVarArgs& x,
02764          IntRelType irt, int c, Reify r,
02765          IntPropLevel ipl=IPL_DEF);
02772   GECODE_INT_EXPORT void
02773   linear(Home home, const IntArgs& a, const BoolVarArgs& x,
02774          IntRelType irt, IntVar y,
02775          IntPropLevel ipl=IPL_DEF);
02782   GECODE_INT_EXPORT void
02783   linear(Home home, const IntArgs& a, const BoolVarArgs& x,
02784          IntRelType irt, IntVar y, Reify r,
02785          IntPropLevel ipl=IPL_DEF);
02786 
02787 
02814   GECODE_INT_EXPORT void
02815   binpacking(Home home,
02816              const IntVarArgs& l,
02817              const IntVarArgs& b, const IntArgs& s,
02818              IntPropLevel ipl=IPL_DEF);
02819   /* \brief Post propagator for multi-dimensional bin packing
02820    *
02821    * In the following \a n refers to the number of items and \a m
02822    * refers to the number of bins.
02823    *
02824    * The multi-dimensional bin-packing constraint enforces that
02825    * all items are packed into bins
02826    * \f$b_i\in\{0,\ldots,m-1\}\f$ for \f$0\leq i<n\f$
02827    * and that the load of each bin corresponds to the items
02828    * packed into it for each dimension \f$l_{j\cdot
02829    * d + k} = \sum_{\{i\in\{0,\ldots,n-1\}|
02830    * b_{j\cdot d+k}=i}\}s_{i\cdot d+k}\f$
02831    * for \f$0\leq j<m\f$, \f$0\leq k<d\f$
02832    * Furthermore, the load variables must satisfy the capacity
02833    * constraints \f$l_{j\cdot d + k} \leq
02834    * c_k\f$ for \f$0\leq j<m\f$, \f$0\leq k<d\f$.
02835    *
02836    * The constraint is implemented by the decomposition
02837    * introduced in: Stefano Gualandi and Michele Lombardi. A
02838    * simple and effective decomposition for the multidimensional
02839    * binpacking constraint. CP 2013, pages 356--364.
02840    *
02841    * Posting the constraint returns a maximal set containing conflicting
02842    * items that require pairwise different bins.
02843    *
02844    * Note that posting the constraint has exponential complexity in the
02845    * number of items due to the Bron-Kerbosch algorithm used for finding
02846    * the maximal conflict item sets.
02847    *
02848    * Throws the following exceptions:
02849    *  - Of type Int::ArgumentSizeMismatch if any of the following properties
02850    *    is violated: \f$|b|=n\f$, \f$|l|=m\cdot d\f$, \f$|s|=n\cdot d\f$,
02851    *    and \f$|c|=d\f$.
02852    *  - Of type Int::ArgumentSame if \a l and \a b share unassigned variables.
02853    *  - Of type Int::OutOfLimits if \a s or \a c contains a negative number.
02854    *
02855    * \ingroup TaskModelIntBinPacking
02856    */
02857   GECODE_INT_EXPORT IntSet
02858   binpacking(Home home, int d,
02859              const IntVarArgs& l, const IntVarArgs& b,
02860              const IntArgs& s, const IntArgs& c,
02861              IntPropLevel ipl=IPL_DEF);
02862 
02863 
02882   GECODE_INT_EXPORT void
02883   nooverlap(Home home,
02884             const IntVarArgs& x, const IntArgs& w,
02885             const IntVarArgs& y, const IntArgs& h,
02886             IntPropLevel ipl=IPL_DEF);
02900   GECODE_INT_EXPORT void
02901   nooverlap(Home home,
02902             const IntVarArgs& x, const IntArgs& w,
02903             const IntVarArgs& y, const IntArgs& h,
02904             const BoolVarArgs& o,
02905             IntPropLevel ipl=IPL_DEF);
02922   GECODE_INT_EXPORT void
02923   nooverlap(Home home,
02924             const IntVarArgs& x0, const IntVarArgs& w, const IntVarArgs& x1,
02925             const IntVarArgs& y0, const IntVarArgs& h, const IntVarArgs& y1,
02926             IntPropLevel ipl=IPL_DEF);
02944   GECODE_INT_EXPORT void
02945   nooverlap(Home home,
02946             const IntVarArgs& x0, const IntVarArgs& w, const IntVarArgs& x1,
02947             const IntVarArgs& y0, const IntVarArgs& h, const IntVarArgs& y1,
02948             const BoolVarArgs& o,
02949             IntPropLevel ipl=IPL_DEF);
02950 
02951 
02957 
03000   GECODE_INT_EXPORT void
03001   cumulatives(Home home, const IntVarArgs& m,
03002               const IntVarArgs& s, const IntVarArgs& p,
03003               const IntVarArgs& e, const IntVarArgs& u,
03004               const IntArgs& c, bool at_most,
03005               IntPropLevel ipl=IPL_DEF);
03010   GECODE_INT_EXPORT void
03011   cumulatives(Home home, const IntArgs& m,
03012               const IntVarArgs& s, const IntVarArgs& p,
03013               const IntVarArgs& e, const IntVarArgs& u,
03014               const IntArgs& c, bool at_most,
03015               IntPropLevel ipl=IPL_DEF);
03020   GECODE_INT_EXPORT void
03021   cumulatives(Home home, const IntVarArgs& m,
03022               const IntVarArgs& s, const IntArgs& p,
03023               const IntVarArgs& e, const IntVarArgs& u,
03024               const IntArgs& c, bool at_most,
03025               IntPropLevel ipl=IPL_DEF);
03030   GECODE_INT_EXPORT void
03031   cumulatives(Home home, const IntArgs& m,
03032               const IntVarArgs& s, const IntArgs& p,
03033               const IntVarArgs& e, const IntVarArgs& u,
03034               const IntArgs& c, bool at_most,
03035               IntPropLevel ipl=IPL_DEF);
03040   GECODE_INT_EXPORT void
03041   cumulatives(Home home, const IntVarArgs& m,
03042               const IntVarArgs& s, const IntVarArgs& p,
03043               const IntVarArgs& e, const IntArgs& u,
03044               const IntArgs& c, bool at_most,
03045               IntPropLevel ipl=IPL_DEF);
03050   GECODE_INT_EXPORT void
03051   cumulatives(Home home, const IntArgs& m,
03052               const IntVarArgs& s, const IntVarArgs& p,
03053               const IntVarArgs& e, const IntArgs& u,
03054               const IntArgs& c, bool at_most,
03055               IntPropLevel ipl=IPL_DEF);
03060   GECODE_INT_EXPORT void
03061   cumulatives(Home home, const IntVarArgs& m,
03062               const IntVarArgs& s, const IntArgs& p,
03063               const IntVarArgs& e, const IntArgs& u,
03064               const IntArgs& c, bool at_most,
03065               IntPropLevel ipl=IPL_DEF);
03070   GECODE_INT_EXPORT void
03071   cumulatives(Home home, const IntArgs& m,
03072               const IntVarArgs& s, const IntArgs& p,
03073               const IntVarArgs& e, const IntArgs& u,
03074               const IntArgs& c, bool at_most,
03075               IntPropLevel ipl=IPL_DEF);
03076 
03103   GECODE_INT_EXPORT void
03104   unary(Home home, const IntVarArgs& s, const IntArgs& p,
03105         IntPropLevel ipl=IPL_DEF);
03106 
03135   GECODE_INT_EXPORT void
03136   unary(Home home, const IntVarArgs& s, const IntArgs& p,
03137         const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
03138 
03175   GECODE_INT_EXPORT void
03176   unary(Home home, const TaskTypeArgs& t,
03177         const IntVarArgs& flex, const IntArgs& fix, IntPropLevel ipl=IPL_DEF);
03178 
03217   GECODE_INT_EXPORT void
03218   unary(Home home, const TaskTypeArgs& t,
03219         const IntVarArgs& flex, const IntArgs& fix,
03220         const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
03221 
03248   GECODE_INT_EXPORT void
03249   unary(Home home, const IntVarArgs& s, const IntVarArgs& p,
03250         const IntVarArgs& e, IntPropLevel ipl=IPL_DEF);
03251 
03280   GECODE_INT_EXPORT void
03281   unary(Home home, const IntVarArgs& s, const IntVarArgs& p,
03282         const IntVarArgs& e, const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
03283 
03284 
03285 
03328   GECODE_INT_EXPORT void
03329   cumulative(Home home, int c, const TaskTypeArgs& t,
03330              const IntVarArgs& flex, const IntArgs& fix, const IntArgs& u,
03331              IntPropLevel ipl=IPL_DEF);
03332 
03333 
03338   GECODE_INT_EXPORT void
03339   cumulative(Home home, IntVar c, const TaskTypeArgs& t,
03340              const IntVarArgs& flex, const IntArgs& fix, const IntArgs& u,
03341              IntPropLevel ipl=IPL_DEF);
03342 
03387   GECODE_INT_EXPORT void
03388   cumulative(Home home, int c, const TaskTypeArgs& t,
03389              const IntVarArgs& flex, const IntArgs& fix, const IntArgs& u,
03390              const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
03391 
03395   GECODE_INT_EXPORT void
03396   cumulative(Home home, IntVar c, const TaskTypeArgs& t,
03397              const IntVarArgs& flex, const IntArgs& fix, const IntArgs& u,
03398              const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
03399 
03432   GECODE_INT_EXPORT void
03433   cumulative(Home home, int c, const IntVarArgs& s, const IntArgs& p,
03434              const IntArgs& u, IntPropLevel ipl=IPL_DEF);
03435 
03439   GECODE_INT_EXPORT void
03440   cumulative(Home home, IntVar c, const IntVarArgs& s, const IntArgs& p,
03441              const IntArgs& u, IntPropLevel ipl=IPL_DEF);
03442 
03477   GECODE_INT_EXPORT void
03478   cumulative(Home home, int c, const IntVarArgs& s, const IntArgs& p,
03479              const IntArgs& u, const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
03480 
03484   GECODE_INT_EXPORT void
03485   cumulative(Home home, IntVar c, const IntVarArgs& s, const IntArgs& p,
03486              const IntArgs& u, const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
03487 
03524   GECODE_INT_EXPORT void
03525   cumulative(Home home, int c, const IntVarArgs& s, const IntVarArgs& p,
03526              const IntVarArgs& e, const IntArgs& u, IntPropLevel ipl=IPL_DEF);
03527 
03531   GECODE_INT_EXPORT void
03532   cumulative(Home home, IntVar c, const IntVarArgs& s, const IntVarArgs& p,
03533              const IntVarArgs& e, const IntArgs& u, IntPropLevel ipl=IPL_DEF);
03534 
03573   GECODE_INT_EXPORT void
03574   cumulative(Home home, int c, const IntVarArgs& s, const IntVarArgs& p,
03575              const IntVarArgs& e, const IntArgs& u, const BoolVarArgs& m,
03576              IntPropLevel ipl=IPL_DEF);
03577 
03581   GECODE_INT_EXPORT void
03582   cumulative(Home home, IntVar c, const IntVarArgs& s, const IntVarArgs& p,
03583              const IntVarArgs& e, const IntArgs& u, const BoolVarArgs& m,
03584              IntPropLevel ipl=IPL_DEF);
03586 
03587 
03607   GECODE_INT_EXPORT void
03608   circuit(Home home, const IntVarArgs& x,
03609           IntPropLevel ipl=IPL_DEF);
03625   GECODE_INT_EXPORT void
03626   circuit(Home home, int offset, const IntVarArgs& x,
03627           IntPropLevel ipl=IPL_DEF);
03649   GECODE_INT_EXPORT void
03650   circuit(Home home,
03651           const IntArgs& c,
03652           const IntVarArgs& x, const IntVarArgs& y, IntVar z,
03653           IntPropLevel ipl=IPL_DEF);
03676   GECODE_INT_EXPORT void
03677   circuit(Home home,
03678           const IntArgs& c, int offset,
03679           const IntVarArgs& x, const IntVarArgs& y, IntVar z,
03680           IntPropLevel ipl=IPL_DEF);
03699   GECODE_INT_EXPORT void
03700   circuit(Home home,
03701           const IntArgs& c,
03702           const IntVarArgs& x, IntVar z,
03703           IntPropLevel ipl=IPL_DEF);
03724   GECODE_INT_EXPORT void
03725   circuit(Home home,
03726           const IntArgs& c, int offset,
03727           const IntVarArgs& x, IntVar z,
03728           IntPropLevel ipl=IPL_DEF);
03744   GECODE_INT_EXPORT void
03745   path(Home home, const IntVarArgs& x, IntVar s, IntVar e,
03746        IntPropLevel ipl=IPL_DEF);
03764   GECODE_INT_EXPORT void
03765   path(Home home, int offset, const IntVarArgs& x, IntVar s, IntVar e,
03766        IntPropLevel ipl=IPL_DEF);
03789   GECODE_INT_EXPORT void
03790   path(Home home,
03791        const IntArgs& c,
03792        const IntVarArgs& x, IntVar s, IntVar e, const IntVarArgs& y, IntVar z,
03793        IntPropLevel ipl=IPL_DEF);
03818   GECODE_INT_EXPORT void
03819   path(Home home,
03820        const IntArgs& c, int offset,
03821        const IntVarArgs& x, IntVar s, IntVar e, const IntVarArgs& y, IntVar z,
03822        IntPropLevel ipl=IPL_DEF);
03843   GECODE_INT_EXPORT void
03844   path(Home home,
03845        const IntArgs& c,
03846        const IntVarArgs& x, IntVar s, IntVar e, IntVar z,
03847        IntPropLevel ipl=IPL_DEF);
03870   GECODE_INT_EXPORT void
03871   path(Home home,
03872        const IntArgs& c, int offset,
03873        const IntVarArgs& x, IntVar s, IntVar e, IntVar z,
03874        IntPropLevel ipl=IPL_DEF);
03876 
03877 
03878 
03887 
03888   GECODE_INT_EXPORT void
03889   wait(Home home, IntVar x, std::function<void(Space& home)> c,
03890        IntPropLevel ipl=IPL_DEF);
03892   GECODE_INT_EXPORT void
03893   wait(Home home, BoolVar x, std::function<void(Space& home)> c,
03894        IntPropLevel ipl=IPL_DEF);
03896   GECODE_INT_EXPORT void
03897   wait(Home home, const IntVarArgs& x, std::function<void(Space& home)> c,
03898        IntPropLevel ipl=IPL_DEF);
03900   GECODE_INT_EXPORT void
03901   wait(Home home, const BoolVarArgs& x,
03902        std::function<void(Space& home)> c,
03903        IntPropLevel ipl=IPL_DEF);
03905   GECODE_INT_EXPORT void
03906   when(Home home, BoolVar x,
03907        std::function<void(Space& home)> t,
03908        std::function<void(Space& home)> e,
03909        IntPropLevel ipl=IPL_DEF);
03911   GECODE_INT_EXPORT void
03912   when(Home home, BoolVar x,
03913        std::function<void(Space& home)> t,
03914        IntPropLevel ipl=IPL_DEF);
03916 
03917 
03942   GECODE_INT_EXPORT void
03943   unshare(Home home, IntVarArgs& x,
03944           IntPropLevel ipl=IPL_DEF);
03946   GECODE_INT_EXPORT void
03947   unshare(Home home, BoolVarArgs& x,
03948           IntPropLevel ipl=IPL_DEF);
03950 
03951 }
03952 
03953 namespace Gecode {
03954 
03968   typedef std::function<bool(const Space& home, IntVar x, int i)>
03969     IntBranchFilter;
03978   typedef std::function<bool(const Space& home, BoolVar x, int i)>
03979     BoolBranchFilter;
03980 
03990   typedef std::function<double(const Space& home, IntVar x, int i)> 
03991     IntBranchMerit;
04001   typedef std::function<double(const Space& home, BoolVar x, int i)>
04002     BoolBranchMerit;
04003 
04014   typedef std::function<int(const Space& home, IntVar x, int i)>
04015     IntBranchVal;
04026   typedef std::function<int(const Space& home, BoolVar x, int i)>
04027     BoolBranchVal;
04028 
04040   typedef std::function<void(Space& home, unsigned int a,
04041                              IntVar x, int i, int n)>
04042     IntBranchCommit;
04054   typedef std::function<void(Space& home, unsigned int a,
04055                              BoolVar x, int i, int n)>
04056     BoolBranchCommit;
04057 
04058 }
04059 
04060 #include <gecode/int/branch/traits.hpp>
04061 
04062 namespace Gecode {
04063 
04069   class IntAFC : public AFC {
04070   public:
04078     IntAFC(void);
04080     IntAFC(const IntAFC& a);
04082     IntAFC& operator =(const IntAFC& a);
04090     IntAFC(Home home, const IntVarArgs& x, double d=1.0, bool share=true);
04101     void init(Home home, const IntVarArgs& x, double d=1.0, bool share=true);
04102   };
04103 
04109   class BoolAFC : public AFC {
04110   public:
04118     BoolAFC(void);
04120     BoolAFC(const BoolAFC& a);
04122     BoolAFC& operator =(const BoolAFC& a);
04130     BoolAFC(Home home, const BoolVarArgs& x, double d=1.0, bool share=true);
04141     void init(Home home, const BoolVarArgs& x, double d=1.0, bool share=true);
04142   };
04143 
04144 }
04145 
04146 #include <gecode/int/branch/afc.hpp>
04147 
04148 namespace Gecode {
04149 
04155   class IntAction : public Action {
04156   public:
04164     IntAction(void);
04166     IntAction(const IntAction& a);
04168     IntAction& operator =(const IntAction& a);
04176     GECODE_INT_EXPORT
04177     IntAction(Home home, const IntVarArgs& x, double d=1.0,
04178               IntBranchMerit bm=nullptr);
04190     GECODE_INT_EXPORT void
04191     init(Home home, const IntVarArgs& x, double d=1.0,
04192          IntBranchMerit bm=nullptr);
04193   };
04194 
04200   class BoolAction : public Action {
04201   public:
04209     BoolAction(void);
04211     BoolAction(const BoolAction& a);
04213     BoolAction& operator =(const BoolAction& a);
04221     GECODE_INT_EXPORT
04222     BoolAction(Home home, const BoolVarArgs& x, double d=1.0,
04223                BoolBranchMerit bm=nullptr);
04235     GECODE_INT_EXPORT void
04236     init(Home home, const BoolVarArgs& x, double d=1.0,
04237          BoolBranchMerit bm=nullptr);
04238   };
04239 
04240 }
04241 
04242 #include <gecode/int/branch/action.hpp>
04243 
04244 namespace Gecode {
04245 
04251   class IntCHB : public CHB {
04252   public:
04260     IntCHB(void);
04262     IntCHB(const IntCHB& chb);
04264     IntCHB& operator =(const IntCHB& chb);
04273     GECODE_INT_EXPORT
04274     IntCHB(Home home, const IntVarArgs& x, IntBranchMerit bm=nullptr);
04286     GECODE_INT_EXPORT void
04287     init(Home home, const IntVarArgs& x, IntBranchMerit bm=nullptr);
04288   };
04289 
04295   class BoolCHB : public CHB {
04296   public:
04304     BoolCHB(void);
04306     BoolCHB(const BoolCHB& chb);
04308     BoolCHB& operator =(const BoolCHB& chb);
04317     GECODE_INT_EXPORT
04318     BoolCHB(Home home, const BoolVarArgs& x, BoolBranchMerit bm=nullptr);
04330     GECODE_INT_EXPORT void
04331     init(Home home, const BoolVarArgs& x, BoolBranchMerit bm=nullptr);
04332   };
04333 
04334 }
04335 
04336 #include <gecode/int/branch/chb.hpp>
04337 
04338 namespace Gecode {
04339 
04341   typedef std::function<void(const Space &home, const Brancher& b,
04342                              unsigned int a,
04343                              IntVar x, int i, const int& n,
04344                              std::ostream& o)>
04345     IntVarValPrint;
04346 
04348   typedef std::function<void(const Space &home, const Brancher& b,
04349                              unsigned int a,
04350                              BoolVar x, int i, const int& n,
04351                              std::ostream& o)>
04352     BoolVarValPrint;
04353 
04354 }
04355 
04356 namespace Gecode {
04357 
04363   class IntVarBranch : public VarBranch<IntVar> {
04364   public:
04366     enum Select {
04367       SEL_NONE = 0,        
04368       SEL_RND,             
04369       SEL_MERIT_MIN,       
04370       SEL_MERIT_MAX,       
04371       SEL_DEGREE_MIN,      
04372       SEL_DEGREE_MAX,      
04373       SEL_AFC_MIN,         
04374       SEL_AFC_MAX,         
04375       SEL_ACTION_MIN,      
04376       SEL_ACTION_MAX,      
04377       SEL_CHB_MIN,         
04378       SEL_CHB_MAX,         
04379       SEL_MIN_MIN,         
04380       SEL_MIN_MAX,         
04381       SEL_MAX_MIN,         
04382       SEL_MAX_MAX,         
04383       SEL_SIZE_MIN,        
04384       SEL_SIZE_MAX,        
04385       SEL_DEGREE_SIZE_MIN, 
04386       SEL_DEGREE_SIZE_MAX, 
04387       SEL_AFC_SIZE_MIN,    
04388       SEL_AFC_SIZE_MAX,    
04389       SEL_ACTION_SIZE_MIN, 
04390       SEL_ACTION_SIZE_MAX, 
04391       SEL_CHB_SIZE_MIN,    
04392       SEL_CHB_SIZE_MAX,    
04393 
04398       SEL_REGRET_MIN_MIN,
04404       SEL_REGRET_MIN_MAX,
04410       SEL_REGRET_MAX_MIN,
04416       SEL_REGRET_MAX_MAX
04417     };
04418   protected:
04420     Select s;
04421   public:
04423     IntVarBranch(void);
04425     IntVarBranch(Rnd r);
04427     IntVarBranch(Select s, BranchTbl t);
04429     IntVarBranch(Select s, double d, BranchTbl t);
04431     IntVarBranch(Select s, IntAFC a, BranchTbl t);
04433     IntVarBranch(Select s, IntAction a, BranchTbl t);
04435     IntVarBranch(Select s, IntCHB c, BranchTbl t);
04437     IntVarBranch(Select s, IntBranchMerit mf, BranchTbl t);
04439     Select select(void) const;
04441     void expand(Home home, const IntVarArgs& x);
04442   };
04443 
04449   class BoolVarBranch : public VarBranch<BoolVar> {
04450   public:
04452     enum Select {
04453       SEL_NONE = 0,        
04454       SEL_RND,             
04455       SEL_MERIT_MIN,       
04456       SEL_MERIT_MAX,       
04457       SEL_DEGREE_MIN,      
04458       SEL_DEGREE_MAX,      
04459       SEL_AFC_MIN,         
04460       SEL_AFC_MAX,         
04461       SEL_ACTION_MIN,      
04462       SEL_ACTION_MAX,      
04463       SEL_CHB_MIN,         
04464       SEL_CHB_MAX          
04465     };
04466   protected:
04468     Select s;
04469   public:
04471     BoolVarBranch(void);
04473     BoolVarBranch(Rnd r);
04475     BoolVarBranch(Select s, BranchTbl t);
04477     BoolVarBranch(Select s, double d, BranchTbl t);
04479     BoolVarBranch(Select s, BoolAFC a, BranchTbl t);
04481     BoolVarBranch(Select s, BoolAction a, BranchTbl t);
04483     BoolVarBranch(Select s, BoolCHB c, BranchTbl t);
04485     BoolVarBranch(Select s, BoolBranchMerit mf, BranchTbl t);
04487     Select select(void) const;
04489     void expand(Home home, const BoolVarArgs& x);
04490   };
04491 
04497 
04498   IntVarBranch INT_VAR_NONE(void);
04500   IntVarBranch INT_VAR_RND(Rnd r);
04502   IntVarBranch INT_VAR_MERIT_MIN(IntBranchMerit bm, BranchTbl tbl=nullptr);
04504   IntVarBranch INT_VAR_MERIT_MAX(IntBranchMerit bm, BranchTbl tbl=nullptr);
04506   IntVarBranch INT_VAR_DEGREE_MIN(BranchTbl tbl=nullptr);
04508   IntVarBranch INT_VAR_DEGREE_MAX(BranchTbl tbl=nullptr);
04510   IntVarBranch INT_VAR_AFC_MIN(double d=1.0, BranchTbl tbl=nullptr);
04512   IntVarBranch INT_VAR_AFC_MIN(IntAFC a, BranchTbl tbl=nullptr);
04514   IntVarBranch INT_VAR_AFC_MAX(double d=1.0, BranchTbl tbl=nullptr);
04516   IntVarBranch INT_VAR_AFC_MAX(IntAFC a, BranchTbl tbl=nullptr);
04518   IntVarBranch INT_VAR_ACTION_MIN(double d=1.0, BranchTbl tbl=nullptr);
04520   IntVarBranch INT_VAR_ACTION_MIN(IntAction a, BranchTbl tbl=nullptr);
04522   IntVarBranch INT_VAR_ACTION_MAX(double d=1.0, BranchTbl tbl=nullptr);
04524   IntVarBranch INT_VAR_ACTION_MAX(IntAction a, BranchTbl tbl=nullptr);
04526   IntVarBranch INT_VAR_CHB_MIN(IntCHB c, BranchTbl tbl=nullptr);
04528   IntVarBranch INT_VAR_CHB_MIN(BranchTbl tbl=nullptr);
04530   IntVarBranch INT_VAR_CHB_MAX(IntCHB c, BranchTbl tbl=nullptr);
04532   IntVarBranch INT_VAR_CHB_MAX(BranchTbl tbl=nullptr);
04534   IntVarBranch INT_VAR_MIN_MIN(BranchTbl tbl=nullptr);
04536   IntVarBranch INT_VAR_MIN_MAX(BranchTbl tbl=nullptr);
04538   IntVarBranch INT_VAR_MAX_MIN(BranchTbl tbl=nullptr);
04540   IntVarBranch INT_VAR_MAX_MAX(BranchTbl tbl=nullptr);
04542   IntVarBranch INT_VAR_SIZE_MIN(BranchTbl tbl=nullptr);
04544   IntVarBranch INT_VAR_SIZE_MAX(BranchTbl tbl=nullptr);
04546   IntVarBranch INT_VAR_DEGREE_SIZE_MIN(BranchTbl tbl=nullptr);
04548   IntVarBranch INT_VAR_DEGREE_SIZE_MAX(BranchTbl tbl=nullptr);
04550   IntVarBranch INT_VAR_AFC_SIZE_MIN(double d=1.0, BranchTbl tbl=nullptr);
04552   IntVarBranch INT_VAR_AFC_SIZE_MIN(IntAFC a, BranchTbl tbl=nullptr);
04554   IntVarBranch INT_VAR_AFC_SIZE_MAX(double d=1.0, BranchTbl tbl=nullptr);
04556   IntVarBranch INT_VAR_AFC_SIZE_MAX(IntAFC a, BranchTbl tbl=nullptr);
04558   IntVarBranch INT_VAR_ACTION_SIZE_MIN(double d=1.0, BranchTbl tbl=nullptr);
04560   IntVarBranch INT_VAR_ACTION_SIZE_MIN(IntAction a, BranchTbl tbl=nullptr);
04562   IntVarBranch INT_VAR_ACTION_SIZE_MAX(double d=1.0, BranchTbl tbl=nullptr);
04564   IntVarBranch INT_VAR_ACTION_SIZE_MAX(IntAction a, BranchTbl tbl=nullptr);
04566   IntVarBranch INT_VAR_CHB_SIZE_MIN(IntCHB c, BranchTbl tbl=nullptr);
04568   IntVarBranch INT_VAR_CHB_SIZE_MIN(BranchTbl tbl=nullptr);
04570   IntVarBranch INT_VAR_CHB_SIZE_MAX(IntCHB c, BranchTbl tbl=nullptr);
04572   IntVarBranch INT_VAR_CHB_SIZE_MAX(BranchTbl tbl=nullptr);
04578   IntVarBranch INT_VAR_REGRET_MIN_MIN(BranchTbl tbl=nullptr);
04584   IntVarBranch INT_VAR_REGRET_MIN_MAX(BranchTbl tbl=nullptr);
04590   IntVarBranch INT_VAR_REGRET_MAX_MIN(BranchTbl tbl=nullptr);
04596   IntVarBranch INT_VAR_REGRET_MAX_MAX(BranchTbl tbl=nullptr);
04597 
04599   BoolVarBranch BOOL_VAR_NONE(void);
04601   BoolVarBranch BOOL_VAR_RND(Rnd r);
04603   BoolVarBranch BOOL_VAR_MERIT_MIN(BoolBranchMerit bm, BranchTbl tbl=nullptr);
04605   BoolVarBranch BOOL_VAR_MERIT_MAX(BoolBranchMerit bm, BranchTbl tbl=nullptr);
04607   BoolVarBranch BOOL_VAR_DEGREE_MIN(BranchTbl tbl=nullptr);
04609   BoolVarBranch BOOL_VAR_DEGREE_MAX(BranchTbl tbl=nullptr);
04611   BoolVarBranch BOOL_VAR_AFC_MIN(double d=1.0, BranchTbl tbl=nullptr);
04613   BoolVarBranch BOOL_VAR_AFC_MIN(BoolAFC a, BranchTbl tbl=nullptr);
04615   BoolVarBranch BOOL_VAR_AFC_MAX(double d=1.0, BranchTbl tbl=nullptr);
04617   BoolVarBranch BOOL_VAR_AFC_MAX(BoolAFC a, BranchTbl tbl=nullptr);
04619   BoolVarBranch BOOL_VAR_ACTION_MIN(double d=1.0, BranchTbl tbl=nullptr);
04621   BoolVarBranch BOOL_VAR_ACTION_MIN(BoolAction a, BranchTbl tbl=nullptr);
04623   BoolVarBranch BOOL_VAR_ACTION_MAX(double d=1.0, BranchTbl tbl=nullptr);
04625   BoolVarBranch BOOL_VAR_ACTION_MAX(BoolAction a, BranchTbl tbl=nullptr);
04627   BoolVarBranch BOOL_VAR_CHB_MIN(BoolCHB c, BranchTbl tbl=nullptr);
04629   BoolVarBranch BOOL_VAR_CHB_MIN(BranchTbl tbl=nullptr);
04631   BoolVarBranch BOOL_VAR_CHB_MAX(BoolCHB c, BranchTbl tbl=nullptr);
04633   BoolVarBranch BOOL_VAR_CHB_MAX(BranchTbl tbl=nullptr);
04635 
04636 }
04637 
04638 #include <gecode/int/branch/var.hpp>
04639 
04640 namespace Gecode {
04641 
04647   class IntValBranch : public ValBranch<IntVar> {
04648   public:
04650     enum Select {
04651       SEL_MIN,        
04652       SEL_MED,        
04653       SEL_MAX,        
04654       SEL_RND,        
04655       SEL_SPLIT_MIN,  
04656       SEL_SPLIT_MAX,  
04657       SEL_RANGE_MIN,  
04658       SEL_RANGE_MAX,  
04659       SEL_VAL_COMMIT, 
04660       SEL_VALUES_MIN, 
04661       SEL_VALUES_MAX  
04662    };
04663   protected:
04665     Select s;
04666   public:
04668     IntValBranch(Select s = SEL_MIN);
04670     IntValBranch(Rnd r);
04672     IntValBranch(IntBranchVal v, IntBranchCommit c);
04674     Select select(void) const;
04675   };
04676 
04682   class BoolValBranch : public ValBranch<BoolVar> {
04683   public:
04685     enum Select {
04686       SEL_MIN,       
04687       SEL_MAX,       
04688       SEL_RND,       
04689       SEL_VAL_COMMIT 
04690    };
04691   protected:
04693     Select s;
04694   public:
04696     BoolValBranch(Select s = SEL_MIN);
04698     BoolValBranch(Rnd r);
04700     BoolValBranch(BoolBranchVal v, BoolBranchCommit c);
04702     Select select(void) const;
04703   };
04704 
04710 
04711   IntValBranch INT_VAL_MIN(void);
04713   IntValBranch INT_VAL_MED(void);
04715   IntValBranch INT_VAL_MAX(void);
04717   IntValBranch INT_VAL_RND(Rnd r);
04719   IntValBranch INT_VAL_SPLIT_MIN(void);
04721   IntValBranch INT_VAL_SPLIT_MAX(void);
04723   IntValBranch INT_VAL_RANGE_MIN(void);
04725   IntValBranch INT_VAL_RANGE_MAX(void);
04732   IntValBranch INT_VAL(IntBranchVal v, IntBranchCommit c=nullptr);
04734   IntValBranch INT_VALUES_MIN(void);
04736   IntValBranch INT_VALUES_MAX(void);
04737 
04739   BoolValBranch BOOL_VAL_MIN(void);
04741   BoolValBranch BOOL_VAL_MAX(void);
04743   BoolValBranch BOOL_VAL_RND(Rnd r);
04750   BoolValBranch BOOL_VAL(BoolBranchVal v, BoolBranchCommit c=nullptr);
04752 
04753 }
04754 
04755 #include <gecode/int/branch/val.hpp>
04756 
04757 namespace Gecode {
04758 
04764   class IntAssign : public ValBranch<IntVar> {
04765   public:
04767     enum Select {
04768       SEL_MIN,       
04769       SEL_MED,       
04770       SEL_MAX,       
04771       SEL_RND,       
04772       SEL_VAL_COMMIT 
04773     };
04774   protected:
04776     Select s;
04777   public:
04779     IntAssign(Select s = SEL_MIN);
04781     IntAssign(Rnd r);
04783     IntAssign(IntBranchVal v, IntBranchCommit c);
04785     Select select(void) const;
04786   };
04787 
04793   class BoolAssign : public ValBranch<BoolVar> {
04794   public:
04796     enum Select {
04797       SEL_MIN,       
04798       SEL_MAX,       
04799       SEL_RND,       
04800       SEL_VAL_COMMIT 
04801     };
04802   protected:
04804     Select s;
04805   public:
04807     BoolAssign(Select s = SEL_MIN);
04809     BoolAssign(Rnd r);
04811     BoolAssign(BoolBranchVal v, BoolBranchCommit c);
04813     Select select(void) const;
04814   };
04815 
04821 
04822   IntAssign INT_ASSIGN_MIN(void);
04824   IntAssign INT_ASSIGN_MED(void);
04826   IntAssign INT_ASSIGN_MAX(void);
04828   IntAssign INT_ASSIGN_RND(Rnd r);
04835   IntAssign INT_ASSIGN(IntBranchVal v, IntBranchCommit c=nullptr);
04836 
04838   BoolAssign BOOL_ASSIGN_MIN(void);
04840   BoolAssign BOOL_ASSIGN_MAX(void);
04842   BoolAssign BOOL_ASSIGN_RND(Rnd r);
04849   BoolAssign BOOL_ASSIGN(BoolBranchVal v, BoolBranchCommit c=nullptr);
04851 
04852 }
04853 
04854 #include <gecode/int/branch/assign.hpp>
04855 
04856 namespace Gecode {
04862   GECODE_INT_EXPORT void
04863   branch(Home home, const IntVarArgs& x,
04864          IntVarBranch vars, IntValBranch vals,
04865          IntBranchFilter bf=nullptr,
04866          IntVarValPrint vvp=nullptr);
04872   GECODE_INT_EXPORT void
04873   branch(Home home, const IntVarArgs& x,
04874          TieBreak<IntVarBranch> vars, IntValBranch vals,
04875          IntBranchFilter bf=nullptr,
04876          IntVarValPrint vvp=nullptr);
04882   GECODE_INT_EXPORT void
04883   branch(Home home, IntVar x, IntValBranch vals,
04884          IntVarValPrint vvp=nullptr);
04890   GECODE_INT_EXPORT void
04891   branch(Home home, const BoolVarArgs& x,
04892          BoolVarBranch vars, BoolValBranch vals,
04893          BoolBranchFilter bf=nullptr,
04894          BoolVarValPrint vvp=nullptr);
04900   GECODE_INT_EXPORT void
04901   branch(Home home, const BoolVarArgs& x,
04902          TieBreak<BoolVarBranch> vars, BoolValBranch vals,
04903          BoolBranchFilter bf=nullptr,
04904          BoolVarValPrint vvp=nullptr);
04910   GECODE_INT_EXPORT void
04911   branch(Home home, BoolVar x, BoolValBranch vals,
04912          BoolVarValPrint vvp=nullptr);
04913 
04919   GECODE_INT_EXPORT void
04920   assign(Home home, const IntVarArgs& x, IntAssign vals,
04921          IntBranchFilter bf=nullptr,
04922          IntVarValPrint vvp=nullptr);
04928   GECODE_INT_EXPORT void
04929   assign(Home home, IntVar x, IntAssign vals,
04930          IntVarValPrint vvp=nullptr);
04936   GECODE_INT_EXPORT void
04937   assign(Home home, const BoolVarArgs& x, BoolAssign vals,
04938          BoolBranchFilter bf=nullptr,
04939          BoolVarValPrint vvp=nullptr);
04945   GECODE_INT_EXPORT void
04946   assign(Home home, BoolVar x, BoolAssign vals,
04947          BoolVarValPrint vvp=nullptr);
04948 
04949 }
04950 
04951 namespace Gecode {
04952 
04956   template<class Char, class Traits>
04957   std::basic_ostream<Char,Traits>&
04958   operator <<(std::basic_ostream<Char,Traits>& os, const DFA& d);
04959 
04963   template<class Char, class Traits>
04964   std::basic_ostream<Char,Traits>&
04965   operator <<(std::basic_ostream<Char,Traits>& os, const TupleSet& ts);
04966 
04967 }
04968 
04969 // LDSB-related declarations.
04970 namespace Gecode {
04971 
04972   namespace Int { namespace LDSB {
04973     class SymmetryObject;
04974   }}
04975 
04981   class GECODE_INT_EXPORT SymmetryHandle {
04982   public:
04984     Int::LDSB::SymmetryObject* ref;
04986     void increment(void);
04988     void decrement(void);
04989   public:
04991     SymmetryHandle(void);
04993     SymmetryHandle(Int::LDSB::SymmetryObject* o);
04995     SymmetryHandle(const SymmetryHandle& h);
04997     const SymmetryHandle& operator=(const SymmetryHandle& h);
04999     ~SymmetryHandle(void);
05000   };
05001   class Symmetries;
05003   template<>
05004   class ArrayTraits<ArgArray<SymmetryHandle> > {
05005   public:
05006     typedef Symmetries     StorageType;
05007     typedef SymmetryHandle ValueType;
05008     typedef Symmetries     ArgsType;
05009   };
05010 
05017 
05018   class Symmetries : public ArgArray<SymmetryHandle> {};
05019   // If this is instead a typedef, strange things happen with the
05020   // overloading of the "branch" function.
05021 
05023   GECODE_INT_EXPORT SymmetryHandle VariableSymmetry(const IntVarArgs& x);
05025   GECODE_INT_EXPORT SymmetryHandle VariableSymmetry(const BoolVarArgs& x);
05027   GECODE_INT_EXPORT SymmetryHandle VariableSymmetry(const IntVarArgs& x,
05028                                                     const IntArgs& indices);
05030   GECODE_INT_EXPORT SymmetryHandle ValueSymmetry(const IntArgs& v);
05032   GECODE_INT_EXPORT SymmetryHandle ValueSymmetry(const IntSet& v);
05034   GECODE_INT_EXPORT SymmetryHandle ValueSymmetry(IntVar vars);
05040   GECODE_INT_EXPORT
05041   SymmetryHandle VariableSequenceSymmetry(const IntVarArgs& x, int ss);
05047   GECODE_INT_EXPORT
05048   SymmetryHandle VariableSequenceSymmetry(const BoolVarArgs& x, int ss);
05054   GECODE_INT_EXPORT
05055   SymmetryHandle ValueSequenceSymmetry(const IntArgs& v, int ss);
05056 
05058   GECODE_INT_EXPORT SymmetryHandle values_reflect(int lower, int upper);
05060   GECODE_INT_EXPORT SymmetryHandle values_reflect(IntVar x);
05062 
05074   GECODE_INT_EXPORT void
05075   branch(Home home, const IntVarArgs& x,
05076          IntVarBranch vars, IntValBranch vals,
05077          const Symmetries& syms,
05078          IntBranchFilter bf=nullptr,
05079          IntVarValPrint vvp=nullptr);
05091   GECODE_INT_EXPORT void
05092   branch(Home home, const IntVarArgs& x,
05093          TieBreak<IntVarBranch> vars, IntValBranch vals,
05094          const Symmetries& syms,
05095          IntBranchFilter bf=nullptr,
05096          IntVarValPrint vvp=nullptr);
05108   GECODE_INT_EXPORT void
05109   branch(Home home, const BoolVarArgs& x,
05110          BoolVarBranch vars, BoolValBranch vals,
05111          const Symmetries& syms,
05112          BoolBranchFilter bf=nullptr,
05113          BoolVarValPrint vvp=nullptr);
05125   GECODE_INT_EXPORT void
05126   branch(Home home, const BoolVarArgs& x,
05127          TieBreak<BoolVarBranch> vars, BoolValBranch vals,
05128          const Symmetries& syms,
05129          BoolBranchFilter bf=nullptr,
05130          BoolVarValPrint vvp=nullptr);
05131 }
05132 
05133 namespace Gecode {
05134 
05135   /*
05136    * \brief Relaxed assignment of variables in \a x from values in \a sx
05137    *
05138    * The variables in \a x are assigned values from the assigned variables
05139    * in the solution \a sx with a relaxation probability \a p. That is,
05140    * if \$fp=0.1\f$ approximately 10% of the variables in \a x will be
05141    * assigned a value from \a sx.
05142    *
05143    * The random numbers are generated from the generator \a r. At least
05144    * one variable will not be assigned: in case the relaxation attempt
05145    * would suggest that all variables should be assigned, a single
05146    * variable will be selected randomly to remain unassigned.
05147    *
05148    * Throws an exception of type Int::ArgumentSizeMismatch, if \a x and
05149    * \a sx are of different size.
05150    *
05151    * Throws an exception of type Int::OutOfLimits, if \a p is not between
05152    * \a 0.0 and \a 1.0.
05153    *
05154    * \ingroup TaskModelInt
05155    */
05156   GECODE_INT_EXPORT void
05157   relax(Home home, const IntVarArgs& x, const IntVarArgs& sx,
05158         Rnd r, double p);
05159 
05160   /*
05161    * \brief Relaxed assignment of variables in \a x from values in \a sx
05162    *
05163    * The variables in \a x are assigned values from the assigned variables
05164    * in the solution \a sx with a relaxation probability \a p. That is,
05165    * if \$fp=0.1\f$ approximately 10% of the variables in \a x will be
05166    * assigned a value from \a sx.
05167    *
05168    * The random numbers are generated from the generator \a r. At least
05169    * one variable will not be assigned: in case the relaxation attempt
05170    * would suggest that all variables should be assigned, a single
05171    * variable will be selected randomly to remain unassigned.
05172    *
05173    * Throws an exception of type Int::ArgumentSizeMismatch, if \a x and
05174    * \a sx are of different size.
05175    *
05176    * Throws an exception of type Int::OutOfLimits, if \a p is not between
05177    * \a 0.0 and \a 1.0.
05178    *
05179    * \ingroup TaskModelInt
05180    */
05181   GECODE_INT_EXPORT void
05182   relax(Home home, const BoolVarArgs& x, const BoolVarArgs& sx,
05183         Rnd r, double p);
05184 
05185 }
05186 
05187 
05188 #include <gecode/int/trace/int-trace-view.hpp>
05189 #include <gecode/int/trace/bool-trace-view.hpp>
05190 
05191 namespace Gecode {
05192 
05202   class IntTraceDelta
05203     : public Iter::Ranges::Diff<Iter::Ranges::RangeList,
05204                                 Int::ViewRanges<Int::IntView> > {
05205   protected:
05207     Int::ViewRanges<Int::IntView> rn;
05209     Iter::Ranges::RangeList ro;
05210   public:
05212 
05213 
05214     IntTraceDelta(Int::IntTraceView o, Int::IntView n, const Delta& d);
05216   };
05217 
05222   class BoolTraceDelta {
05223   protected:
05225     int delta;
05226   public:
05228 
05229 
05230     BoolTraceDelta(Int::BoolTraceView o, Int::BoolView n, const Delta& d);
05232 
05233 
05234 
05235     bool operator ()(void) const;
05237     void operator ++(void);
05239 
05241 
05242 
05243     int min(void) const;
05245     int max(void) const;
05247     unsigned int width(void) const;
05249   };
05250 
05251 }
05252 
05253 #include <gecode/int/trace/int-delta.hpp>
05254 #include <gecode/int/trace/bool-delta.hpp>
05255 
05256 #include <gecode/int/trace/traits.hpp>
05257 
05258 namespace Gecode {
05259 
05264   typedef ViewTracer<Int::IntView> IntTracer;
05269   typedef ViewTraceRecorder<Int::IntView> IntTraceRecorder;
05270 
05275   class GECODE_INT_EXPORT StdIntTracer : public IntTracer {
05276   protected:
05278     std::ostream& os;
05279   public:
05281     StdIntTracer(std::ostream& os0 = std::cerr);
05283     virtual void init(const Space& home, const IntTraceRecorder& t);
05285     virtual void prune(const Space& home, const IntTraceRecorder& t,
05286                        const ViewTraceInfo& vti, int i, IntTraceDelta& d);
05288     virtual void fix(const Space& home, const IntTraceRecorder& t);
05290     virtual void fail(const Space& home, const IntTraceRecorder& t);
05292     virtual void done(const Space& home, const IntTraceRecorder& t);
05294     static StdIntTracer def;
05295   };
05296 
05297 
05302   typedef ViewTracer<Int::BoolView> BoolTracer;
05307   typedef ViewTraceRecorder<Int::BoolView> BoolTraceRecorder;
05308 
05313   class GECODE_INT_EXPORT StdBoolTracer : public BoolTracer {
05314   protected:
05316     std::ostream& os;
05317   public:
05319     StdBoolTracer(std::ostream& os0 = std::cerr);
05321     virtual void init(const Space& home, const BoolTraceRecorder& t);
05323     virtual void prune(const Space& home, const BoolTraceRecorder& t,
05324                        const ViewTraceInfo& vti, int i, BoolTraceDelta& d);
05326     virtual void fix(const Space& home, const BoolTraceRecorder& t);
05328     virtual void fail(const Space& home, const BoolTraceRecorder& t);
05330     virtual void done(const Space& home, const BoolTraceRecorder& t);
05332     static StdBoolTracer def;
05333   };
05334 
05339   GECODE_INT_EXPORT void
05340   trace(Home home, const IntVarArgs& x,
05341         TraceFilter tf,
05342         int te = (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE),
05343         IntTracer& t = StdIntTracer::def);
05348   void
05349   trace(Home home, const IntVarArgs& x,
05350         int te = (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE),
05351         IntTracer& t = StdIntTracer::def);
05352 
05357   GECODE_INT_EXPORT void
05358   trace(Home home, const BoolVarArgs& x,
05359         TraceFilter tf,
05360         int te = (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE),
05361         BoolTracer& t = StdBoolTracer::def);
05366   void
05367   trace(Home home, const BoolVarArgs& x,
05368         int te = (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE),
05369         BoolTracer& t = StdBoolTracer::def);
05370 
05371 }
05372 
05373 #include <gecode/int/trace.hpp>
05374 
05375 #endif
05376 
05377 // IFDEF: GECODE_HAS_INT_VARS
05378 // STATISTICS: int-post
05379