Generated on Sun Feb 17 15:24:13 2019 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  *     Samuel Gagnon <samuel.gagnon92@gmail.com>
00012  *
00013  *  Copyright:
00014  *     Stefano Gualandi, 2013
00015  *     Mikael Lagerkvist, 2006
00016  *     David Rijsman, 2009
00017  *     Christian Schulte, 2002
00018  *     Guido Tack, 2004
00019  *     Samuel Gagnon, 2018
00020  *
00021  *  This file is part of Gecode, the generic constraint
00022  *  development environment:
00023  *     http://www.gecode.org
00024  *
00025  *  Permission is hereby granted, free of charge, to any person obtaining
00026  *  a copy of this software and associated documentation files (the
00027  *  "Software"), to deal in the Software without restriction, including
00028  *  without limitation the rights to use, copy, modify, merge, publish,
00029  *  distribute, sublicense, and/or sell copies of the Software, and to
00030  *  permit persons to whom the Software is furnished to do so, subject to
00031  *  the following conditions:
00032  *
00033  *  The above copyright notice and this permission notice shall be
00034  *  included in all copies or substantial portions of the Software.
00035  *
00036  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00037  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00038  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00039  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00040  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00041  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00042  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00043  *
00044  */
00045 
00046 #ifndef __GECODE_INT_HH__
00047 #define __GECODE_INT_HH__
00048 
00049 #include <climits>
00050 #include <cfloat>
00051 
00052 #include <iostream>
00053 #include <vector>
00054 #include <unordered_map>
00055 #include <functional>
00056 #include <utility>
00057 #include <initializer_list>
00058 
00059 #include <gecode/kernel.hh>
00060 #include <gecode/search.hh>
00061 #include <gecode/iter.hh>
00062 
00063 /*
00064  * Configure linking
00065  *
00066  */
00067 #if !defined(GECODE_STATIC_LIBS) && \
00068     (defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER))
00069 
00070 #ifdef GECODE_BUILD_INT
00071 #define GECODE_INT_EXPORT __declspec( dllexport )
00072 #else
00073 #define GECODE_INT_EXPORT __declspec( dllimport )
00074 #endif
00075 
00076 #else
00077 
00078 #ifdef GECODE_GCC_HAS_CLASS_VISIBILITY
00079 #define GECODE_INT_EXPORT __attribute__ ((visibility("default")))
00080 #else
00081 #define GECODE_INT_EXPORT
00082 #endif
00083 
00084 #endif
00085 
00086 // Configure auto-linking
00087 #ifndef GECODE_BUILD_INT
00088 #define GECODE_LIBRARY_NAME "Int"
00089 #include <gecode/support/auto-link.hpp>
00090 #endif
00091 
00103 #include <gecode/int/exception.hpp>
00104 
00105 namespace Gecode { namespace Int {
00106 
00114   namespace Limits {
00116     const int max = INT_MAX - 1;
00118     const int min = -max;
00120     const int infinity = max + 1;
00122     const long long int llmax =  LLONG_MAX - 1;
00124     const long long int llmin = -llmax;
00126     const long long int llinfinity = llmax + 1;
00128     bool valid(int n);
00130     bool valid(long long int n);
00132     void check(int n, const char* l);
00134     void check(long long int n, const char* l);
00136     void positive(int n, const char* l);
00138     void positive(long long int n, const char* l);
00140     void nonnegative(int n, const char* l);
00142     void nonnegative(long long int n, const char* l);
00144     bool overflow_add(int n, int m);
00146     bool overflow_add(long long int n, long long int m);
00148     bool overflow_sub(int n, int m);
00150     bool overflow_sub(long long int n, long long int m);
00152     bool overflow_mul(int n, int m);
00154     bool overflow_mul(long long int n, long long int m);
00155   }
00156 
00157 }}
00158 
00159 #include <gecode/int/limits.hpp>
00160 
00161 namespace Gecode {
00162 
00163   class IntSetRanges;
00164 
00165   template<class I> class IntSetInit;
00166 
00174   class IntSet : public SharedHandle {
00175     friend class IntSetRanges;
00176     template<class I> friend class IntSetInit;
00177   private:
00179     class Range {
00180     public:
00181       int min, max;
00182     };
00183     class IntSetObject : public SharedHandle::Object {
00184     public:
00186       unsigned int size;
00188       int n;
00190       Range* r;
00192       GECODE_INT_EXPORT static IntSetObject* allocate(int m);
00194       GECODE_INT_EXPORT bool in(int n) const;
00196       GECODE_INT_EXPORT bool equal(const IntSetObject& so) const; 
00198       GECODE_INT_EXPORT virtual ~IntSetObject(void);
00199     };
00201     class MinInc;
00203     GECODE_INT_EXPORT void normalize(Range* r, int n);
00205     GECODE_INT_EXPORT void init(int n, int m);
00207     GECODE_INT_EXPORT void init(const int r[], int n);
00209     GECODE_INT_EXPORT void init(const int r[][2], int n);
00210   public:
00212 
00213 
00214     IntSet(void);
00219     explicit IntSet(int n, int m);
00221     explicit IntSet(const int r[],   int n);
00227     explicit IntSet(const int r[][2], int n);
00229     template<class I>
00230     explicit IntSet(I& i);
00232     template<class I>
00233     explicit IntSet(const I& i);
00235     GECODE_INT_EXPORT 
00236     explicit IntSet(std::initializer_list<int> r);
00242     GECODE_INT_EXPORT
00243     explicit IntSet(std::initializer_list<std::pair<int,int>> r);
00245 
00247 
00248 
00249     int ranges(void) const;
00251     int min(int i) const;
00253     int max(int i) const;
00255     unsigned int width(int i) const;
00257 
00259 
00260 
00261     bool in(int n) const;
00263     unsigned int size(void) const;
00265     unsigned int width(void) const;
00267     int min(void) const;
00269     int max(void) const;
00271 
00273 
00274 
00275     bool operator ==(const IntSet& s) const;
00277     bool operator !=(const IntSet& s) const;
00279 
00281 
00282 
00283     GECODE_INT_EXPORT static const IntSet empty;
00285   };
00286 
00292   class IntSetRanges {
00293   private:
00295     const IntSet::Range* i;
00297     const IntSet::Range* e;
00298   public:
00300 
00301 
00302     IntSetRanges(void);
00304     IntSetRanges(const IntSet& s);
00306     void init(const IntSet& s);
00308 
00310 
00311 
00312     bool operator ()(void) const;
00314     void operator ++(void);
00316 
00318 
00319 
00320     int min(void) const;
00322     int max(void) const;
00324     unsigned int width(void) const;
00326   };
00327 
00333   class IntSetValues : public Iter::Ranges::ToValues<IntSetRanges> {
00334   public:
00336 
00337 
00338     IntSetValues(void);
00340     IntSetValues(const IntSet& s);
00342     void init(const IntSet& s);
00344   };
00345 
00350   template<class Char, class Traits>
00351   std::basic_ostream<Char,Traits>&
00352   operator <<(std::basic_ostream<Char,Traits>& os, const IntSet& s);
00353 
00354 }
00355 
00356 #include <gecode/int/int-set-1.hpp>
00357 
00358 #include <gecode/int/var-imp.hpp>
00359 
00360 namespace Gecode {
00361 
00362   namespace Int {
00363     class IntView;
00364   }
00365 
00371   class IntVar : public VarImpVar<Int::IntVarImp> {
00372     friend class IntVarArray;
00373     friend class IntVarArgs;
00374   private:
00375     using VarImpVar<Int::IntVarImp>::x;
00382     void _init(Space& home, int min, int max);
00389     void _init(Space& home, const IntSet& d);
00390   public:
00392 
00393 
00394     IntVar(void);
00396     IntVar(const IntVar& y);
00398     IntVar(const Int::IntView& y);
00410     GECODE_INT_EXPORT IntVar(Space& home, int min, int max);
00422     GECODE_INT_EXPORT IntVar(Space& home, const IntSet& d);
00424 
00426 
00427 
00428     int min(void) const;
00430     int max(void) const;
00432     int med(void) const;
00440     int val(void) const;
00441 
00443     unsigned int size(void) const;
00445     unsigned int width(void) const;
00447     unsigned int regret_min(void) const;
00449     unsigned int regret_max(void) const;
00451 
00453 
00454 
00455     bool range(void) const;
00457     bool in(int n) const;
00459   };
00460 
00465   template<class Char, class Traits>
00466   std::basic_ostream<Char,Traits>&
00467   operator <<(std::basic_ostream<Char,Traits>& os, const IntVar& x);
00468 
00473   class IntVarRanges : public Int::IntVarImpFwd {
00474   public:
00476 
00477 
00478     IntVarRanges(void);
00480     IntVarRanges(const IntVar& x);
00482     void init(const IntVar& x);
00484   };
00485 
00490   class IntVarValues : public Iter::Ranges::ToValues<IntVarRanges> {
00491   public:
00493 
00494 
00495     IntVarValues(void);
00497     IntVarValues(const IntVar& x);
00499     void init(const IntVar& x);
00501   };
00502 
00503   namespace Int {
00504     class BoolView;
00505   }
00506 
00512   class BoolVar : public VarImpVar<Int::BoolVarImp> {
00513     friend class BoolVarArray;
00514     friend class BoolVarArgs;
00515   private:
00516     using VarImpVar<Int::BoolVarImp>::x;
00523     void _init(Space& home, int min, int max);
00524   public:
00526 
00527 
00528     BoolVar(void);
00530     BoolVar(const BoolVar& y);
00532     BoolVar(const Int::BoolView& y);
00544     GECODE_INT_EXPORT BoolVar(Space& home, int min, int max);
00546 
00548 
00549 
00550     int min(void) const;
00552     int max(void) const;
00554     int med(void) const;
00562     int val(void) const;
00563 
00565     unsigned int size(void) const;
00567     unsigned int width(void) const;
00569     unsigned int regret_min(void) const;
00571     unsigned int regret_max(void) const;
00573 
00575 
00576 
00577     bool range(void) const;
00579     bool in(int n) const;
00581 
00583 
00584 
00585     bool zero(void) const;
00587     bool one(void) const;
00589     bool none(void) const;
00591   };
00592 
00597   template<class Char, class Traits>
00598   std::basic_ostream<Char,Traits>&
00599   operator <<(std::basic_ostream<Char,Traits>& os, const BoolVar& x);
00600 
00601 }
00602 
00603 
00604 #include <gecode/int/view.hpp>
00605 #include <gecode/int/propagator.hpp>
00606 
00607 namespace Gecode {
00608 
00618 
00619   typedef ArgArray<IntSet> IntSetArgs;
00620 
00621 }
00622 
00623 #include <gecode/int/array-traits.hpp>
00624 
00625 namespace Gecode {
00626 
00628   class IntArgs : public ArgArray<int> {
00629   public:
00631 
00632 
00633     IntArgs(void);
00635     explicit IntArgs(int n);
00637     IntArgs(const SharedArray<int>& x);
00639     IntArgs(const std::vector<int>& x);
00641     IntArgs(std::initializer_list<int> x);
00643     template<class InputIterator>
00644     IntArgs(InputIterator first, InputIterator last);
00646     IntArgs(int n, const int* e);
00648     IntArgs(const ArgArray<int>& a);
00649 
00651     static IntArgs create(int n, int start, int inc=1);
00653   };
00654 
00656   class IntVarArgs : public VarArgArray<IntVar> {
00657   public:
00659 
00660 
00661     IntVarArgs(void);
00663     explicit IntVarArgs(int n);
00665     IntVarArgs(const IntVarArgs& a);
00667     IntVarArgs(const VarArray<IntVar>& a);
00669     IntVarArgs(const std::vector<IntVar>& a);
00671     IntVarArgs(std::initializer_list<IntVar> a);
00673     template<class InputIterator>
00674     IntVarArgs(InputIterator first, InputIterator last);
00686     GECODE_INT_EXPORT
00687     IntVarArgs(Space& home, int n, int min, int max);
00699     GECODE_INT_EXPORT
00700     IntVarArgs(Space& home, int n, const IntSet& s);
00702   };
00703 
00712   class BoolVarArgs : public VarArgArray<BoolVar> {
00713   public:
00715 
00716 
00717     BoolVarArgs(void);
00719     explicit BoolVarArgs(int n);
00721     BoolVarArgs(const BoolVarArgs& a);
00723     BoolVarArgs(const VarArray<BoolVar>& a);
00725     BoolVarArgs(const std::vector<BoolVar>& a);
00727     BoolVarArgs(std::initializer_list<BoolVar> a);
00729     template<class InputIterator>
00730     BoolVarArgs(InputIterator first, InputIterator last);
00742     GECODE_INT_EXPORT
00743     BoolVarArgs(Space& home, int n, int min, int max);
00745   };
00747 
00763   class IntVarArray : public VarArray<IntVar> {
00764   public:
00766 
00767 
00768     IntVarArray(void);
00770     IntVarArray(Space& home, int n);
00772     IntVarArray(const IntVarArray& a);
00774     IntVarArray(Space& home, const IntVarArgs& a);
00786     GECODE_INT_EXPORT
00787     IntVarArray(Space& home, int n, int min, int max);
00799     GECODE_INT_EXPORT
00800     IntVarArray(Space& home, int n, const IntSet& s);
00802   };
00803 
00808   class BoolVarArray : public VarArray<BoolVar> {
00809   public:
00811 
00812 
00813     BoolVarArray(void);
00815     BoolVarArray(Space& home, int n);
00817     BoolVarArray(const BoolVarArray& a);
00819     BoolVarArray(Space& home, const BoolVarArgs& a);
00831     GECODE_INT_EXPORT
00832     BoolVarArray(Space& home, int n, int min, int max);
00834   };
00835 
00836 }
00837 
00838 #include <gecode/int/int-set-2.hpp>
00839 
00840 #include <gecode/int/array.hpp>
00841 
00842 namespace Gecode {
00843 
00848   enum ReifyMode {
00855     RM_EQV,
00862     RM_IMP,
00869     RM_PMI
00870   };
00871 
00876   class Reify {
00877   protected:
00879     BoolVar x;
00881     ReifyMode rm;
00882   public:
00884     Reify(void);
00886     Reify(BoolVar x, ReifyMode rm=RM_EQV);
00888     BoolVar var(void) const;
00890     ReifyMode mode(void) const;
00892     void var(BoolVar x);
00894     void mode(ReifyMode rm);
00895   };
00896 
00901   Reify eqv(BoolVar x);
00902 
00907   Reify imp(BoolVar x);
00908 
00913   Reify pmi(BoolVar x);
00914 
00915 }
00916 
00917 #include <gecode/int/reify.hpp>
00918 
00919 namespace Gecode {
00920 
00925   enum IntRelType {
00926     IRT_EQ, 
00927     IRT_NQ, 
00928     IRT_LQ, 
00929     IRT_LE, 
00930     IRT_GQ, 
00931     IRT_GR  
00932   };
00933 
00935   IntRelType swap(IntRelType irt);
00936 
00938   IntRelType neg(IntRelType irt);
00939 
00940 }
00941 
00942 #include <gecode/int/irt.hpp>
00943 
00944 namespace Gecode {
00945 
00950   enum BoolOpType {
00951     BOT_AND, 
00952     BOT_OR,  
00953     BOT_IMP, 
00954     BOT_EQV, 
00955     BOT_XOR  
00956   };
00957 
00974   enum IntPropLevel {
00976     IPL_DEF = 0, 
00977     IPL_VAL = 1, 
00978     IPL_BND = 2, 
00979     IPL_DOM = 3, 
00980 
00981     IPL_BASIC = 4,    
00982     IPL_ADVANCED = 8, 
00983     IPL_BASIC_ADVANCED = IPL_BASIC | IPL_ADVANCED, 
00984     _IPL_BITS = 4 
00985   };
00986 
00988   IntPropLevel vbd(IntPropLevel ipl);
00989 
00991   IntPropLevel ba(IntPropLevel ipl);
00992 
00993 }
00994 
00995 #include <gecode/int/ipl.hpp>
00996 
00997 namespace Gecode {
00998 
01004   enum TaskType {
01005     TT_FIXP, //< Task with fixed processing time
01006     TT_FIXS, //< Task with fixed start time
01007     TT_FIXE  //< Task with fixed end time
01008   };
01009 
01015   typedef ArgArray<TaskType> TaskTypeArgs;
01016 
01018   template<>
01019   class ArrayTraits<ArgArray<TaskType> > {
01020   public:
01021     typedef TaskTypeArgs StorageType;
01022     typedef TaskType     ValueType;
01023     typedef TaskTypeArgs ArgsType;
01024   };
01025 
01026 
01034 
01035   GECODE_INT_EXPORT void
01036   dom(Home home, IntVar x, int n,
01037       IntPropLevel ipl=IPL_DEF);
01039   GECODE_INT_EXPORT void
01040   dom(Home home, const IntVarArgs& x, int n,
01041       IntPropLevel ipl=IPL_DEF);
01042 
01044   GECODE_INT_EXPORT void
01045   dom(Home home, IntVar x, int l, int m,
01046       IntPropLevel ipl=IPL_DEF);
01048   GECODE_INT_EXPORT void
01049   dom(Home home, const IntVarArgs& x, int l, int m,
01050       IntPropLevel ipl=IPL_DEF);
01051 
01053   GECODE_INT_EXPORT void
01054   dom(Home home, IntVar x, const IntSet& s,
01055       IntPropLevel ipl=IPL_DEF);
01057   GECODE_INT_EXPORT void
01058   dom(Home home, const IntVarArgs& x, const IntSet& s,
01059       IntPropLevel ipl=IPL_DEF);
01060 
01062   GECODE_INT_EXPORT void
01063   dom(Home home, IntVar x, int n, Reify r,
01064       IntPropLevel ipl=IPL_DEF);
01066   GECODE_INT_EXPORT void
01067   dom(Home home, IntVar x, int l, int m, Reify r,
01068       IntPropLevel ipl=IPL_DEF);
01070   GECODE_INT_EXPORT void
01071   dom(Home home, IntVar x, const IntSet& s, Reify r,
01072       IntPropLevel ipl=IPL_DEF);
01073 
01075   GECODE_INT_EXPORT void
01076   dom(Home home, IntVar x, IntVar d,
01077       IntPropLevel ipl=IPL_DEF);
01079   GECODE_INT_EXPORT void
01080   dom(Home home, BoolVar x, BoolVar d,
01081       IntPropLevel ipl=IPL_DEF);
01083   GECODE_INT_EXPORT void
01084   dom(Home home, const IntVarArgs& x, const IntVarArgs& d,
01085       IntPropLevel ipl=IPL_DEF);
01087   GECODE_INT_EXPORT void
01088   dom(Home home, const BoolVarArgs& x, const BoolVarArgs& d,
01089       IntPropLevel ipl=IPL_DEF);
01091 
01092 
01103   GECODE_INT_EXPORT void
01104   rel(Home home, IntVar x0, IntRelType irt, IntVar x1,
01105       IntPropLevel ipl=IPL_DEF);
01112   GECODE_INT_EXPORT void
01113   rel(Home home, const IntVarArgs& x, IntRelType irt, IntVar y,
01114       IntPropLevel ipl=IPL_DEF);
01118   GECODE_INT_EXPORT void
01119   rel(Home home, IntVar x, IntRelType irt, int c,
01120       IntPropLevel ipl=IPL_DEF);
01124   GECODE_INT_EXPORT void
01125   rel(Home home, const IntVarArgs& x, IntRelType irt, int c,
01126       IntPropLevel ipl=IPL_DEF);
01133   GECODE_INT_EXPORT void
01134   rel(Home home, IntVar x0, IntRelType irt, IntVar x1, Reify r,
01135       IntPropLevel ipl=IPL_DEF);
01142   GECODE_INT_EXPORT void
01143   rel(Home home, IntVar x, IntRelType irt, int c, Reify r,
01144       IntPropLevel ipl=IPL_DEF);
01159   GECODE_INT_EXPORT void
01160   rel(Home home, const IntVarArgs& x, IntRelType irt,
01161       IntPropLevel ipl=IPL_DEF);
01176   GECODE_INT_EXPORT void
01177   rel(Home home, const IntVarArgs& x, IntRelType irt, const IntVarArgs& y,
01178       IntPropLevel ipl=IPL_DEF);
01192   GECODE_INT_EXPORT void
01193   rel(Home home, const IntVarArgs& x, IntRelType irt, const IntArgs& y,
01194       IntPropLevel ipl=IPL_DEF);
01208   GECODE_INT_EXPORT void
01209   rel(Home home, const IntArgs& x, IntRelType irt, const IntVarArgs& y,
01210       IntPropLevel ipl=IPL_DEF);
01211 
01219   GECODE_INT_EXPORT void
01220   rel(Home home, BoolVar x0, IntRelType irt, BoolVar x1,
01221       IntPropLevel ipl=IPL_DEF);
01225   GECODE_INT_EXPORT void
01226   rel(Home home, BoolVar x0, IntRelType irt, BoolVar x1, Reify r,
01227       IntPropLevel ipl=IPL_DEF);
01231   GECODE_INT_EXPORT void
01232   rel(Home home, const BoolVarArgs& x, IntRelType irt, BoolVar y,
01233       IntPropLevel ipl=IPL_DEF);
01241   GECODE_INT_EXPORT void
01242   rel(Home home, BoolVar x, IntRelType irt, int n,
01243       IntPropLevel ipl=IPL_DEF);
01251   GECODE_INT_EXPORT void
01252   rel(Home home, BoolVar x, IntRelType irt, int n, Reify r,
01253       IntPropLevel ipl=IPL_DEF);
01261   GECODE_INT_EXPORT void
01262   rel(Home home, const BoolVarArgs& x, IntRelType irt, int n,
01263       IntPropLevel ipl=IPL_DEF);
01276   GECODE_INT_EXPORT void
01277   rel(Home home, const BoolVarArgs& x, IntRelType irt, const BoolVarArgs& y,
01278       IntPropLevel ipl=IPL_DEF);
01291   GECODE_INT_EXPORT void
01292   rel(Home home, const BoolVarArgs& x, IntRelType irt, const IntArgs& y,
01293       IntPropLevel ipl=IPL_DEF);
01306   GECODE_INT_EXPORT void
01307   rel(Home home, const IntArgs& x, IntRelType irt, const BoolVarArgs& y,
01308       IntPropLevel ipl=IPL_DEF);
01319   GECODE_INT_EXPORT void
01320   rel(Home home, const BoolVarArgs& x, IntRelType irt,
01321       IntPropLevel ipl=IPL_DEF);
01327   GECODE_INT_EXPORT void
01328   rel(Home home, BoolVar x0, BoolOpType o, BoolVar x1, BoolVar x2,
01329       IntPropLevel ipl=IPL_DEF);
01338   GECODE_INT_EXPORT void
01339   rel(Home home, BoolVar x0, BoolOpType o, BoolVar x1, int n,
01340       IntPropLevel ipl=IPL_DEF);
01350   GECODE_INT_EXPORT void
01351   rel(Home home, BoolOpType o, const BoolVarArgs& x, BoolVar y,
01352       IntPropLevel ipl=IPL_DEF);
01365   GECODE_INT_EXPORT void
01366   rel(Home home, BoolOpType o, const BoolVarArgs& x, int n,
01367       IntPropLevel ipl=IPL_DEF);
01378   GECODE_INT_EXPORT void
01379   clause(Home home, BoolOpType o, const BoolVarArgs& x, const BoolVarArgs& y,
01380          BoolVar z, IntPropLevel ipl=IPL_DEF);
01394   GECODE_INT_EXPORT void
01395   clause(Home home, BoolOpType o, const BoolVarArgs& x, const BoolVarArgs& y,
01396          int n, IntPropLevel ipl=IPL_DEF);
01406   GECODE_INT_EXPORT void
01407   ite(Home home, BoolVar b, IntVar x, IntVar y, IntVar z,
01408       IntPropLevel ipl=IPL_DEF);
01415   GECODE_INT_EXPORT void
01416   ite(Home home, BoolVar b, BoolVar x, BoolVar y, BoolVar z,
01417       IntPropLevel ipl=IPL_DEF);
01418 
01419 
01431   GECODE_INT_EXPORT void
01432   precede(Home home, const IntVarArgs& x, int s, int t,
01433           IntPropLevel=IPL_DEF);
01441   GECODE_INT_EXPORT void
01442   precede(Home home, const IntVarArgs& x, const IntArgs& c,
01443           IntPropLevel=IPL_DEF);
01444 
01445 
01451 
01452   GECODE_INT_EXPORT void
01453   member(Home home, const IntVarArgs& x, IntVar y,
01454          IntPropLevel ipl=IPL_DEF);
01456   GECODE_INT_EXPORT void
01457   member(Home home, const BoolVarArgs& x, BoolVar y,
01458          IntPropLevel ipl=IPL_DEF);
01460   GECODE_INT_EXPORT void
01461   member(Home home, const IntVarArgs& x, IntVar y, Reify r,
01462          IntPropLevel ipl=IPL_DEF);
01464   GECODE_INT_EXPORT void
01465   member(Home home, const BoolVarArgs& x, BoolVar y, Reify r,
01466          IntPropLevel ipl=IPL_DEF);
01468 
01469 
01476 
01477   typedef SharedArray<int> IntSharedArray;
01483   GECODE_INT_EXPORT void
01484   element(Home home, IntSharedArray n, IntVar x0, IntVar x1,
01485           IntPropLevel ipl=IPL_DEF);
01491   GECODE_INT_EXPORT void
01492   element(Home home, IntSharedArray n, IntVar x0, BoolVar x1,
01493           IntPropLevel ipl=IPL_DEF);
01499   GECODE_INT_EXPORT void
01500   element(Home home, IntSharedArray n, IntVar x0, int x1,
01501           IntPropLevel ipl=IPL_DEF);
01507   GECODE_INT_EXPORT void
01508   element(Home home, const IntVarArgs& x, IntVar y0, IntVar y1,
01509           IntPropLevel ipl=IPL_DEF);
01515   GECODE_INT_EXPORT void
01516   element(Home home, const IntVarArgs& x, IntVar y0, int y1,
01517           IntPropLevel ipl=IPL_DEF);
01519   GECODE_INT_EXPORT void
01520   element(Home home, const BoolVarArgs& x, IntVar y0, BoolVar y1,
01521           IntPropLevel ipl=IPL_DEF);
01523   GECODE_INT_EXPORT void
01524   element(Home home, const BoolVarArgs& x, IntVar y0, int y1,
01525           IntPropLevel ipl=IPL_DEF);
01526 
01539   GECODE_INT_EXPORT void
01540   element(Home home, IntSharedArray a,
01541           IntVar x, int w, IntVar y, int h, IntVar z,
01542           IntPropLevel ipl=IPL_DEF);
01555   GECODE_INT_EXPORT void
01556   element(Home home, IntSharedArray a,
01557           IntVar x, int w, IntVar y, int h, BoolVar z,
01558           IntPropLevel ipl=IPL_DEF);
01574   GECODE_INT_EXPORT void
01575   element(Home home, const IntVarArgs& a,
01576           IntVar x, int w, IntVar y, int h, IntVar z,
01577           IntPropLevel ipl=IPL_DEF);
01590   GECODE_INT_EXPORT void
01591   element(Home home, const BoolVarArgs& a,
01592           IntVar x, int w, IntVar y, int h, BoolVar z,
01593           IntPropLevel ipl=IPL_DEF);
01595 
01596 
01611   GECODE_INT_EXPORT void
01612   distinct(Home home, const IntVarArgs& x,
01613            IntPropLevel ipl=IPL_DEF);
01626   GECODE_INT_EXPORT void
01627   distinct(Home home, const IntArgs& n, const IntVarArgs& x,
01628            IntPropLevel ipl=IPL_DEF);
01643   GECODE_INT_EXPORT void
01644   distinct(Home home, const BoolVarArgs& b, const IntVarArgs& x,
01645            IntPropLevel ipl=IPL_DEF);
01658   GECODE_INT_EXPORT void
01659   distinct(Home home, const IntVarArgs& x, int c,
01660            IntPropLevel ipl=IPL_DEF);
01662 
01663 
01681   GECODE_INT_EXPORT void
01682   channel(Home home, const IntVarArgs& x, const IntVarArgs& y,
01683           IntPropLevel ipl=IPL_DEF);
01684 
01698   GECODE_INT_EXPORT void
01699   channel(Home home, const IntVarArgs& x, int xoff,
01700           const IntVarArgs& y, int yoff,
01701           IntPropLevel ipl=IPL_DEF);
01702 
01704   GECODE_INT_EXPORT void
01705   channel(Home home, BoolVar x0, IntVar x1,
01706           IntPropLevel ipl=IPL_DEF);
01708   void
01709   channel(Home home, IntVar x0, BoolVar x1,
01710           IntPropLevel ipl=IPL_DEF);
01716   GECODE_INT_EXPORT void
01717   channel(Home home, const BoolVarArgs& x, IntVar y, int o=0,
01718           IntPropLevel ipl=IPL_DEF);
01720 
01721 }
01722 
01723 #include <gecode/int/channel.hpp>
01724 
01725 namespace Gecode {
01726 
01743   GECODE_INT_EXPORT void
01744   sorted(Home home, const IntVarArgs& x, const IntVarArgs& y,
01745          IntPropLevel ipl=IPL_DEF);
01746 
01758   GECODE_INT_EXPORT void
01759   sorted(Home home, const IntVarArgs& x, const IntVarArgs& y,
01760          const IntVarArgs& z,
01761          IntPropLevel ipl=IPL_DEF);
01763 
01764 
01783   GECODE_INT_EXPORT void
01784   count(Home home, const IntVarArgs& x, int n, IntRelType irt, int m,
01785         IntPropLevel ipl=IPL_DEF);
01790   GECODE_INT_EXPORT void
01791   count(Home home, const IntVarArgs& x, const IntSet& y, IntRelType irt, int m,
01792         IntPropLevel ipl=IPL_DEF);
01800   GECODE_INT_EXPORT void
01801   count(Home home, const IntVarArgs& x, IntVar y, IntRelType irt, int m,
01802         IntPropLevel ipl=IPL_DEF);
01810   GECODE_INT_EXPORT void
01811   count(Home home, const IntVarArgs& x, const IntArgs& y, IntRelType irt, int m,
01812         IntPropLevel ipl=IPL_DEF);
01817   GECODE_INT_EXPORT void
01818   count(Home home, const IntVarArgs& x, int n, IntRelType irt, IntVar z,
01819         IntPropLevel ipl=IPL_DEF);
01824   GECODE_INT_EXPORT void
01825   count(Home home, const IntVarArgs& x, const IntSet& y, IntRelType irt, IntVar z,
01826         IntPropLevel ipl=IPL_DEF);
01834   GECODE_INT_EXPORT void
01835   count(Home home, const IntVarArgs& x, IntVar y, IntRelType irt, IntVar z,
01836         IntPropLevel ipl=IPL_DEF);
01844   GECODE_INT_EXPORT void
01845   count(Home home, const IntVarArgs& x, const IntArgs& y, IntRelType irt, IntVar z,
01846         IntPropLevel ipl=IPL_DEF);
01847 
01861   GECODE_INT_EXPORT void
01862   count(Home home, const IntVarArgs& x, const IntVarArgs& c,
01863         IntPropLevel ipl=IPL_DEF);
01864 
01878   GECODE_INT_EXPORT void
01879   count(Home home, const IntVarArgs& x, const IntSetArgs& c,
01880         IntPropLevel ipl=IPL_DEF);
01881 
01898   GECODE_INT_EXPORT void
01899   count(Home home, const IntVarArgs& x,
01900         const IntVarArgs& c, const IntArgs& v,
01901         IntPropLevel ipl=IPL_DEF);
01902 
01919   GECODE_INT_EXPORT void
01920   count(Home home, const IntVarArgs& x,
01921         const IntSetArgs& c, const IntArgs& v,
01922         IntPropLevel ipl=IPL_DEF);
01923 
01940   GECODE_INT_EXPORT void
01941   count(Home home, const IntVarArgs& x,
01942         const IntSet& c, const IntArgs& v,
01943         IntPropLevel ipl=IPL_DEF);
01944 
01946 
01961   GECODE_INT_EXPORT void
01962   nvalues(Home home, const IntVarArgs& x, IntRelType irt, int y,
01963           IntPropLevel ipl=IPL_DEF);
01967   GECODE_INT_EXPORT void
01968   nvalues(Home home, const IntVarArgs& x, IntRelType irt, IntVar y,
01969           IntPropLevel ipl=IPL_DEF);
01973   GECODE_INT_EXPORT void
01974   nvalues(Home home, const BoolVarArgs& x, IntRelType irt, int y,
01975           IntPropLevel ipl=IPL_DEF);
01979   GECODE_INT_EXPORT void
01980   nvalues(Home home, const BoolVarArgs& x, IntRelType irt, IntVar y,
01981           IntPropLevel ipl=IPL_DEF);
01983 
02004   GECODE_INT_EXPORT void
02005   sequence(Home home, const IntVarArgs& x, const IntSet& s,
02006            int q, int l, int u, IntPropLevel ipl=IPL_DEF);
02007 
02022   GECODE_INT_EXPORT void
02023   sequence(Home home, const BoolVarArgs& x, const IntSet& s,
02024            int q, int l, int u, IntPropLevel ipl=IPL_DEF);
02025 
02027 
02049   class DFA : public SharedHandle {
02050   private:
02052     class DFAI;
02054     GECODE_INT_EXPORT
02055     bool equal(const DFA& d) const;
02056   public:
02058     class Transition {
02059     public:
02060       int i_state; 
02061       int symbol;  
02062       int o_state; 
02063 
02064       Transition(void);
02066       Transition(int i_state0, int symbol0, int o_state0);
02067     };
02069     class Transitions {
02070     private:
02072       const Transition* c_trans;
02074       const Transition* e_trans;
02075     public:
02077       Transitions(const DFA& d);
02079       Transitions(const DFA& d, int n);
02081       bool operator ()(void) const;
02083       void operator ++(void);
02085       int i_state(void) const;
02087       int symbol(void) const;
02089       int o_state(void) const;
02090     };
02092     class Symbols {
02093     private:
02095       const Transition* c_trans;
02097       const Transition* e_trans;
02098     public:
02100       Symbols(const DFA& d);
02102       bool operator ()(void) const;
02104       void operator ++(void);
02106       int val(void) const;
02107     };
02119     GECODE_INT_EXPORT
02120     void init(int s, Transition t[], int f[], bool minimize=true);
02121   public:
02122     friend class Transitions;
02124     DFA(void);
02136     GECODE_INT_EXPORT
02137     DFA(int s, Transition t[], int f[], bool minimize=true);
02147     GECODE_INT_EXPORT
02148     DFA(int s, std::initializer_list<Transition> t,
02149         std::initializer_list<int> f, bool minimize=true);
02151     DFA(const DFA& d);
02153     GECODE_INT_EXPORT
02154     bool operator ==(const DFA& d) const;
02156     bool operator !=(const DFA& d) const;
02158     int n_states(void) const;
02160     int n_transitions(void) const;
02162     unsigned int n_symbols(void) const;
02164     unsigned int max_degree(void) const;
02166     int final_fst(void) const;
02168     int final_lst(void) const;
02170     int symbol_min(void) const;
02172     int symbol_max(void) const;
02174     std::size_t hash(void) const;
02175   };
02176 
02177 }
02178 
02179 #include <gecode/int/extensional/dfa.hpp>
02180 
02181 namespace Gecode {
02182 
02191   class TupleSet : public SharedHandle {
02192   public:
02197     typedef int* Tuple;
02199     typedef Gecode::Support::BitSetData BitSetData;
02201     class Range {
02202     public:
02204       int min;
02206       int max;
02208       BitSetData* s;
02210       unsigned int width(void) const;
02212       const BitSetData* supports(unsigned int n_words, int n) const;
02213     };
02214   protected:
02216     class ValueData {
02217     public:
02219       unsigned int n;
02221       Range* r;
02223       unsigned int start(int n) const;
02224     };
02229     class GECODE_VTABLE_EXPORT Data : public SharedHandle::Object {
02230     protected:
02232       static const int n_initial_free = 1024;
02233     public:
02235       int arity;
02237       unsigned int n_words;
02239       int n_tuples;
02241       int n_free;
02243       int min;
02245       int max;
02247       std::size_t key;
02249       int* td;
02251       ValueData* vd;
02253       Range* range;
02255       BitSetData* support;
02256 
02258       Tuple add(void);
02260       Tuple get(int i) const;
02262       static void set(BitSetData* d, unsigned int n);
02264       static bool get(const BitSetData* d, unsigned int n);
02266       unsigned int tuple2idx(Tuple t) const;
02268       const Range* fst(int i) const;
02270       const Range* lst(int i) const;
02272       GECODE_INT_EXPORT
02273       void finalize(void);
02275       GECODE_INT_EXPORT
02276       void resize(void);
02278       bool finalized(void) const;
02280       Data(int a);
02282       GECODE_INT_EXPORT
02283       virtual ~Data(void);
02284     };
02285 
02287     Data& data(void) const;
02289     Data& raw(void) const;
02291     GECODE_INT_EXPORT
02292     void _add(const IntArgs& t);
02294     GECODE_INT_EXPORT
02295     bool equal(const TupleSet& t) const;
02296   public:
02298 
02299 
02300     TupleSet(void);
02302     GECODE_INT_EXPORT
02303     TupleSet(int a);
02305     GECODE_INT_EXPORT
02306     void init(int a);
02308     GECODE_INT_EXPORT
02309     TupleSet(const TupleSet& t);
02311     GECODE_INT_EXPORT
02312     TupleSet& operator =(const TupleSet& t);
02314     GECODE_INT_EXPORT
02315     TupleSet(int a, const DFA& dfa);
02317     operator bool(void) const;
02319     bool operator ==(const TupleSet& t) const;
02321     bool operator !=(const TupleSet& t) const;
02323 
02325 
02326 
02327     TupleSet& add(const IntArgs& t);
02329     bool finalized(void) const;
02331     void finalize(void);
02333 
02335 
02336 
02337     int arity(void) const;
02339     int tuples(void) const;
02341     unsigned int words(void) const;
02343     Tuple operator [](int i) const;
02345     int min(void) const;
02347     int max(void) const;
02349     std::size_t hash(void) const;
02351 
02353 
02354 
02355     const Range* fst(int i) const;
02357     const Range* lst(int i) const;
02359     class Ranges {
02360     protected:
02362       const Range* c;
02364       const Range* l;
02365     public:
02367 
02368 
02369       Ranges(const TupleSet& ts, int i);
02371 
02373 
02374 
02375       bool operator ()(void) const;
02377       void operator ++(void);
02379 
02381 
02382 
02383       int min(void) const;
02385       int max(void) const;
02387       unsigned int width(void) const;
02389     };
02391   };
02392 
02393 }
02394 
02395 #include <gecode/int/extensional/tuple-set.hpp>
02396 
02397 namespace Gecode {
02398 
02411   GECODE_INT_EXPORT void
02412   extensional(Home home, const IntVarArgs& x, DFA d,
02413               IntPropLevel ipl=IPL_DEF);
02414 
02427   GECODE_INT_EXPORT void
02428   extensional(Home home, const BoolVarArgs& x, DFA d,
02429               IntPropLevel ipl=IPL_DEF);
02430 
02441   void
02442   extensional(Home home, const IntVarArgs& x, const TupleSet& t,
02443               IntPropLevel ipl=IPL_DEF);
02444 
02457   GECODE_INT_EXPORT void
02458   extensional(Home home, const IntVarArgs& x, const TupleSet& t, bool pos,
02459               IntPropLevel ipl=IPL_DEF);
02460 
02471   void
02472   extensional(Home home, const IntVarArgs& x, const TupleSet& t, Reify r,
02473               IntPropLevel ipl=IPL_DEF);
02474 
02487   GECODE_INT_EXPORT void
02488   extensional(Home home, const IntVarArgs& x, const TupleSet& t, bool pos,
02489               Reify r,
02490               IntPropLevel ipl=IPL_DEF);
02491 
02502   void
02503   extensional(Home home, const BoolVarArgs& x, const TupleSet& t,
02504               IntPropLevel ipl=IPL_DEF);
02505 
02518   GECODE_INT_EXPORT void
02519   extensional(Home home, const BoolVarArgs& x, const TupleSet& t, bool pos,
02520               IntPropLevel ipl=IPL_DEF);
02521 
02532   void
02533   extensional(Home home, const BoolVarArgs& x, const TupleSet& t, Reify r,
02534               IntPropLevel ipl=IPL_DEF);
02535 
02548   GECODE_INT_EXPORT void
02549   extensional(Home home, const BoolVarArgs& x, const TupleSet& t, bool pos,
02550               Reify r,
02551               IntPropLevel ipl=IPL_DEF);
02552 
02553 }
02554 
02555 #include <gecode/int/extensional.hpp>
02556 
02557 namespace Gecode {
02558 
02570   GECODE_INT_EXPORT void
02571   min(Home home, IntVar x0, IntVar x1, IntVar x2,
02572       IntPropLevel ipl=IPL_DEF);
02580   GECODE_INT_EXPORT void
02581   min(Home home, const IntVarArgs& x, IntVar y,
02582       IntPropLevel ipl=IPL_DEF);
02588   GECODE_INT_EXPORT void
02589   max(Home home, IntVar x0, IntVar x1, IntVar x2,
02590       IntPropLevel ipl=IPL_DEF);
02598   GECODE_INT_EXPORT void
02599   max(Home home, const IntVarArgs& x, IntVar y,
02600       IntPropLevel ipl=IPL_DEF);
02601 
02611   GECODE_INT_EXPORT void
02612   argmin(Home home, const IntVarArgs& x, IntVar y, bool tiebreak=true,
02613          IntPropLevel ipl=IPL_DEF);
02623   GECODE_INT_EXPORT void
02624   argmin(Home home, const IntVarArgs& x, int o, IntVar y, bool tiebreak=true,
02625          IntPropLevel ipl=IPL_DEF);
02635   GECODE_INT_EXPORT void
02636   argmax(Home home, const IntVarArgs& x, IntVar y, bool tiebreak=true,
02637          IntPropLevel ipl=IPL_DEF);
02647   GECODE_INT_EXPORT void
02648   argmax(Home home, const IntVarArgs& x, int o, IntVar y, bool tiebreak=true,
02649          IntPropLevel ipl=IPL_DEF);
02650 
02656   GECODE_INT_EXPORT void
02657   abs(Home home, IntVar x0, IntVar x1,
02658       IntPropLevel ipl=IPL_DEF);
02659 
02665   GECODE_INT_EXPORT void
02666   mult(Home home, IntVar x0, IntVar x1, IntVar x2,
02667        IntPropLevel ipl=IPL_DEF);
02668 
02673   GECODE_INT_EXPORT void
02674   divmod(Home home, IntVar x0, IntVar x1, IntVar x2, IntVar x3,
02675          IntPropLevel ipl=IPL_DEF);
02676 
02681   GECODE_INT_EXPORT void
02682   div(Home home, IntVar x0, IntVar x1, IntVar x2,
02683       IntPropLevel ipl=IPL_DEF);
02684 
02689   GECODE_INT_EXPORT void
02690   mod(Home home, IntVar x0, IntVar x1, IntVar x2,
02691       IntPropLevel ipl=IPL_DEF);
02692 
02698   GECODE_INT_EXPORT void
02699   sqr(Home home, IntVar x0, IntVar x1,
02700       IntPropLevel ipl=IPL_DEF);
02701 
02707   GECODE_INT_EXPORT void
02708   sqrt(Home home, IntVar x0, IntVar x1,
02709        IntPropLevel ipl=IPL_DEF);
02710 
02719   GECODE_INT_EXPORT void
02720   pow(Home home, IntVar x0, int n, IntVar x1,
02721       IntPropLevel ipl=IPL_DEF);
02722 
02731   GECODE_INT_EXPORT void
02732   nroot(Home home, IntVar x0, int n, IntVar x1,
02733        IntPropLevel ipl=IPL_DEF);
02734 
02736 
02772   GECODE_INT_EXPORT void
02773   linear(Home home, const IntVarArgs& x,
02774          IntRelType irt, int c,
02775          IntPropLevel ipl=IPL_DEF);
02779   GECODE_INT_EXPORT void
02780   linear(Home home, const IntVarArgs& x,
02781          IntRelType irt, IntVar y,
02782          IntPropLevel ipl=IPL_DEF);
02786   GECODE_INT_EXPORT void
02787   linear(Home home, const IntVarArgs& x,
02788          IntRelType irt, int c, Reify r,
02789          IntPropLevel ipl=IPL_DEF);
02793   GECODE_INT_EXPORT void
02794   linear(Home home, const IntVarArgs& x,
02795          IntRelType irt, IntVar y, Reify r,
02796          IntPropLevel ipl=IPL_DEF);
02803   GECODE_INT_EXPORT void
02804   linear(Home home, const IntArgs& a, const IntVarArgs& x,
02805          IntRelType irt, int c,
02806          IntPropLevel ipl=IPL_DEF);
02813   GECODE_INT_EXPORT void
02814   linear(Home home, const IntArgs& a, const IntVarArgs& x,
02815          IntRelType irt, IntVar y,
02816          IntPropLevel ipl=IPL_DEF);
02823   GECODE_INT_EXPORT void
02824   linear(Home home, const IntArgs& a, const IntVarArgs& x,
02825          IntRelType irt, int c, Reify r,
02826          IntPropLevel ipl=IPL_DEF);
02833   GECODE_INT_EXPORT void
02834   linear(Home home, const IntArgs& a, const IntVarArgs& x,
02835          IntRelType irt, IntVar y, Reify r,
02836          IntPropLevel ipl=IPL_DEF);
02837 
02838 
02866   GECODE_INT_EXPORT void
02867   linear(Home home, const BoolVarArgs& x,
02868          IntRelType irt, int c,
02869          IntPropLevel ipl=IPL_DEF);
02873   GECODE_INT_EXPORT void
02874   linear(Home home, const BoolVarArgs& x,
02875          IntRelType irt, int c, Reify r,
02876          IntPropLevel ipl=IPL_DEF);
02880   GECODE_INT_EXPORT void
02881   linear(Home home, const BoolVarArgs& x,
02882          IntRelType irt, IntVar y,
02883          IntPropLevel ipl=IPL_DEF);
02887   GECODE_INT_EXPORT void
02888   linear(Home home, const BoolVarArgs& x,
02889          IntRelType irt, IntVar y, Reify r,
02890          IntPropLevel ipl=IPL_DEF);
02897   GECODE_INT_EXPORT void
02898   linear(Home home, const IntArgs& a, const BoolVarArgs& x,
02899          IntRelType irt, int c,
02900          IntPropLevel ipl=IPL_DEF);
02907   GECODE_INT_EXPORT void
02908   linear(Home home, const IntArgs& a, const BoolVarArgs& x,
02909          IntRelType irt, int c, Reify r,
02910          IntPropLevel ipl=IPL_DEF);
02917   GECODE_INT_EXPORT void
02918   linear(Home home, const IntArgs& a, const BoolVarArgs& x,
02919          IntRelType irt, IntVar y,
02920          IntPropLevel ipl=IPL_DEF);
02927   GECODE_INT_EXPORT void
02928   linear(Home home, const IntArgs& a, const BoolVarArgs& x,
02929          IntRelType irt, IntVar y, Reify r,
02930          IntPropLevel ipl=IPL_DEF);
02931 
02932 
02959   GECODE_INT_EXPORT void
02960   binpacking(Home home,
02961              const IntVarArgs& l,
02962              const IntVarArgs& b, const IntArgs& s,
02963              IntPropLevel ipl=IPL_DEF);
02964   /* \brief Post propagator for multi-dimensional bin packing
02965    *
02966    * In the following \a n refers to the number of items and \a m
02967    * refers to the number of bins.
02968    *
02969    * The multi-dimensional bin-packing constraint enforces that
02970    * all items are packed into bins
02971    * \f$b_i\in\{0,\ldots,m-1\}\f$ for \f$0\leq i<n\f$
02972    * and that the load of each bin corresponds to the items
02973    * packed into it for each dimension \f$l_{j\cdot
02974    * d + k} = \sum_{\{i\in\{0,\ldots,n-1\}|
02975    * b_{j\cdot d+k}=i}\}s_{i\cdot d+k}\f$
02976    * for \f$0\leq j<m\f$, \f$0\leq k<d\f$
02977    * Furthermore, the load variables must satisfy the capacity
02978    * constraints \f$l_{j\cdot d + k} \leq
02979    * c_k\f$ for \f$0\leq j<m\f$, \f$0\leq k<d\f$.
02980    *
02981    * The constraint is implemented by the decomposition
02982    * introduced in: Stefano Gualandi and Michele Lombardi. A
02983    * simple and effective decomposition for the multidimensional
02984    * binpacking constraint. CP 2013, pages 356--364.
02985    *
02986    * Posting the constraint returns a maximal set containing conflicting
02987    * items that require pairwise different bins.
02988    *
02989    * Note that posting the constraint has exponential complexity in the
02990    * number of items due to the Bron-Kerbosch algorithm used for finding
02991    * the maximal conflict item sets.
02992    *
02993    * Throws the following exceptions:
02994    *  - Of type Int::ArgumentSizeMismatch if any of the following properties
02995    *    is violated: \f$|b|=n\f$, \f$|l|=m\cdot d\f$, \f$|s|=n\cdot d\f$,
02996    *    and \f$|c|=d\f$.
02997    *  - Of type Int::ArgumentSame if \a l and \a b share unassigned variables.
02998    *  - Of type Int::OutOfLimits if \a s or \a c contains a negative number.
02999    *
03000    * \ingroup TaskModelIntBinPacking
03001    */
03002   GECODE_INT_EXPORT IntSet
03003   binpacking(Home home, int d,
03004              const IntVarArgs& l, const IntVarArgs& b,
03005              const IntArgs& s, const IntArgs& c,
03006              IntPropLevel ipl=IPL_DEF);
03007 
03008 
03027   GECODE_INT_EXPORT void
03028   nooverlap(Home home,
03029             const IntVarArgs& x, const IntArgs& w,
03030             const IntVarArgs& y, const IntArgs& h,
03031             IntPropLevel ipl=IPL_DEF);
03045   GECODE_INT_EXPORT void
03046   nooverlap(Home home,
03047             const IntVarArgs& x, const IntArgs& w,
03048             const IntVarArgs& y, const IntArgs& h,
03049             const BoolVarArgs& o,
03050             IntPropLevel ipl=IPL_DEF);
03067   GECODE_INT_EXPORT void
03068   nooverlap(Home home,
03069             const IntVarArgs& x0, const IntVarArgs& w, const IntVarArgs& x1,
03070             const IntVarArgs& y0, const IntVarArgs& h, const IntVarArgs& y1,
03071             IntPropLevel ipl=IPL_DEF);
03089   GECODE_INT_EXPORT void
03090   nooverlap(Home home,
03091             const IntVarArgs& x0, const IntVarArgs& w, const IntVarArgs& x1,
03092             const IntVarArgs& y0, const IntVarArgs& h, const IntVarArgs& y1,
03093             const BoolVarArgs& o,
03094             IntPropLevel ipl=IPL_DEF);
03095 
03096 
03102 
03145   GECODE_INT_EXPORT void
03146   cumulatives(Home home, const IntVarArgs& m,
03147               const IntVarArgs& s, const IntVarArgs& p,
03148               const IntVarArgs& e, const IntVarArgs& u,
03149               const IntArgs& c, bool at_most,
03150               IntPropLevel ipl=IPL_DEF);
03155   GECODE_INT_EXPORT void
03156   cumulatives(Home home, const IntArgs& m,
03157               const IntVarArgs& s, const IntVarArgs& p,
03158               const IntVarArgs& e, const IntVarArgs& u,
03159               const IntArgs& c, bool at_most,
03160               IntPropLevel ipl=IPL_DEF);
03165   GECODE_INT_EXPORT void
03166   cumulatives(Home home, const IntVarArgs& m,
03167               const IntVarArgs& s, const IntArgs& p,
03168               const IntVarArgs& e, const IntVarArgs& u,
03169               const IntArgs& c, bool at_most,
03170               IntPropLevel ipl=IPL_DEF);
03175   GECODE_INT_EXPORT void
03176   cumulatives(Home home, const IntArgs& m,
03177               const IntVarArgs& s, const IntArgs& p,
03178               const IntVarArgs& e, const IntVarArgs& u,
03179               const IntArgs& c, bool at_most,
03180               IntPropLevel ipl=IPL_DEF);
03185   GECODE_INT_EXPORT void
03186   cumulatives(Home home, const IntVarArgs& m,
03187               const IntVarArgs& s, const IntVarArgs& p,
03188               const IntVarArgs& e, const IntArgs& u,
03189               const IntArgs& c, bool at_most,
03190               IntPropLevel ipl=IPL_DEF);
03195   GECODE_INT_EXPORT void
03196   cumulatives(Home home, const IntArgs& m,
03197               const IntVarArgs& s, const IntVarArgs& p,
03198               const IntVarArgs& e, const IntArgs& u,
03199               const IntArgs& c, bool at_most,
03200               IntPropLevel ipl=IPL_DEF);
03205   GECODE_INT_EXPORT void
03206   cumulatives(Home home, const IntVarArgs& m,
03207               const IntVarArgs& s, const IntArgs& p,
03208               const IntVarArgs& e, const IntArgs& u,
03209               const IntArgs& c, bool at_most,
03210               IntPropLevel ipl=IPL_DEF);
03215   GECODE_INT_EXPORT void
03216   cumulatives(Home home, const IntArgs& m,
03217               const IntVarArgs& s, const IntArgs& p,
03218               const IntVarArgs& e, const IntArgs& u,
03219               const IntArgs& c, bool at_most,
03220               IntPropLevel ipl=IPL_DEF);
03221 
03248   GECODE_INT_EXPORT void
03249   unary(Home home, const IntVarArgs& s, const IntArgs& p,
03250         IntPropLevel ipl=IPL_DEF);
03251 
03280   GECODE_INT_EXPORT void
03281   unary(Home home, const IntVarArgs& s, const IntArgs& p,
03282         const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
03283 
03320   GECODE_INT_EXPORT void
03321   unary(Home home, const TaskTypeArgs& t,
03322         const IntVarArgs& flex, const IntArgs& fix, IntPropLevel ipl=IPL_DEF);
03323 
03362   GECODE_INT_EXPORT void
03363   unary(Home home, const TaskTypeArgs& t,
03364         const IntVarArgs& flex, const IntArgs& fix,
03365         const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
03366 
03393   GECODE_INT_EXPORT void
03394   unary(Home home, const IntVarArgs& s, const IntVarArgs& p,
03395         const IntVarArgs& e, IntPropLevel ipl=IPL_DEF);
03396 
03425   GECODE_INT_EXPORT void
03426   unary(Home home, const IntVarArgs& s, const IntVarArgs& p,
03427         const IntVarArgs& e, const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
03428 
03429 
03430 
03473   GECODE_INT_EXPORT void
03474   cumulative(Home home, int c, const TaskTypeArgs& t,
03475              const IntVarArgs& flex, const IntArgs& fix, const IntArgs& u,
03476              IntPropLevel ipl=IPL_DEF);
03477 
03478 
03483   GECODE_INT_EXPORT void
03484   cumulative(Home home, IntVar c, const TaskTypeArgs& t,
03485              const IntVarArgs& flex, const IntArgs& fix, const IntArgs& u,
03486              IntPropLevel ipl=IPL_DEF);
03487 
03532   GECODE_INT_EXPORT void
03533   cumulative(Home home, int c, const TaskTypeArgs& t,
03534              const IntVarArgs& flex, const IntArgs& fix, const IntArgs& u,
03535              const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
03536 
03540   GECODE_INT_EXPORT void
03541   cumulative(Home home, IntVar c, const TaskTypeArgs& t,
03542              const IntVarArgs& flex, const IntArgs& fix, const IntArgs& u,
03543              const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
03544 
03577   GECODE_INT_EXPORT void
03578   cumulative(Home home, int c, const IntVarArgs& s, const IntArgs& p,
03579              const IntArgs& u, IntPropLevel ipl=IPL_DEF);
03580 
03584   GECODE_INT_EXPORT void
03585   cumulative(Home home, IntVar c, const IntVarArgs& s, const IntArgs& p,
03586              const IntArgs& u, IntPropLevel ipl=IPL_DEF);
03587 
03622   GECODE_INT_EXPORT void
03623   cumulative(Home home, int c, const IntVarArgs& s, const IntArgs& p,
03624              const IntArgs& u, const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
03625 
03629   GECODE_INT_EXPORT void
03630   cumulative(Home home, IntVar c, const IntVarArgs& s, const IntArgs& p,
03631              const IntArgs& u, const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
03632 
03669   GECODE_INT_EXPORT void
03670   cumulative(Home home, int c, const IntVarArgs& s, const IntVarArgs& p,
03671              const IntVarArgs& e, const IntArgs& u, IntPropLevel ipl=IPL_DEF);
03672 
03676   GECODE_INT_EXPORT void
03677   cumulative(Home home, IntVar c, const IntVarArgs& s, const IntVarArgs& p,
03678              const IntVarArgs& e, const IntArgs& u, IntPropLevel ipl=IPL_DEF);
03679 
03718   GECODE_INT_EXPORT void
03719   cumulative(Home home, int c, const IntVarArgs& s, const IntVarArgs& p,
03720              const IntVarArgs& e, const IntArgs& u, const BoolVarArgs& m,
03721              IntPropLevel ipl=IPL_DEF);
03722 
03726   GECODE_INT_EXPORT void
03727   cumulative(Home home, IntVar c, const IntVarArgs& s, const IntVarArgs& p,
03728              const IntVarArgs& e, const IntArgs& u, const BoolVarArgs& m,
03729              IntPropLevel ipl=IPL_DEF);
03731 
03732 
03752   GECODE_INT_EXPORT void
03753   circuit(Home home, const IntVarArgs& x,
03754           IntPropLevel ipl=IPL_DEF);
03770   GECODE_INT_EXPORT void
03771   circuit(Home home, int offset, const IntVarArgs& x,
03772           IntPropLevel ipl=IPL_DEF);
03794   GECODE_INT_EXPORT void
03795   circuit(Home home,
03796           const IntArgs& c,
03797           const IntVarArgs& x, const IntVarArgs& y, IntVar z,
03798           IntPropLevel ipl=IPL_DEF);
03821   GECODE_INT_EXPORT void
03822   circuit(Home home,
03823           const IntArgs& c, int offset,
03824           const IntVarArgs& x, const IntVarArgs& y, IntVar z,
03825           IntPropLevel ipl=IPL_DEF);
03844   GECODE_INT_EXPORT void
03845   circuit(Home home,
03846           const IntArgs& c,
03847           const IntVarArgs& x, IntVar z,
03848           IntPropLevel ipl=IPL_DEF);
03869   GECODE_INT_EXPORT void
03870   circuit(Home home,
03871           const IntArgs& c, int offset,
03872           const IntVarArgs& x, IntVar z,
03873           IntPropLevel ipl=IPL_DEF);
03889   GECODE_INT_EXPORT void
03890   path(Home home, const IntVarArgs& x, IntVar s, IntVar e,
03891        IntPropLevel ipl=IPL_DEF);
03909   GECODE_INT_EXPORT void
03910   path(Home home, int offset, const IntVarArgs& x, IntVar s, IntVar e,
03911        IntPropLevel ipl=IPL_DEF);
03934   GECODE_INT_EXPORT void
03935   path(Home home,
03936        const IntArgs& c,
03937        const IntVarArgs& x, IntVar s, IntVar e, const IntVarArgs& y, IntVar z,
03938        IntPropLevel ipl=IPL_DEF);
03963   GECODE_INT_EXPORT void
03964   path(Home home,
03965        const IntArgs& c, int offset,
03966        const IntVarArgs& x, IntVar s, IntVar e, const IntVarArgs& y, IntVar z,
03967        IntPropLevel ipl=IPL_DEF);
03988   GECODE_INT_EXPORT void
03989   path(Home home,
03990        const IntArgs& c,
03991        const IntVarArgs& x, IntVar s, IntVar e, IntVar z,
03992        IntPropLevel ipl=IPL_DEF);
04015   GECODE_INT_EXPORT void
04016   path(Home home,
04017        const IntArgs& c, int offset,
04018        const IntVarArgs& x, IntVar s, IntVar e, IntVar z,
04019        IntPropLevel ipl=IPL_DEF);
04021 
04022 
04023 
04032 
04033   GECODE_INT_EXPORT void
04034   wait(Home home, IntVar x, std::function<void(Space& home)> c,
04035        IntPropLevel ipl=IPL_DEF);
04037   GECODE_INT_EXPORT void
04038   wait(Home home, BoolVar x, std::function<void(Space& home)> c,
04039        IntPropLevel ipl=IPL_DEF);
04041   GECODE_INT_EXPORT void
04042   wait(Home home, const IntVarArgs& x, std::function<void(Space& home)> c,
04043        IntPropLevel ipl=IPL_DEF);
04045   GECODE_INT_EXPORT void
04046   wait(Home home, const BoolVarArgs& x,
04047        std::function<void(Space& home)> c,
04048        IntPropLevel ipl=IPL_DEF);
04050   GECODE_INT_EXPORT void
04051   when(Home home, BoolVar x,
04052        std::function<void(Space& home)> t,
04053        std::function<void(Space& home)> e,
04054        IntPropLevel ipl=IPL_DEF);
04056   GECODE_INT_EXPORT void
04057   when(Home home, BoolVar x,
04058        std::function<void(Space& home)> t,
04059        IntPropLevel ipl=IPL_DEF);
04061 
04062 
04087   GECODE_INT_EXPORT void
04088   unshare(Home home, IntVarArgs& x,
04089           IntPropLevel ipl=IPL_DEF);
04091   GECODE_INT_EXPORT void
04092   unshare(Home home, BoolVarArgs& x,
04093           IntPropLevel ipl=IPL_DEF);
04095 
04096 }
04097 
04098 namespace Gecode {
04099 
04113   typedef std::function<bool(const Space& home, IntVar x, int i)>
04114     IntBranchFilter;
04123   typedef std::function<bool(const Space& home, BoolVar x, int i)>
04124     BoolBranchFilter;
04125 
04135   typedef std::function<double(const Space& home, IntVar x, int i)> 
04136     IntBranchMerit;
04146   typedef std::function<double(const Space& home, BoolVar x, int i)>
04147     BoolBranchMerit;
04148 
04159   typedef std::function<int(const Space& home, IntVar x, int i)>
04160     IntBranchVal;
04171   typedef std::function<int(const Space& home, BoolVar x, int i)>
04172     BoolBranchVal;
04173 
04185   typedef std::function<void(Space& home, unsigned int a,
04186                              IntVar x, int i, int n)>
04187     IntBranchCommit;
04199   typedef std::function<void(Space& home, unsigned int a,
04200                              BoolVar x, int i, int n)>
04201     BoolBranchCommit;
04202 
04203 }
04204 
04205 #include <gecode/int/branch/traits.hpp>
04206 
04207 namespace Gecode {
04208 
04214   class IntAFC : public AFC {
04215   public:
04223     IntAFC(void);
04225     IntAFC(const IntAFC& a);
04227     IntAFC& operator =(const IntAFC& a);
04235     IntAFC(Home home, const IntVarArgs& x, double d=1.0, bool share=true);
04246     void init(Home home, const IntVarArgs& x, double d=1.0, bool share=true);
04247   };
04248 
04254   class BoolAFC : public AFC {
04255   public:
04263     BoolAFC(void);
04265     BoolAFC(const BoolAFC& a);
04267     BoolAFC& operator =(const BoolAFC& a);
04275     BoolAFC(Home home, const BoolVarArgs& x, double d=1.0, bool share=true);
04286     void init(Home home, const BoolVarArgs& x, double d=1.0, bool share=true);
04287   };
04288 
04289 }
04290 
04291 #include <gecode/int/branch/afc.hpp>
04292 
04293 namespace Gecode {
04294 
04300   class IntAction : public Action {
04301   public:
04309     IntAction(void);
04311     IntAction(const IntAction& a);
04313     IntAction& operator =(const IntAction& a);
04321     GECODE_INT_EXPORT
04322     IntAction(Home home, const IntVarArgs& x, double d=1.0,
04323               IntBranchMerit bm=nullptr);
04335     GECODE_INT_EXPORT void
04336     init(Home home, const IntVarArgs& x, double d=1.0,
04337          IntBranchMerit bm=nullptr);
04338   };
04339 
04345   class BoolAction : public Action {
04346   public:
04354     BoolAction(void);
04356     BoolAction(const BoolAction& a);
04358     BoolAction& operator =(const BoolAction& a);
04366     GECODE_INT_EXPORT
04367     BoolAction(Home home, const BoolVarArgs& x, double d=1.0,
04368                BoolBranchMerit bm=nullptr);
04380     GECODE_INT_EXPORT void
04381     init(Home home, const BoolVarArgs& x, double d=1.0,
04382          BoolBranchMerit bm=nullptr);
04383   };
04384 
04385 }
04386 
04387 #include <gecode/int/branch/action.hpp>
04388 
04389 namespace Gecode {
04390 
04396   class IntCHB : public CHB {
04397   public:
04405     IntCHB(void);
04407     IntCHB(const IntCHB& chb);
04409     IntCHB& operator =(const IntCHB& chb);
04418     GECODE_INT_EXPORT
04419     IntCHB(Home home, const IntVarArgs& x, IntBranchMerit bm=nullptr);
04431     GECODE_INT_EXPORT void
04432     init(Home home, const IntVarArgs& x, IntBranchMerit bm=nullptr);
04433   };
04434 
04440   class BoolCHB : public CHB {
04441   public:
04449     BoolCHB(void);
04451     BoolCHB(const BoolCHB& chb);
04453     BoolCHB& operator =(const BoolCHB& chb);
04462     GECODE_INT_EXPORT
04463     BoolCHB(Home home, const BoolVarArgs& x, BoolBranchMerit bm=nullptr);
04475     GECODE_INT_EXPORT void
04476     init(Home home, const BoolVarArgs& x, BoolBranchMerit bm=nullptr);
04477   };
04478 
04479 }
04480 
04481 #include <gecode/int/branch/chb.hpp>
04482 
04483 namespace Gecode {
04484 
04486   typedef std::function<void(const Space &home, const Brancher& b,
04487                              unsigned int a,
04488                              IntVar x, int i, const int& n,
04489                              std::ostream& o)>
04490     IntVarValPrint;
04491 
04493   typedef std::function<void(const Space &home, const Brancher& b,
04494                              unsigned int a,
04495                              BoolVar x, int i, const int& n,
04496                              std::ostream& o)>
04497     BoolVarValPrint;
04498 
04499 }
04500 
04501 namespace Gecode {
04502 
04508   class IntVarBranch : public VarBranch<IntVar> {
04509   public:
04511     enum Select {
04512       SEL_NONE = 0,        
04513       SEL_RND,             
04514       SEL_MERIT_MIN,       
04515       SEL_MERIT_MAX,       
04516       SEL_DEGREE_MIN,      
04517       SEL_DEGREE_MAX,      
04518       SEL_AFC_MIN,         
04519       SEL_AFC_MAX,         
04520       SEL_ACTION_MIN,      
04521       SEL_ACTION_MAX,      
04522       SEL_CHB_MIN,         
04523       SEL_CHB_MAX,         
04524       SEL_MIN_MIN,         
04525       SEL_MIN_MAX,         
04526       SEL_MAX_MIN,         
04527       SEL_MAX_MAX,         
04528       SEL_SIZE_MIN,        
04529       SEL_SIZE_MAX,        
04530       SEL_DEGREE_SIZE_MIN, 
04531       SEL_DEGREE_SIZE_MAX, 
04532       SEL_AFC_SIZE_MIN,    
04533       SEL_AFC_SIZE_MAX,    
04534       SEL_ACTION_SIZE_MIN, 
04535       SEL_ACTION_SIZE_MAX, 
04536       SEL_CHB_SIZE_MIN,    
04537       SEL_CHB_SIZE_MAX,    
04538 
04543       SEL_REGRET_MIN_MIN,
04549       SEL_REGRET_MIN_MAX,
04555       SEL_REGRET_MAX_MIN,
04561       SEL_REGRET_MAX_MAX
04562     };
04563   protected:
04565     Select s;
04566   public:
04568     IntVarBranch(void);
04570     IntVarBranch(Rnd r);
04572     IntVarBranch(Select s, BranchTbl t);
04574     IntVarBranch(Select s, double d, BranchTbl t);
04576     IntVarBranch(Select s, IntAFC a, BranchTbl t);
04578     IntVarBranch(Select s, IntAction a, BranchTbl t);
04580     IntVarBranch(Select s, IntCHB c, BranchTbl t);
04582     IntVarBranch(Select s, IntBranchMerit mf, BranchTbl t);
04584     Select select(void) const;
04586     void expand(Home home, const IntVarArgs& x);
04587   };
04588 
04594   class BoolVarBranch : public VarBranch<BoolVar> {
04595   public:
04597     enum Select {
04598       SEL_NONE = 0,        
04599       SEL_RND,             
04600       SEL_MERIT_MIN,       
04601       SEL_MERIT_MAX,       
04602       SEL_DEGREE_MIN,      
04603       SEL_DEGREE_MAX,      
04604       SEL_AFC_MIN,         
04605       SEL_AFC_MAX,         
04606       SEL_ACTION_MIN,      
04607       SEL_ACTION_MAX,      
04608       SEL_CHB_MIN,         
04609       SEL_CHB_MAX          
04610     };
04611   protected:
04613     Select s;
04614   public:
04616     BoolVarBranch(void);
04618     BoolVarBranch(Rnd r);
04620     BoolVarBranch(Select s, BranchTbl t);
04622     BoolVarBranch(Select s, double d, BranchTbl t);
04624     BoolVarBranch(Select s, BoolAFC a, BranchTbl t);
04626     BoolVarBranch(Select s, BoolAction a, BranchTbl t);
04628     BoolVarBranch(Select s, BoolCHB c, BranchTbl t);
04630     BoolVarBranch(Select s, BoolBranchMerit mf, BranchTbl t);
04632     Select select(void) const;
04634     void expand(Home home, const BoolVarArgs& x);
04635   };
04636 
04642 
04643   IntVarBranch INT_VAR_NONE(void);
04645   IntVarBranch INT_VAR_RND(Rnd r);
04647   IntVarBranch INT_VAR_MERIT_MIN(IntBranchMerit bm, BranchTbl tbl=nullptr);
04649   IntVarBranch INT_VAR_MERIT_MAX(IntBranchMerit bm, BranchTbl tbl=nullptr);
04651   IntVarBranch INT_VAR_DEGREE_MIN(BranchTbl tbl=nullptr);
04653   IntVarBranch INT_VAR_DEGREE_MAX(BranchTbl tbl=nullptr);
04655   IntVarBranch INT_VAR_AFC_MIN(double d=1.0, BranchTbl tbl=nullptr);
04657   IntVarBranch INT_VAR_AFC_MIN(IntAFC a, BranchTbl tbl=nullptr);
04659   IntVarBranch INT_VAR_AFC_MAX(double d=1.0, BranchTbl tbl=nullptr);
04661   IntVarBranch INT_VAR_AFC_MAX(IntAFC a, BranchTbl tbl=nullptr);
04663   IntVarBranch INT_VAR_ACTION_MIN(double d=1.0, BranchTbl tbl=nullptr);
04665   IntVarBranch INT_VAR_ACTION_MIN(IntAction a, BranchTbl tbl=nullptr);
04667   IntVarBranch INT_VAR_ACTION_MAX(double d=1.0, BranchTbl tbl=nullptr);
04669   IntVarBranch INT_VAR_ACTION_MAX(IntAction a, BranchTbl tbl=nullptr);
04671   IntVarBranch INT_VAR_CHB_MIN(IntCHB c, BranchTbl tbl=nullptr);
04673   IntVarBranch INT_VAR_CHB_MIN(BranchTbl tbl=nullptr);
04675   IntVarBranch INT_VAR_CHB_MAX(IntCHB c, BranchTbl tbl=nullptr);
04677   IntVarBranch INT_VAR_CHB_MAX(BranchTbl tbl=nullptr);
04679   IntVarBranch INT_VAR_MIN_MIN(BranchTbl tbl=nullptr);
04681   IntVarBranch INT_VAR_MIN_MAX(BranchTbl tbl=nullptr);
04683   IntVarBranch INT_VAR_MAX_MIN(BranchTbl tbl=nullptr);
04685   IntVarBranch INT_VAR_MAX_MAX(BranchTbl tbl=nullptr);
04687   IntVarBranch INT_VAR_SIZE_MIN(BranchTbl tbl=nullptr);
04689   IntVarBranch INT_VAR_SIZE_MAX(BranchTbl tbl=nullptr);
04691   IntVarBranch INT_VAR_DEGREE_SIZE_MIN(BranchTbl tbl=nullptr);
04693   IntVarBranch INT_VAR_DEGREE_SIZE_MAX(BranchTbl tbl=nullptr);
04695   IntVarBranch INT_VAR_AFC_SIZE_MIN(double d=1.0, BranchTbl tbl=nullptr);
04697   IntVarBranch INT_VAR_AFC_SIZE_MIN(IntAFC a, BranchTbl tbl=nullptr);
04699   IntVarBranch INT_VAR_AFC_SIZE_MAX(double d=1.0, BranchTbl tbl=nullptr);
04701   IntVarBranch INT_VAR_AFC_SIZE_MAX(IntAFC a, BranchTbl tbl=nullptr);
04703   IntVarBranch INT_VAR_ACTION_SIZE_MIN(double d=1.0, BranchTbl tbl=nullptr);
04705   IntVarBranch INT_VAR_ACTION_SIZE_MIN(IntAction a, BranchTbl tbl=nullptr);
04707   IntVarBranch INT_VAR_ACTION_SIZE_MAX(double d=1.0, BranchTbl tbl=nullptr);
04709   IntVarBranch INT_VAR_ACTION_SIZE_MAX(IntAction a, BranchTbl tbl=nullptr);
04711   IntVarBranch INT_VAR_CHB_SIZE_MIN(IntCHB c, BranchTbl tbl=nullptr);
04713   IntVarBranch INT_VAR_CHB_SIZE_MIN(BranchTbl tbl=nullptr);
04715   IntVarBranch INT_VAR_CHB_SIZE_MAX(IntCHB c, BranchTbl tbl=nullptr);
04717   IntVarBranch INT_VAR_CHB_SIZE_MAX(BranchTbl tbl=nullptr);
04723   IntVarBranch INT_VAR_REGRET_MIN_MIN(BranchTbl tbl=nullptr);
04729   IntVarBranch INT_VAR_REGRET_MIN_MAX(BranchTbl tbl=nullptr);
04735   IntVarBranch INT_VAR_REGRET_MAX_MIN(BranchTbl tbl=nullptr);
04741   IntVarBranch INT_VAR_REGRET_MAX_MAX(BranchTbl tbl=nullptr);
04742 
04744   BoolVarBranch BOOL_VAR_NONE(void);
04746   BoolVarBranch BOOL_VAR_RND(Rnd r);
04748   BoolVarBranch BOOL_VAR_MERIT_MIN(BoolBranchMerit bm, BranchTbl tbl=nullptr);
04750   BoolVarBranch BOOL_VAR_MERIT_MAX(BoolBranchMerit bm, BranchTbl tbl=nullptr);
04752   BoolVarBranch BOOL_VAR_DEGREE_MIN(BranchTbl tbl=nullptr);
04754   BoolVarBranch BOOL_VAR_DEGREE_MAX(BranchTbl tbl=nullptr);
04756   BoolVarBranch BOOL_VAR_AFC_MIN(double d=1.0, BranchTbl tbl=nullptr);
04758   BoolVarBranch BOOL_VAR_AFC_MIN(BoolAFC a, BranchTbl tbl=nullptr);
04760   BoolVarBranch BOOL_VAR_AFC_MAX(double d=1.0, BranchTbl tbl=nullptr);
04762   BoolVarBranch BOOL_VAR_AFC_MAX(BoolAFC a, BranchTbl tbl=nullptr);
04764   BoolVarBranch BOOL_VAR_ACTION_MIN(double d=1.0, BranchTbl tbl=nullptr);
04766   BoolVarBranch BOOL_VAR_ACTION_MIN(BoolAction a, BranchTbl tbl=nullptr);
04768   BoolVarBranch BOOL_VAR_ACTION_MAX(double d=1.0, BranchTbl tbl=nullptr);
04770   BoolVarBranch BOOL_VAR_ACTION_MAX(BoolAction a, BranchTbl tbl=nullptr);
04772   BoolVarBranch BOOL_VAR_CHB_MIN(BoolCHB c, BranchTbl tbl=nullptr);
04774   BoolVarBranch BOOL_VAR_CHB_MIN(BranchTbl tbl=nullptr);
04776   BoolVarBranch BOOL_VAR_CHB_MAX(BoolCHB c, BranchTbl tbl=nullptr);
04778   BoolVarBranch BOOL_VAR_CHB_MAX(BranchTbl tbl=nullptr);
04780 
04781 }
04782 
04783 #include <gecode/int/branch/var.hpp>
04784 
04785 namespace Gecode {
04786 
04792   class IntValBranch : public ValBranch<IntVar> {
04793   public:
04795     enum Select {
04796       SEL_MIN,        
04797       SEL_MED,        
04798       SEL_MAX,        
04799       SEL_RND,        
04800       SEL_SPLIT_MIN,  
04801       SEL_SPLIT_MAX,  
04802       SEL_RANGE_MIN,  
04803       SEL_RANGE_MAX,  
04804       SEL_VAL_COMMIT, 
04805       SEL_VALUES_MIN, 
04806       SEL_VALUES_MAX  
04807    };
04808   protected:
04810     Select s;
04811   public:
04813     IntValBranch(Select s = SEL_MIN);
04815     IntValBranch(Rnd r);
04817     IntValBranch(IntBranchVal v, IntBranchCommit c);
04819     Select select(void) const;
04820   };
04821 
04827   class BoolValBranch : public ValBranch<BoolVar> {
04828   public:
04830     enum Select {
04831       SEL_MIN,       
04832       SEL_MAX,       
04833       SEL_RND,       
04834       SEL_VAL_COMMIT 
04835    };
04836   protected:
04838     Select s;
04839   public:
04841     BoolValBranch(Select s = SEL_MIN);
04843     BoolValBranch(Rnd r);
04845     BoolValBranch(BoolBranchVal v, BoolBranchCommit c);
04847     Select select(void) const;
04848   };
04849 
04855 
04856   IntValBranch INT_VAL_MIN(void);
04858   IntValBranch INT_VAL_MED(void);
04860   IntValBranch INT_VAL_MAX(void);
04862   IntValBranch INT_VAL_RND(Rnd r);
04864   IntValBranch INT_VAL_SPLIT_MIN(void);
04866   IntValBranch INT_VAL_SPLIT_MAX(void);
04868   IntValBranch INT_VAL_RANGE_MIN(void);
04870   IntValBranch INT_VAL_RANGE_MAX(void);
04877   IntValBranch INT_VAL(IntBranchVal v, IntBranchCommit c=nullptr);
04879   IntValBranch INT_VALUES_MIN(void);
04881   IntValBranch INT_VALUES_MAX(void);
04882 
04884   BoolValBranch BOOL_VAL_MIN(void);
04886   BoolValBranch BOOL_VAL_MAX(void);
04888   BoolValBranch BOOL_VAL_RND(Rnd r);
04895   BoolValBranch BOOL_VAL(BoolBranchVal v, BoolBranchCommit c=nullptr);
04897 
04898 }
04899 
04900 #include <gecode/int/branch/val.hpp>
04901 
04902 namespace Gecode {
04903 
04909   class IntAssign : public ValBranch<IntVar> {
04910   public:
04912     enum Select {
04913       SEL_MIN,       
04914       SEL_MED,       
04915       SEL_MAX,       
04916       SEL_RND,       
04917       SEL_VAL_COMMIT 
04918     };
04919   protected:
04921     Select s;
04922   public:
04924     IntAssign(Select s = SEL_MIN);
04926     IntAssign(Rnd r);
04928     IntAssign(IntBranchVal v, IntBranchCommit c);
04930     Select select(void) const;
04931   };
04932 
04938   class BoolAssign : public ValBranch<BoolVar> {
04939   public:
04941     enum Select {
04942       SEL_MIN,       
04943       SEL_MAX,       
04944       SEL_RND,       
04945       SEL_VAL_COMMIT 
04946     };
04947   protected:
04949     Select s;
04950   public:
04952     BoolAssign(Select s = SEL_MIN);
04954     BoolAssign(Rnd r);
04956     BoolAssign(BoolBranchVal v, BoolBranchCommit c);
04958     Select select(void) const;
04959   };
04960 
04966 
04967   IntAssign INT_ASSIGN_MIN(void);
04969   IntAssign INT_ASSIGN_MED(void);
04971   IntAssign INT_ASSIGN_MAX(void);
04973   IntAssign INT_ASSIGN_RND(Rnd r);
04980   IntAssign INT_ASSIGN(IntBranchVal v, IntBranchCommit c=nullptr);
04981 
04983   BoolAssign BOOL_ASSIGN_MIN(void);
04985   BoolAssign BOOL_ASSIGN_MAX(void);
04987   BoolAssign BOOL_ASSIGN_RND(Rnd r);
04994   BoolAssign BOOL_ASSIGN(BoolBranchVal v, BoolBranchCommit c=nullptr);
04996 
04997 }
04998 
04999 #include <gecode/int/branch/assign.hpp>
05000 
05001 namespace Gecode {
05007   GECODE_INT_EXPORT void
05008   branch(Home home, const IntVarArgs& x,
05009          IntVarBranch vars, IntValBranch vals,
05010          IntBranchFilter bf=nullptr,
05011          IntVarValPrint vvp=nullptr);
05017   GECODE_INT_EXPORT void
05018   branch(Home home, const IntVarArgs& x,
05019          TieBreak<IntVarBranch> vars, IntValBranch vals,
05020          IntBranchFilter bf=nullptr,
05021          IntVarValPrint vvp=nullptr);
05027   GECODE_INT_EXPORT void
05028   branch(Home home, IntVar x, IntValBranch vals,
05029          IntVarValPrint vvp=nullptr);
05035   GECODE_INT_EXPORT void
05036   branch(Home home, const BoolVarArgs& x,
05037          BoolVarBranch vars, BoolValBranch vals,
05038          BoolBranchFilter bf=nullptr,
05039          BoolVarValPrint vvp=nullptr);
05045   GECODE_INT_EXPORT void
05046   branch(Home home, const BoolVarArgs& x,
05047          TieBreak<BoolVarBranch> vars, BoolValBranch vals,
05048          BoolBranchFilter bf=nullptr,
05049          BoolVarValPrint vvp=nullptr);
05055   GECODE_INT_EXPORT void
05056   branch(Home home, BoolVar x, BoolValBranch vals,
05057          BoolVarValPrint vvp=nullptr);
05058 
05064   GECODE_INT_EXPORT void
05065   assign(Home home, const IntVarArgs& x, IntAssign vals,
05066          IntBranchFilter bf=nullptr,
05067          IntVarValPrint vvp=nullptr);
05073   GECODE_INT_EXPORT void
05074   assign(Home home, IntVar x, IntAssign vals,
05075          IntVarValPrint vvp=nullptr);
05081   GECODE_INT_EXPORT void
05082   assign(Home home, const BoolVarArgs& x, BoolAssign vals,
05083          BoolBranchFilter bf=nullptr,
05084          BoolVarValPrint vvp=nullptr);
05090   GECODE_INT_EXPORT void
05091   assign(Home home, BoolVar x, BoolAssign vals,
05092          BoolVarValPrint vvp=nullptr);
05093 
05094 }
05095 
05096 namespace Gecode {
05097 
05101   template<class Char, class Traits>
05102   std::basic_ostream<Char,Traits>&
05103   operator <<(std::basic_ostream<Char,Traits>& os, const DFA& d);
05104 
05108   template<class Char, class Traits>
05109   std::basic_ostream<Char,Traits>&
05110   operator <<(std::basic_ostream<Char,Traits>& os, const TupleSet& ts);
05111 
05112 }
05113 
05114 // LDSB-related declarations.
05115 namespace Gecode {
05116 
05117   namespace Int { namespace LDSB {
05118     class SymmetryObject;
05119   }}
05120 
05126   class GECODE_INT_EXPORT SymmetryHandle {
05127   public:
05129     Int::LDSB::SymmetryObject* ref;
05131     void increment(void);
05133     void decrement(void);
05134   public:
05136     SymmetryHandle(void);
05138     SymmetryHandle(Int::LDSB::SymmetryObject* o);
05140     SymmetryHandle(const SymmetryHandle& h);
05142     const SymmetryHandle& operator=(const SymmetryHandle& h);
05144     ~SymmetryHandle(void);
05145   };
05146   class Symmetries;
05148   template<>
05149   class ArrayTraits<ArgArray<SymmetryHandle> > {
05150   public:
05151     typedef Symmetries     StorageType;
05152     typedef SymmetryHandle ValueType;
05153     typedef Symmetries     ArgsType;
05154   };
05155 
05162 
05163   class Symmetries : public ArgArray<SymmetryHandle> {};
05164   // If this is instead a typedef, strange things happen with the
05165   // overloading of the "branch" function.
05166 
05168   GECODE_INT_EXPORT SymmetryHandle VariableSymmetry(const IntVarArgs& x);
05170   GECODE_INT_EXPORT SymmetryHandle VariableSymmetry(const BoolVarArgs& x);
05172   GECODE_INT_EXPORT SymmetryHandle VariableSymmetry(const IntVarArgs& x,
05173                                                     const IntArgs& indices);
05175   GECODE_INT_EXPORT SymmetryHandle ValueSymmetry(const IntArgs& v);
05177   GECODE_INT_EXPORT SymmetryHandle ValueSymmetry(const IntSet& v);
05179   GECODE_INT_EXPORT SymmetryHandle ValueSymmetry(IntVar vars);
05185   GECODE_INT_EXPORT
05186   SymmetryHandle VariableSequenceSymmetry(const IntVarArgs& x, int ss);
05192   GECODE_INT_EXPORT
05193   SymmetryHandle VariableSequenceSymmetry(const BoolVarArgs& x, int ss);
05199   GECODE_INT_EXPORT
05200   SymmetryHandle ValueSequenceSymmetry(const IntArgs& v, int ss);
05201 
05203   GECODE_INT_EXPORT SymmetryHandle values_reflect(int lower, int upper);
05205   GECODE_INT_EXPORT SymmetryHandle values_reflect(IntVar x);
05207 
05219   GECODE_INT_EXPORT void
05220   branch(Home home, const IntVarArgs& x,
05221          IntVarBranch vars, IntValBranch vals,
05222          const Symmetries& syms,
05223          IntBranchFilter bf=nullptr,
05224          IntVarValPrint vvp=nullptr);
05236   GECODE_INT_EXPORT void
05237   branch(Home home, const IntVarArgs& x,
05238          TieBreak<IntVarBranch> vars, IntValBranch vals,
05239          const Symmetries& syms,
05240          IntBranchFilter bf=nullptr,
05241          IntVarValPrint vvp=nullptr);
05253   GECODE_INT_EXPORT void
05254   branch(Home home, const BoolVarArgs& x,
05255          BoolVarBranch vars, BoolValBranch vals,
05256          const Symmetries& syms,
05257          BoolBranchFilter bf=nullptr,
05258          BoolVarValPrint vvp=nullptr);
05270   GECODE_INT_EXPORT void
05271   branch(Home home, const BoolVarArgs& x,
05272          TieBreak<BoolVarBranch> vars, BoolValBranch vals,
05273          const Symmetries& syms,
05274          BoolBranchFilter bf=nullptr,
05275          BoolVarValPrint vvp=nullptr);
05276 
05277 #ifdef GECODE_HAS_CBS
05278 
05299   GECODE_INT_EXPORT void
05300   cbsbranch(Home home, const IntVarArgs& x);
05301 
05302 
05323   GECODE_INT_EXPORT void
05324   cbsbranch(Home home, const BoolVarArgs& x);
05325 
05326 #endif
05327 
05328 }
05329 
05330 namespace Gecode {
05331 
05332   /*
05333    * \brief Relaxed assignment of variables in \a x from values in \a sx
05334    *
05335    * The variables in \a x are assigned values from the assigned variables
05336    * in the solution \a sx with a relaxation probability \a p. That is,
05337    * if \$fp=0.1\f$ approximately 10% of the variables in \a x will be
05338    * assigned a value from \a sx.
05339    *
05340    * The random numbers are generated from the generator \a r. At least
05341    * one variable will not be assigned: in case the relaxation attempt
05342    * would suggest that all variables should be assigned, a single
05343    * variable will be selected randomly to remain unassigned.
05344    *
05345    * Throws an exception of type Int::ArgumentSizeMismatch, if \a x and
05346    * \a sx are of different size.
05347    *
05348    * Throws an exception of type Int::OutOfLimits, if \a p is not between
05349    * \a 0.0 and \a 1.0.
05350    *
05351    * \ingroup TaskModelInt
05352    */
05353   GECODE_INT_EXPORT void
05354   relax(Home home, const IntVarArgs& x, const IntVarArgs& sx,
05355         Rnd r, double p);
05356 
05357   /*
05358    * \brief Relaxed assignment of variables in \a x from values in \a sx
05359    *
05360    * The variables in \a x are assigned values from the assigned variables
05361    * in the solution \a sx with a relaxation probability \a p. That is,
05362    * if \$fp=0.1\f$ approximately 10% of the variables in \a x will be
05363    * assigned a value from \a sx.
05364    *
05365    * The random numbers are generated from the generator \a r. At least
05366    * one variable will not be assigned: in case the relaxation attempt
05367    * would suggest that all variables should be assigned, a single
05368    * variable will be selected randomly to remain unassigned.
05369    *
05370    * Throws an exception of type Int::ArgumentSizeMismatch, if \a x and
05371    * \a sx are of different size.
05372    *
05373    * Throws an exception of type Int::OutOfLimits, if \a p is not between
05374    * \a 0.0 and \a 1.0.
05375    *
05376    * \ingroup TaskModelInt
05377    */
05378   GECODE_INT_EXPORT void
05379   relax(Home home, const BoolVarArgs& x, const BoolVarArgs& sx,
05380         Rnd r, double p);
05381 
05382 }
05383 
05384 
05385 #include <gecode/int/trace/int-trace-view.hpp>
05386 #include <gecode/int/trace/bool-trace-view.hpp>
05387 
05388 namespace Gecode {
05389 
05399   class IntTraceDelta
05400     : public Iter::Ranges::Diff<Iter::Ranges::RangeList,
05401                                 Int::ViewRanges<Int::IntView> > {
05402   protected:
05404     Int::ViewRanges<Int::IntView> rn;
05406     Iter::Ranges::RangeList ro;
05407   public:
05409 
05410 
05411     IntTraceDelta(Int::IntTraceView o, Int::IntView n, const Delta& d);
05413   };
05414 
05419   class BoolTraceDelta {
05420   protected:
05422     int delta;
05423   public:
05425 
05426 
05427     BoolTraceDelta(Int::BoolTraceView o, Int::BoolView n, const Delta& d);
05429 
05430 
05431 
05432     bool operator ()(void) const;
05434     void operator ++(void);
05436 
05438 
05439 
05440     int min(void) const;
05442     int max(void) const;
05444     unsigned int width(void) const;
05446   };
05447 
05448 }
05449 
05450 #include <gecode/int/trace/int-delta.hpp>
05451 #include <gecode/int/trace/bool-delta.hpp>
05452 
05453 #include <gecode/int/trace/traits.hpp>
05454 
05455 namespace Gecode {
05456 
05461   typedef ViewTracer<Int::IntView> IntTracer;
05466   typedef ViewTraceRecorder<Int::IntView> IntTraceRecorder;
05467 
05472   class GECODE_INT_EXPORT StdIntTracer : public IntTracer {
05473   protected:
05475     std::ostream& os;
05476   public:
05478     StdIntTracer(std::ostream& os0 = std::cerr);
05480     virtual void init(const Space& home, const IntTraceRecorder& t);
05482     virtual void prune(const Space& home, const IntTraceRecorder& t,
05483                        const ViewTraceInfo& vti, int i, IntTraceDelta& d);
05485     virtual void fix(const Space& home, const IntTraceRecorder& t);
05487     virtual void fail(const Space& home, const IntTraceRecorder& t);
05489     virtual void done(const Space& home, const IntTraceRecorder& t);
05491     static StdIntTracer def;
05492   };
05493 
05494 
05499   typedef ViewTracer<Int::BoolView> BoolTracer;
05504   typedef ViewTraceRecorder<Int::BoolView> BoolTraceRecorder;
05505 
05510   class GECODE_INT_EXPORT StdBoolTracer : public BoolTracer {
05511   protected:
05513     std::ostream& os;
05514   public:
05516     StdBoolTracer(std::ostream& os0 = std::cerr);
05518     virtual void init(const Space& home, const BoolTraceRecorder& t);
05520     virtual void prune(const Space& home, const BoolTraceRecorder& t,
05521                        const ViewTraceInfo& vti, int i, BoolTraceDelta& d);
05523     virtual void fix(const Space& home, const BoolTraceRecorder& t);
05525     virtual void fail(const Space& home, const BoolTraceRecorder& t);
05527     virtual void done(const Space& home, const BoolTraceRecorder& t);
05529     static StdBoolTracer def;
05530   };
05531 
05536   GECODE_INT_EXPORT void
05537   trace(Home home, const IntVarArgs& x,
05538         TraceFilter tf,
05539         int te = (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE),
05540         IntTracer& t = StdIntTracer::def);
05545   void
05546   trace(Home home, const IntVarArgs& x,
05547         int te = (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE),
05548         IntTracer& t = StdIntTracer::def);
05549 
05554   GECODE_INT_EXPORT void
05555   trace(Home home, const BoolVarArgs& x,
05556         TraceFilter tf,
05557         int te = (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE),
05558         BoolTracer& t = StdBoolTracer::def);
05563   void
05564   trace(Home home, const BoolVarArgs& x,
05565         int te = (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE),
05566         BoolTracer& t = StdBoolTracer::def);
05567 
05568 }
05569 
05570 #include <gecode/int/trace.hpp>
05571 
05572 #endif
05573 
05574 // IFDEF: GECODE_HAS_INT_VARS
05575 // STATISTICS: int-post
05576