Generated on Fri Oct 19 11:25:00 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  *     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     IntSet(int n, int m);
00221     IntSet(const int r[],   int n);
00227     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     IntSet(std::initializer_list<int> r);
00242     GECODE_INT_EXPORT
00243     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   };
00985 
00987   IntPropLevel vbd(IntPropLevel ipl);
00988 
00990   IntPropLevel ba(IntPropLevel ipl);
00991 
00992 }
00993 
00994 #include <gecode/int/ipl.hpp>
00995 
00996 namespace Gecode {
00997 
01003   enum TaskType {
01004     TT_FIXP, //< Task with fixed processing time
01005     TT_FIXS, //< Task with fixed start time
01006     TT_FIXE  //< Task with fixed end time
01007   };
01008 
01014   typedef ArgArray<TaskType> TaskTypeArgs;
01015 
01017   template<>
01018   class ArrayTraits<ArgArray<TaskType> > {
01019   public:
01020     typedef TaskTypeArgs StorageType;
01021     typedef TaskType     ValueType;
01022     typedef TaskTypeArgs ArgsType;
01023   };
01024 
01025 
01033 
01034   GECODE_INT_EXPORT void
01035   dom(Home home, IntVar x, int n,
01036       IntPropLevel ipl=IPL_DEF);
01038   GECODE_INT_EXPORT void
01039   dom(Home home, const IntVarArgs& x, int n,
01040       IntPropLevel ipl=IPL_DEF);
01041 
01043   GECODE_INT_EXPORT void
01044   dom(Home home, IntVar x, int l, int m,
01045       IntPropLevel ipl=IPL_DEF);
01047   GECODE_INT_EXPORT void
01048   dom(Home home, const IntVarArgs& x, int l, int m,
01049       IntPropLevel ipl=IPL_DEF);
01050 
01052   GECODE_INT_EXPORT void
01053   dom(Home home, IntVar x, const IntSet& s,
01054       IntPropLevel ipl=IPL_DEF);
01056   GECODE_INT_EXPORT void
01057   dom(Home home, const IntVarArgs& x, const IntSet& s,
01058       IntPropLevel ipl=IPL_DEF);
01059 
01061   GECODE_INT_EXPORT void
01062   dom(Home home, IntVar x, int n, Reify r,
01063       IntPropLevel ipl=IPL_DEF);
01065   GECODE_INT_EXPORT void
01066   dom(Home home, IntVar x, int l, int m, Reify r,
01067       IntPropLevel ipl=IPL_DEF);
01069   GECODE_INT_EXPORT void
01070   dom(Home home, IntVar x, const IntSet& s, Reify r,
01071       IntPropLevel ipl=IPL_DEF);
01072 
01074   GECODE_INT_EXPORT void
01075   dom(Home home, IntVar x, IntVar d,
01076       IntPropLevel ipl=IPL_DEF);
01078   GECODE_INT_EXPORT void
01079   dom(Home home, BoolVar x, BoolVar d,
01080       IntPropLevel ipl=IPL_DEF);
01082   GECODE_INT_EXPORT void
01083   dom(Home home, const IntVarArgs& x, const IntVarArgs& d,
01084       IntPropLevel ipl=IPL_DEF);
01086   GECODE_INT_EXPORT void
01087   dom(Home home, const BoolVarArgs& x, const BoolVarArgs& d,
01088       IntPropLevel ipl=IPL_DEF);
01090 
01091 
01102   GECODE_INT_EXPORT void
01103   rel(Home home, IntVar x0, IntRelType irt, IntVar x1,
01104       IntPropLevel ipl=IPL_DEF);
01111   GECODE_INT_EXPORT void
01112   rel(Home home, const IntVarArgs& x, IntRelType irt, IntVar y,
01113       IntPropLevel ipl=IPL_DEF);
01117   GECODE_INT_EXPORT void
01118   rel(Home home, IntVar x, IntRelType irt, int c,
01119       IntPropLevel ipl=IPL_DEF);
01123   GECODE_INT_EXPORT void
01124   rel(Home home, const IntVarArgs& x, IntRelType irt, int c,
01125       IntPropLevel ipl=IPL_DEF);
01132   GECODE_INT_EXPORT void
01133   rel(Home home, IntVar x0, IntRelType irt, IntVar x1, Reify r,
01134       IntPropLevel ipl=IPL_DEF);
01141   GECODE_INT_EXPORT void
01142   rel(Home home, IntVar x, IntRelType irt, int c, Reify r,
01143       IntPropLevel ipl=IPL_DEF);
01158   GECODE_INT_EXPORT void
01159   rel(Home home, const IntVarArgs& x, IntRelType irt,
01160       IntPropLevel ipl=IPL_DEF);
01175   GECODE_INT_EXPORT void
01176   rel(Home home, const IntVarArgs& x, IntRelType irt, const IntVarArgs& y,
01177       IntPropLevel ipl=IPL_DEF);
01191   GECODE_INT_EXPORT void
01192   rel(Home home, const IntVarArgs& x, IntRelType irt, const IntArgs& y,
01193       IntPropLevel ipl=IPL_DEF);
01207   GECODE_INT_EXPORT void
01208   rel(Home home, const IntArgs& x, IntRelType irt, const IntVarArgs& y,
01209       IntPropLevel ipl=IPL_DEF);
01210 
01218   GECODE_INT_EXPORT void
01219   rel(Home home, BoolVar x0, IntRelType irt, BoolVar x1,
01220       IntPropLevel ipl=IPL_DEF);
01224   GECODE_INT_EXPORT void
01225   rel(Home home, BoolVar x0, IntRelType irt, BoolVar x1, Reify r,
01226       IntPropLevel ipl=IPL_DEF);
01230   GECODE_INT_EXPORT void
01231   rel(Home home, const BoolVarArgs& x, IntRelType irt, BoolVar y,
01232       IntPropLevel ipl=IPL_DEF);
01240   GECODE_INT_EXPORT void
01241   rel(Home home, BoolVar x, IntRelType irt, int n,
01242       IntPropLevel ipl=IPL_DEF);
01250   GECODE_INT_EXPORT void
01251   rel(Home home, BoolVar x, IntRelType irt, int n, Reify r,
01252       IntPropLevel ipl=IPL_DEF);
01260   GECODE_INT_EXPORT void
01261   rel(Home home, const BoolVarArgs& x, IntRelType irt, int n,
01262       IntPropLevel ipl=IPL_DEF);
01275   GECODE_INT_EXPORT void
01276   rel(Home home, const BoolVarArgs& x, IntRelType irt, const BoolVarArgs& y,
01277       IntPropLevel ipl=IPL_DEF);
01290   GECODE_INT_EXPORT void
01291   rel(Home home, const BoolVarArgs& x, IntRelType irt, const IntArgs& y,
01292       IntPropLevel ipl=IPL_DEF);
01305   GECODE_INT_EXPORT void
01306   rel(Home home, const IntArgs& x, IntRelType irt, const BoolVarArgs& y,
01307       IntPropLevel ipl=IPL_DEF);
01318   GECODE_INT_EXPORT void
01319   rel(Home home, const BoolVarArgs& x, IntRelType irt,
01320       IntPropLevel ipl=IPL_DEF);
01326   GECODE_INT_EXPORT void
01327   rel(Home home, BoolVar x0, BoolOpType o, BoolVar x1, BoolVar x2,
01328       IntPropLevel ipl=IPL_DEF);
01337   GECODE_INT_EXPORT void
01338   rel(Home home, BoolVar x0, BoolOpType o, BoolVar x1, int n,
01339       IntPropLevel ipl=IPL_DEF);
01349   GECODE_INT_EXPORT void
01350   rel(Home home, BoolOpType o, const BoolVarArgs& x, BoolVar y,
01351       IntPropLevel ipl=IPL_DEF);
01364   GECODE_INT_EXPORT void
01365   rel(Home home, BoolOpType o, const BoolVarArgs& x, int n,
01366       IntPropLevel ipl=IPL_DEF);
01377   GECODE_INT_EXPORT void
01378   clause(Home home, BoolOpType o, const BoolVarArgs& x, const BoolVarArgs& y,
01379          BoolVar z, IntPropLevel ipl=IPL_DEF);
01393   GECODE_INT_EXPORT void
01394   clause(Home home, BoolOpType o, const BoolVarArgs& x, const BoolVarArgs& y,
01395          int n, IntPropLevel ipl=IPL_DEF);
01405   GECODE_INT_EXPORT void
01406   ite(Home home, BoolVar b, IntVar x, IntVar y, IntVar z,
01407       IntPropLevel ipl=IPL_DEF);
01414   GECODE_INT_EXPORT void
01415   ite(Home home, BoolVar b, BoolVar x, BoolVar y, BoolVar z,
01416       IntPropLevel ipl=IPL_DEF);
01417 
01418 
01430   GECODE_INT_EXPORT void
01431   precede(Home home, const IntVarArgs& x, int s, int t,
01432           IntPropLevel=IPL_DEF);
01440   GECODE_INT_EXPORT void
01441   precede(Home home, const IntVarArgs& x, const IntArgs& c,
01442           IntPropLevel=IPL_DEF);
01443 
01444 
01450 
01451   GECODE_INT_EXPORT void
01452   member(Home home, const IntVarArgs& x, IntVar y,
01453          IntPropLevel ipl=IPL_DEF);
01455   GECODE_INT_EXPORT void
01456   member(Home home, const BoolVarArgs& x, BoolVar y,
01457          IntPropLevel ipl=IPL_DEF);
01459   GECODE_INT_EXPORT void
01460   member(Home home, const IntVarArgs& x, IntVar y, Reify r,
01461          IntPropLevel ipl=IPL_DEF);
01463   GECODE_INT_EXPORT void
01464   member(Home home, const BoolVarArgs& x, BoolVar y, Reify r,
01465          IntPropLevel ipl=IPL_DEF);
01467 
01468 
01475 
01476   typedef SharedArray<int> IntSharedArray;
01482   GECODE_INT_EXPORT void
01483   element(Home home, IntSharedArray n, IntVar x0, IntVar x1,
01484           IntPropLevel ipl=IPL_DEF);
01490   GECODE_INT_EXPORT void
01491   element(Home home, IntSharedArray n, IntVar x0, BoolVar x1,
01492           IntPropLevel ipl=IPL_DEF);
01498   GECODE_INT_EXPORT void
01499   element(Home home, IntSharedArray n, IntVar x0, int x1,
01500           IntPropLevel ipl=IPL_DEF);
01506   GECODE_INT_EXPORT void
01507   element(Home home, const IntVarArgs& x, IntVar y0, IntVar y1,
01508           IntPropLevel ipl=IPL_DEF);
01514   GECODE_INT_EXPORT void
01515   element(Home home, const IntVarArgs& x, IntVar y0, int y1,
01516           IntPropLevel ipl=IPL_DEF);
01518   GECODE_INT_EXPORT void
01519   element(Home home, const BoolVarArgs& x, IntVar y0, BoolVar y1,
01520           IntPropLevel ipl=IPL_DEF);
01522   GECODE_INT_EXPORT void
01523   element(Home home, const BoolVarArgs& x, IntVar y0, int y1,
01524           IntPropLevel ipl=IPL_DEF);
01525 
01538   GECODE_INT_EXPORT void
01539   element(Home home, IntSharedArray a,
01540           IntVar x, int w, IntVar y, int h, IntVar z,
01541           IntPropLevel ipl=IPL_DEF);
01554   GECODE_INT_EXPORT void
01555   element(Home home, IntSharedArray a,
01556           IntVar x, int w, IntVar y, int h, BoolVar z,
01557           IntPropLevel ipl=IPL_DEF);
01573   GECODE_INT_EXPORT void
01574   element(Home home, const IntVarArgs& a,
01575           IntVar x, int w, IntVar y, int h, IntVar z,
01576           IntPropLevel ipl=IPL_DEF);
01589   GECODE_INT_EXPORT void
01590   element(Home home, const BoolVarArgs& a,
01591           IntVar x, int w, IntVar y, int h, BoolVar z,
01592           IntPropLevel ipl=IPL_DEF);
01594 
01595 
01610   GECODE_INT_EXPORT void
01611   distinct(Home home, const IntVarArgs& x,
01612            IntPropLevel ipl=IPL_DEF);
01625   GECODE_INT_EXPORT void
01626   distinct(Home home, const IntArgs& n, const IntVarArgs& x,
01627            IntPropLevel ipl=IPL_DEF);
01642   GECODE_INT_EXPORT void
01643   distinct(Home home, const BoolVarArgs& b, const IntVarArgs& x,
01644            IntPropLevel ipl=IPL_DEF);
01657   GECODE_INT_EXPORT void
01658   distinct(Home home, const IntVarArgs& x, int c,
01659            IntPropLevel ipl=IPL_DEF);
01661 
01662 
01680   GECODE_INT_EXPORT void
01681   channel(Home home, const IntVarArgs& x, const IntVarArgs& y,
01682           IntPropLevel ipl=IPL_DEF);
01683 
01697   GECODE_INT_EXPORT void
01698   channel(Home home, const IntVarArgs& x, int xoff,
01699           const IntVarArgs& y, int yoff,
01700           IntPropLevel ipl=IPL_DEF);
01701 
01703   GECODE_INT_EXPORT void
01704   channel(Home home, BoolVar x0, IntVar x1,
01705           IntPropLevel ipl=IPL_DEF);
01707   void
01708   channel(Home home, IntVar x0, BoolVar x1,
01709           IntPropLevel ipl=IPL_DEF);
01715   GECODE_INT_EXPORT void
01716   channel(Home home, const BoolVarArgs& x, IntVar y, int o=0,
01717           IntPropLevel ipl=IPL_DEF);
01719 
01720 }
01721 
01722 #include <gecode/int/channel.hpp>
01723 
01724 namespace Gecode {
01725 
01742   GECODE_INT_EXPORT void
01743   sorted(Home home, const IntVarArgs& x, const IntVarArgs& y,
01744          IntPropLevel ipl=IPL_DEF);
01745 
01757   GECODE_INT_EXPORT void
01758   sorted(Home home, const IntVarArgs& x, const IntVarArgs& y,
01759          const IntVarArgs& z,
01760          IntPropLevel ipl=IPL_DEF);
01762 
01763 
01782   GECODE_INT_EXPORT void
01783   count(Home home, const IntVarArgs& x, int n, IntRelType irt, int m,
01784         IntPropLevel ipl=IPL_DEF);
01789   GECODE_INT_EXPORT void
01790   count(Home home, const IntVarArgs& x, const IntSet& y, IntRelType irt, int m,
01791         IntPropLevel ipl=IPL_DEF);
01799   GECODE_INT_EXPORT void
01800   count(Home home, const IntVarArgs& x, IntVar y, IntRelType irt, int m,
01801         IntPropLevel ipl=IPL_DEF);
01809   GECODE_INT_EXPORT void
01810   count(Home home, const IntVarArgs& x, const IntArgs& y, IntRelType irt, int m,
01811         IntPropLevel ipl=IPL_DEF);
01816   GECODE_INT_EXPORT void
01817   count(Home home, const IntVarArgs& x, int n, IntRelType irt, IntVar z,
01818         IntPropLevel ipl=IPL_DEF);
01823   GECODE_INT_EXPORT void
01824   count(Home home, const IntVarArgs& x, const IntSet& y, IntRelType irt, IntVar z,
01825         IntPropLevel ipl=IPL_DEF);
01833   GECODE_INT_EXPORT void
01834   count(Home home, const IntVarArgs& x, IntVar y, IntRelType irt, IntVar z,
01835         IntPropLevel ipl=IPL_DEF);
01843   GECODE_INT_EXPORT void
01844   count(Home home, const IntVarArgs& x, const IntArgs& y, IntRelType irt, IntVar z,
01845         IntPropLevel ipl=IPL_DEF);
01846 
01860   GECODE_INT_EXPORT void
01861   count(Home home, const IntVarArgs& x, const IntVarArgs& c,
01862         IntPropLevel ipl=IPL_DEF);
01863 
01877   GECODE_INT_EXPORT void
01878   count(Home home, const IntVarArgs& x, const IntSetArgs& c,
01879         IntPropLevel ipl=IPL_DEF);
01880 
01897   GECODE_INT_EXPORT void
01898   count(Home home, const IntVarArgs& x,
01899         const IntVarArgs& c, const IntArgs& v,
01900         IntPropLevel ipl=IPL_DEF);
01901 
01918   GECODE_INT_EXPORT void
01919   count(Home home, const IntVarArgs& x,
01920         const IntSetArgs& c, const IntArgs& v,
01921         IntPropLevel ipl=IPL_DEF);
01922 
01939   GECODE_INT_EXPORT void
01940   count(Home home, const IntVarArgs& x,
01941         const IntSet& c, const IntArgs& v,
01942         IntPropLevel ipl=IPL_DEF);
01943 
01945 
01960   GECODE_INT_EXPORT void
01961   nvalues(Home home, const IntVarArgs& x, IntRelType irt, int y,
01962           IntPropLevel ipl=IPL_DEF);
01966   GECODE_INT_EXPORT void
01967   nvalues(Home home, const IntVarArgs& x, IntRelType irt, IntVar y,
01968           IntPropLevel ipl=IPL_DEF);
01972   GECODE_INT_EXPORT void
01973   nvalues(Home home, const BoolVarArgs& x, IntRelType irt, int y,
01974           IntPropLevel ipl=IPL_DEF);
01978   GECODE_INT_EXPORT void
01979   nvalues(Home home, const BoolVarArgs& x, IntRelType irt, IntVar y,
01980           IntPropLevel ipl=IPL_DEF);
01982 
02003   GECODE_INT_EXPORT void
02004   sequence(Home home, const IntVarArgs& x, const IntSet& s,
02005            int q, int l, int u, IntPropLevel ipl=IPL_DEF);
02006 
02021   GECODE_INT_EXPORT void
02022   sequence(Home home, const BoolVarArgs& x, const IntSet& s,
02023            int q, int l, int u, IntPropLevel ipl=IPL_DEF);
02024 
02026 
02048   class DFA : public SharedHandle {
02049   private:
02051     class DFAI;
02053     GECODE_INT_EXPORT
02054     bool equal(const DFA& d) const;
02055   public:
02057     class Transition {
02058     public:
02059       int i_state; 
02060       int symbol;  
02061       int o_state; 
02062 
02063       Transition(void);
02065       Transition(int i_state0, int symbol0, int o_state0);
02066     };
02068     class Transitions {
02069     private:
02071       const Transition* c_trans;
02073       const Transition* e_trans;
02074     public:
02076       Transitions(const DFA& d);
02078       Transitions(const DFA& d, int n);
02080       bool operator ()(void) const;
02082       void operator ++(void);
02084       int i_state(void) const;
02086       int symbol(void) const;
02088       int o_state(void) const;
02089     };
02091     class Symbols {
02092     private:
02094       const Transition* c_trans;
02096       const Transition* e_trans;
02097     public:
02099       Symbols(const DFA& d);
02101       bool operator ()(void) const;
02103       void operator ++(void);
02105       int val(void) const;
02106     };
02118     GECODE_INT_EXPORT
02119     void init(int s, Transition t[], int f[], bool minimize=true);
02120   public:
02121     friend class Transitions;
02123     DFA(void);
02135     GECODE_INT_EXPORT
02136     DFA(int s, Transition t[], int f[], bool minimize=true);
02146     GECODE_INT_EXPORT
02147     DFA(int s, std::initializer_list<Transition> t,
02148         std::initializer_list<int> f, bool minimize=true);
02150     DFA(const DFA& d);
02152     GECODE_INT_EXPORT
02153     bool operator ==(const DFA& d) const;
02155     bool operator !=(const DFA& d) const;
02157     int n_states(void) const;
02159     int n_transitions(void) const;
02161     unsigned int n_symbols(void) const;
02163     unsigned int max_degree(void) const;
02165     int final_fst(void) const;
02167     int final_lst(void) const;
02169     int symbol_min(void) const;
02171     int symbol_max(void) const;
02173     std::size_t hash(void) const;
02174   };
02175 
02176 }
02177 
02178 #include <gecode/int/extensional/dfa.hpp>
02179 
02180 namespace Gecode {
02181 
02190   class TupleSet : public SharedHandle {
02191   public:
02196     typedef int* Tuple;
02198     typedef Gecode::Support::BitSetData BitSetData;
02200     class Range {
02201     public:
02203       int min;
02205       int max;
02207       BitSetData* s;
02209       unsigned int width(void) const;
02211       const BitSetData* supports(unsigned int n_words, int n) const;
02212     };
02213   protected:
02215     class ValueData {
02216     public:
02218       unsigned int n;
02220       Range* r;
02222       unsigned int start(int n) const;
02223     };
02228     class GECODE_VTABLE_EXPORT Data : public SharedHandle::Object {
02229     protected:
02231       static const int n_initial_free = 1024;
02232     public:
02234       int arity;
02236       unsigned int n_words;
02238       int n_tuples;
02240       int n_free;
02242       int min;
02244       int max;
02246       std::size_t key;
02248       int* td;
02250       ValueData* vd;
02252       Range* range;
02254       BitSetData* support;
02255 
02257       Tuple add(void);
02259       Tuple get(int i) const;
02261       static void set(BitSetData* d, unsigned int n);
02263       static bool get(const BitSetData* d, unsigned int n);
02265       unsigned int tuple2idx(Tuple t) const;
02267       const Range* fst(int i) const;
02269       const Range* lst(int i) const;
02271       GECODE_INT_EXPORT
02272       void finalize(void);
02274       GECODE_INT_EXPORT
02275       void resize(void);
02277       bool finalized(void) const;
02279       Data(int a);
02281       GECODE_INT_EXPORT
02282       virtual ~Data(void);
02283     };
02284 
02286     Data& data(void) const;
02288     Data& raw(void) const;
02290     GECODE_INT_EXPORT
02291     void _add(const IntArgs& t);
02293     GECODE_INT_EXPORT
02294     bool equal(const TupleSet& t) const;
02295   public:
02297 
02298 
02299     TupleSet(void);
02301     GECODE_INT_EXPORT
02302     TupleSet(int a);
02304     GECODE_INT_EXPORT
02305     void init(int a);
02307     GECODE_INT_EXPORT
02308     TupleSet(const TupleSet& t);
02310     GECODE_INT_EXPORT
02311     TupleSet& operator =(const TupleSet& t);
02313     GECODE_INT_EXPORT
02314     TupleSet(int a, const DFA& dfa);
02316     operator bool(void) const;
02318     bool operator ==(const TupleSet& t) const;
02320     bool operator !=(const TupleSet& t) const;
02322 
02324 
02325 
02326     TupleSet& add(const IntArgs& t);
02328     bool finalized(void) const;
02330     void finalize(void);
02332 
02334 
02335 
02336     int arity(void) const;
02338     int tuples(void) const;
02340     unsigned int words(void) const;
02342     Tuple operator [](int i) const;
02344     int min(void) const;
02346     int max(void) const;
02348     std::size_t hash(void) const;
02350 
02352 
02353 
02354     const Range* fst(int i) const;
02356     const Range* lst(int i) const;
02358     class Ranges {
02359     protected:
02361       const Range* c;
02363       const Range* l;
02364     public:
02366 
02367 
02368       Ranges(const TupleSet& ts, int i);
02370 
02372 
02373 
02374       bool operator ()(void) const;
02376       void operator ++(void);
02378 
02380 
02381 
02382       int min(void) const;
02384       int max(void) const;
02386       unsigned int width(void) const;
02388     };
02390   };
02391 
02392 }
02393 
02394 #include <gecode/int/extensional/tuple-set.hpp>
02395 
02396 namespace Gecode {
02397 
02410   GECODE_INT_EXPORT void
02411   extensional(Home home, const IntVarArgs& x, DFA d,
02412               IntPropLevel ipl=IPL_DEF);
02413 
02426   GECODE_INT_EXPORT void
02427   extensional(Home home, const BoolVarArgs& x, DFA d,
02428               IntPropLevel ipl=IPL_DEF);
02429 
02440   void
02441   extensional(Home home, const IntVarArgs& x, const TupleSet& t,
02442               IntPropLevel ipl=IPL_DEF);
02443 
02456   GECODE_INT_EXPORT void
02457   extensional(Home home, const IntVarArgs& x, const TupleSet& t, bool pos,
02458               IntPropLevel ipl=IPL_DEF);
02459 
02470   void
02471   extensional(Home home, const IntVarArgs& x, const TupleSet& t, Reify r,
02472               IntPropLevel ipl=IPL_DEF);
02473 
02486   GECODE_INT_EXPORT void
02487   extensional(Home home, const IntVarArgs& x, const TupleSet& t, bool pos,
02488               Reify r,
02489               IntPropLevel ipl=IPL_DEF);
02490 
02501   void
02502   extensional(Home home, const BoolVarArgs& x, const TupleSet& t,
02503               IntPropLevel ipl=IPL_DEF);
02504 
02517   GECODE_INT_EXPORT void
02518   extensional(Home home, const BoolVarArgs& x, const TupleSet& t, bool pos,
02519               IntPropLevel ipl=IPL_DEF);
02520 
02531   void
02532   extensional(Home home, const BoolVarArgs& x, const TupleSet& t, Reify r,
02533               IntPropLevel ipl=IPL_DEF);
02534 
02547   GECODE_INT_EXPORT void
02548   extensional(Home home, const BoolVarArgs& x, const TupleSet& t, bool pos,
02549               Reify r,
02550               IntPropLevel ipl=IPL_DEF);
02551 
02552 }
02553 
02554 #include <gecode/int/extensional.hpp>
02555 
02556 namespace Gecode {
02557 
02569   GECODE_INT_EXPORT void
02570   min(Home home, IntVar x0, IntVar x1, IntVar x2,
02571       IntPropLevel ipl=IPL_DEF);
02579   GECODE_INT_EXPORT void
02580   min(Home home, const IntVarArgs& x, IntVar y,
02581       IntPropLevel ipl=IPL_DEF);
02587   GECODE_INT_EXPORT void
02588   max(Home home, IntVar x0, IntVar x1, IntVar x2,
02589       IntPropLevel ipl=IPL_DEF);
02597   GECODE_INT_EXPORT void
02598   max(Home home, const IntVarArgs& x, IntVar y,
02599       IntPropLevel ipl=IPL_DEF);
02600 
02610   GECODE_INT_EXPORT void
02611   argmin(Home home, const IntVarArgs& x, IntVar y, bool tiebreak=true,
02612          IntPropLevel ipl=IPL_DEF);
02622   GECODE_INT_EXPORT void
02623   argmin(Home home, const IntVarArgs& x, int o, IntVar y, bool tiebreak=true,
02624          IntPropLevel ipl=IPL_DEF);
02634   GECODE_INT_EXPORT void
02635   argmax(Home home, const IntVarArgs& x, IntVar y, bool tiebreak=true,
02636          IntPropLevel ipl=IPL_DEF);
02646   GECODE_INT_EXPORT void
02647   argmax(Home home, const IntVarArgs& x, int o, IntVar y, bool tiebreak=true,
02648          IntPropLevel ipl=IPL_DEF);
02649 
02655   GECODE_INT_EXPORT void
02656   abs(Home home, IntVar x0, IntVar x1,
02657       IntPropLevel ipl=IPL_DEF);
02658 
02664   GECODE_INT_EXPORT void
02665   mult(Home home, IntVar x0, IntVar x1, IntVar x2,
02666        IntPropLevel ipl=IPL_DEF);
02667 
02672   GECODE_INT_EXPORT void
02673   divmod(Home home, IntVar x0, IntVar x1, IntVar x2, IntVar x3,
02674          IntPropLevel ipl=IPL_DEF);
02675 
02680   GECODE_INT_EXPORT void
02681   div(Home home, IntVar x0, IntVar x1, IntVar x2,
02682       IntPropLevel ipl=IPL_DEF);
02683 
02688   GECODE_INT_EXPORT void
02689   mod(Home home, IntVar x0, IntVar x1, IntVar x2,
02690       IntPropLevel ipl=IPL_DEF);
02691 
02697   GECODE_INT_EXPORT void
02698   sqr(Home home, IntVar x0, IntVar x1,
02699       IntPropLevel ipl=IPL_DEF);
02700 
02706   GECODE_INT_EXPORT void
02707   sqrt(Home home, IntVar x0, IntVar x1,
02708        IntPropLevel ipl=IPL_DEF);
02709 
02718   GECODE_INT_EXPORT void
02719   pow(Home home, IntVar x0, int n, IntVar x1,
02720       IntPropLevel ipl=IPL_DEF);
02721 
02730   GECODE_INT_EXPORT void
02731   nroot(Home home, IntVar x0, int n, IntVar x1,
02732        IntPropLevel ipl=IPL_DEF);
02733 
02735 
02771   GECODE_INT_EXPORT void
02772   linear(Home home, const IntVarArgs& x,
02773          IntRelType irt, int c,
02774          IntPropLevel ipl=IPL_DEF);
02778   GECODE_INT_EXPORT void
02779   linear(Home home, const IntVarArgs& x,
02780          IntRelType irt, IntVar y,
02781          IntPropLevel ipl=IPL_DEF);
02785   GECODE_INT_EXPORT void
02786   linear(Home home, const IntVarArgs& x,
02787          IntRelType irt, int c, Reify r,
02788          IntPropLevel ipl=IPL_DEF);
02792   GECODE_INT_EXPORT void
02793   linear(Home home, const IntVarArgs& x,
02794          IntRelType irt, IntVar y, Reify r,
02795          IntPropLevel ipl=IPL_DEF);
02802   GECODE_INT_EXPORT void
02803   linear(Home home, const IntArgs& a, const IntVarArgs& x,
02804          IntRelType irt, int c,
02805          IntPropLevel ipl=IPL_DEF);
02812   GECODE_INT_EXPORT void
02813   linear(Home home, const IntArgs& a, const IntVarArgs& x,
02814          IntRelType irt, IntVar y,
02815          IntPropLevel ipl=IPL_DEF);
02822   GECODE_INT_EXPORT void
02823   linear(Home home, const IntArgs& a, const IntVarArgs& x,
02824          IntRelType irt, int c, Reify r,
02825          IntPropLevel ipl=IPL_DEF);
02832   GECODE_INT_EXPORT void
02833   linear(Home home, const IntArgs& a, const IntVarArgs& x,
02834          IntRelType irt, IntVar y, Reify r,
02835          IntPropLevel ipl=IPL_DEF);
02836 
02837 
02865   GECODE_INT_EXPORT void
02866   linear(Home home, const BoolVarArgs& x,
02867          IntRelType irt, int c,
02868          IntPropLevel ipl=IPL_DEF);
02872   GECODE_INT_EXPORT void
02873   linear(Home home, const BoolVarArgs& x,
02874          IntRelType irt, int c, Reify r,
02875          IntPropLevel ipl=IPL_DEF);
02879   GECODE_INT_EXPORT void
02880   linear(Home home, const BoolVarArgs& x,
02881          IntRelType irt, IntVar y,
02882          IntPropLevel ipl=IPL_DEF);
02886   GECODE_INT_EXPORT void
02887   linear(Home home, const BoolVarArgs& x,
02888          IntRelType irt, IntVar y, Reify r,
02889          IntPropLevel ipl=IPL_DEF);
02896   GECODE_INT_EXPORT void
02897   linear(Home home, const IntArgs& a, const BoolVarArgs& x,
02898          IntRelType irt, int c,
02899          IntPropLevel ipl=IPL_DEF);
02906   GECODE_INT_EXPORT void
02907   linear(Home home, const IntArgs& a, const BoolVarArgs& x,
02908          IntRelType irt, int c, Reify r,
02909          IntPropLevel ipl=IPL_DEF);
02916   GECODE_INT_EXPORT void
02917   linear(Home home, const IntArgs& a, const BoolVarArgs& x,
02918          IntRelType irt, IntVar y,
02919          IntPropLevel ipl=IPL_DEF);
02926   GECODE_INT_EXPORT void
02927   linear(Home home, const IntArgs& a, const BoolVarArgs& x,
02928          IntRelType irt, IntVar y, Reify r,
02929          IntPropLevel ipl=IPL_DEF);
02930 
02931 
02958   GECODE_INT_EXPORT void
02959   binpacking(Home home,
02960              const IntVarArgs& l,
02961              const IntVarArgs& b, const IntArgs& s,
02962              IntPropLevel ipl=IPL_DEF);
02963   /* \brief Post propagator for multi-dimensional bin packing
02964    *
02965    * In the following \a n refers to the number of items and \a m
02966    * refers to the number of bins.
02967    *
02968    * The multi-dimensional bin-packing constraint enforces that
02969    * all items are packed into bins
02970    * \f$b_i\in\{0,\ldots,m-1\}\f$ for \f$0\leq i<n\f$
02971    * and that the load of each bin corresponds to the items
02972    * packed into it for each dimension \f$l_{j\cdot
02973    * d + k} = \sum_{\{i\in\{0,\ldots,n-1\}|
02974    * b_{j\cdot d+k}=i}\}s_{i\cdot d+k}\f$
02975    * for \f$0\leq j<m\f$, \f$0\leq k<d\f$
02976    * Furthermore, the load variables must satisfy the capacity
02977    * constraints \f$l_{j\cdot d + k} \leq
02978    * c_k\f$ for \f$0\leq j<m\f$, \f$0\leq k<d\f$.
02979    *
02980    * The constraint is implemented by the decomposition
02981    * introduced in: Stefano Gualandi and Michele Lombardi. A
02982    * simple and effective decomposition for the multidimensional
02983    * binpacking constraint. CP 2013, pages 356--364.
02984    *
02985    * Posting the constraint returns a maximal set containing conflicting
02986    * items that require pairwise different bins.
02987    *
02988    * Note that posting the constraint has exponential complexity in the
02989    * number of items due to the Bron-Kerbosch algorithm used for finding
02990    * the maximal conflict item sets.
02991    *
02992    * Throws the following exceptions:
02993    *  - Of type Int::ArgumentSizeMismatch if any of the following properties
02994    *    is violated: \f$|b|=n\f$, \f$|l|=m\cdot d\f$, \f$|s|=n\cdot d\f$,
02995    *    and \f$|c|=d\f$.
02996    *  - Of type Int::ArgumentSame if \a l and \a b share unassigned variables.
02997    *  - Of type Int::OutOfLimits if \a s or \a c contains a negative number.
02998    *
02999    * \ingroup TaskModelIntBinPacking
03000    */
03001   GECODE_INT_EXPORT IntSet
03002   binpacking(Home home, int d,
03003              const IntVarArgs& l, const IntVarArgs& b,
03004              const IntArgs& s, const IntArgs& c,
03005              IntPropLevel ipl=IPL_DEF);
03006 
03007 
03026   GECODE_INT_EXPORT void
03027   nooverlap(Home home,
03028             const IntVarArgs& x, const IntArgs& w,
03029             const IntVarArgs& y, const IntArgs& h,
03030             IntPropLevel ipl=IPL_DEF);
03044   GECODE_INT_EXPORT void
03045   nooverlap(Home home,
03046             const IntVarArgs& x, const IntArgs& w,
03047             const IntVarArgs& y, const IntArgs& h,
03048             const BoolVarArgs& o,
03049             IntPropLevel ipl=IPL_DEF);
03066   GECODE_INT_EXPORT void
03067   nooverlap(Home home,
03068             const IntVarArgs& x0, const IntVarArgs& w, const IntVarArgs& x1,
03069             const IntVarArgs& y0, const IntVarArgs& h, const IntVarArgs& y1,
03070             IntPropLevel ipl=IPL_DEF);
03088   GECODE_INT_EXPORT void
03089   nooverlap(Home home,
03090             const IntVarArgs& x0, const IntVarArgs& w, const IntVarArgs& x1,
03091             const IntVarArgs& y0, const IntVarArgs& h, const IntVarArgs& y1,
03092             const BoolVarArgs& o,
03093             IntPropLevel ipl=IPL_DEF);
03094 
03095 
03101 
03144   GECODE_INT_EXPORT void
03145   cumulatives(Home home, const IntVarArgs& m,
03146               const IntVarArgs& s, const IntVarArgs& p,
03147               const IntVarArgs& e, const IntVarArgs& u,
03148               const IntArgs& c, bool at_most,
03149               IntPropLevel ipl=IPL_DEF);
03154   GECODE_INT_EXPORT void
03155   cumulatives(Home home, const IntArgs& m,
03156               const IntVarArgs& s, const IntVarArgs& p,
03157               const IntVarArgs& e, const IntVarArgs& u,
03158               const IntArgs& c, bool at_most,
03159               IntPropLevel ipl=IPL_DEF);
03164   GECODE_INT_EXPORT void
03165   cumulatives(Home home, const IntVarArgs& m,
03166               const IntVarArgs& s, const IntArgs& p,
03167               const IntVarArgs& e, const IntVarArgs& u,
03168               const IntArgs& c, bool at_most,
03169               IntPropLevel ipl=IPL_DEF);
03174   GECODE_INT_EXPORT void
03175   cumulatives(Home home, const IntArgs& m,
03176               const IntVarArgs& s, const IntArgs& p,
03177               const IntVarArgs& e, const IntVarArgs& u,
03178               const IntArgs& c, bool at_most,
03179               IntPropLevel ipl=IPL_DEF);
03184   GECODE_INT_EXPORT void
03185   cumulatives(Home home, const IntVarArgs& m,
03186               const IntVarArgs& s, const IntVarArgs& p,
03187               const IntVarArgs& e, const IntArgs& u,
03188               const IntArgs& c, bool at_most,
03189               IntPropLevel ipl=IPL_DEF);
03194   GECODE_INT_EXPORT void
03195   cumulatives(Home home, const IntArgs& m,
03196               const IntVarArgs& s, const IntVarArgs& p,
03197               const IntVarArgs& e, const IntArgs& u,
03198               const IntArgs& c, bool at_most,
03199               IntPropLevel ipl=IPL_DEF);
03204   GECODE_INT_EXPORT void
03205   cumulatives(Home home, const IntVarArgs& m,
03206               const IntVarArgs& s, const IntArgs& p,
03207               const IntVarArgs& e, const IntArgs& u,
03208               const IntArgs& c, bool at_most,
03209               IntPropLevel ipl=IPL_DEF);
03214   GECODE_INT_EXPORT void
03215   cumulatives(Home home, const IntArgs& m,
03216               const IntVarArgs& s, const IntArgs& p,
03217               const IntVarArgs& e, const IntArgs& u,
03218               const IntArgs& c, bool at_most,
03219               IntPropLevel ipl=IPL_DEF);
03220 
03247   GECODE_INT_EXPORT void
03248   unary(Home home, const IntVarArgs& s, const IntArgs& p,
03249         IntPropLevel ipl=IPL_DEF);
03250 
03279   GECODE_INT_EXPORT void
03280   unary(Home home, const IntVarArgs& s, const IntArgs& p,
03281         const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
03282 
03319   GECODE_INT_EXPORT void
03320   unary(Home home, const TaskTypeArgs& t,
03321         const IntVarArgs& flex, const IntArgs& fix, IntPropLevel ipl=IPL_DEF);
03322 
03361   GECODE_INT_EXPORT void
03362   unary(Home home, const TaskTypeArgs& t,
03363         const IntVarArgs& flex, const IntArgs& fix,
03364         const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
03365 
03392   GECODE_INT_EXPORT void
03393   unary(Home home, const IntVarArgs& s, const IntVarArgs& p,
03394         const IntVarArgs& e, IntPropLevel ipl=IPL_DEF);
03395 
03424   GECODE_INT_EXPORT void
03425   unary(Home home, const IntVarArgs& s, const IntVarArgs& p,
03426         const IntVarArgs& e, const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
03427 
03428 
03429 
03472   GECODE_INT_EXPORT void
03473   cumulative(Home home, int c, const TaskTypeArgs& t,
03474              const IntVarArgs& flex, const IntArgs& fix, const IntArgs& u,
03475              IntPropLevel ipl=IPL_DEF);
03476 
03477 
03482   GECODE_INT_EXPORT void
03483   cumulative(Home home, IntVar c, const TaskTypeArgs& t,
03484              const IntVarArgs& flex, const IntArgs& fix, const IntArgs& u,
03485              IntPropLevel ipl=IPL_DEF);
03486 
03531   GECODE_INT_EXPORT void
03532   cumulative(Home home, int c, const TaskTypeArgs& t,
03533              const IntVarArgs& flex, const IntArgs& fix, const IntArgs& u,
03534              const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
03535 
03539   GECODE_INT_EXPORT void
03540   cumulative(Home home, IntVar c, const TaskTypeArgs& t,
03541              const IntVarArgs& flex, const IntArgs& fix, const IntArgs& u,
03542              const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
03543 
03576   GECODE_INT_EXPORT void
03577   cumulative(Home home, int c, const IntVarArgs& s, const IntArgs& p,
03578              const IntArgs& u, IntPropLevel ipl=IPL_DEF);
03579 
03583   GECODE_INT_EXPORT void
03584   cumulative(Home home, IntVar c, const IntVarArgs& s, const IntArgs& p,
03585              const IntArgs& u, IntPropLevel ipl=IPL_DEF);
03586 
03621   GECODE_INT_EXPORT void
03622   cumulative(Home home, int c, const IntVarArgs& s, const IntArgs& p,
03623              const IntArgs& u, const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
03624 
03628   GECODE_INT_EXPORT void
03629   cumulative(Home home, IntVar c, const IntVarArgs& s, const IntArgs& p,
03630              const IntArgs& u, const BoolVarArgs& m, IntPropLevel ipl=IPL_DEF);
03631 
03668   GECODE_INT_EXPORT void
03669   cumulative(Home home, int c, const IntVarArgs& s, const IntVarArgs& p,
03670              const IntVarArgs& e, const IntArgs& u, IntPropLevel ipl=IPL_DEF);
03671 
03675   GECODE_INT_EXPORT void
03676   cumulative(Home home, IntVar c, const IntVarArgs& s, const IntVarArgs& p,
03677              const IntVarArgs& e, const IntArgs& u, IntPropLevel ipl=IPL_DEF);
03678 
03717   GECODE_INT_EXPORT void
03718   cumulative(Home home, int c, const IntVarArgs& s, const IntVarArgs& p,
03719              const IntVarArgs& e, const IntArgs& u, const BoolVarArgs& m,
03720              IntPropLevel ipl=IPL_DEF);
03721 
03725   GECODE_INT_EXPORT void
03726   cumulative(Home home, IntVar c, const IntVarArgs& s, const IntVarArgs& p,
03727              const IntVarArgs& e, const IntArgs& u, const BoolVarArgs& m,
03728              IntPropLevel ipl=IPL_DEF);
03730 
03731 
03751   GECODE_INT_EXPORT void
03752   circuit(Home home, const IntVarArgs& x,
03753           IntPropLevel ipl=IPL_DEF);
03769   GECODE_INT_EXPORT void
03770   circuit(Home home, int offset, const IntVarArgs& x,
03771           IntPropLevel ipl=IPL_DEF);
03793   GECODE_INT_EXPORT void
03794   circuit(Home home,
03795           const IntArgs& c,
03796           const IntVarArgs& x, const IntVarArgs& y, IntVar z,
03797           IntPropLevel ipl=IPL_DEF);
03820   GECODE_INT_EXPORT void
03821   circuit(Home home,
03822           const IntArgs& c, int offset,
03823           const IntVarArgs& x, const IntVarArgs& y, IntVar z,
03824           IntPropLevel ipl=IPL_DEF);
03843   GECODE_INT_EXPORT void
03844   circuit(Home home,
03845           const IntArgs& c,
03846           const IntVarArgs& x, IntVar z,
03847           IntPropLevel ipl=IPL_DEF);
03868   GECODE_INT_EXPORT void
03869   circuit(Home home,
03870           const IntArgs& c, int offset,
03871           const IntVarArgs& x, IntVar z,
03872           IntPropLevel ipl=IPL_DEF);
03888   GECODE_INT_EXPORT void
03889   path(Home home, const IntVarArgs& x, IntVar s, IntVar e,
03890        IntPropLevel ipl=IPL_DEF);
03908   GECODE_INT_EXPORT void
03909   path(Home home, int offset, const IntVarArgs& x, IntVar s, IntVar e,
03910        IntPropLevel ipl=IPL_DEF);
03933   GECODE_INT_EXPORT void
03934   path(Home home,
03935        const IntArgs& c,
03936        const IntVarArgs& x, IntVar s, IntVar e, const IntVarArgs& y, IntVar z,
03937        IntPropLevel ipl=IPL_DEF);
03962   GECODE_INT_EXPORT void
03963   path(Home home,
03964        const IntArgs& c, int offset,
03965        const IntVarArgs& x, IntVar s, IntVar e, const IntVarArgs& y, IntVar z,
03966        IntPropLevel ipl=IPL_DEF);
03987   GECODE_INT_EXPORT void
03988   path(Home home,
03989        const IntArgs& c,
03990        const IntVarArgs& x, IntVar s, IntVar e, IntVar z,
03991        IntPropLevel ipl=IPL_DEF);
04014   GECODE_INT_EXPORT void
04015   path(Home home,
04016        const IntArgs& c, int offset,
04017        const IntVarArgs& x, IntVar s, IntVar e, IntVar z,
04018        IntPropLevel ipl=IPL_DEF);
04020 
04021 
04022 
04031 
04032   GECODE_INT_EXPORT void
04033   wait(Home home, IntVar x, std::function<void(Space& home)> c,
04034        IntPropLevel ipl=IPL_DEF);
04036   GECODE_INT_EXPORT void
04037   wait(Home home, BoolVar x, std::function<void(Space& home)> c,
04038        IntPropLevel ipl=IPL_DEF);
04040   GECODE_INT_EXPORT void
04041   wait(Home home, const IntVarArgs& x, std::function<void(Space& home)> c,
04042        IntPropLevel ipl=IPL_DEF);
04044   GECODE_INT_EXPORT void
04045   wait(Home home, const BoolVarArgs& x,
04046        std::function<void(Space& home)> c,
04047        IntPropLevel ipl=IPL_DEF);
04049   GECODE_INT_EXPORT void
04050   when(Home home, BoolVar x,
04051        std::function<void(Space& home)> t,
04052        std::function<void(Space& home)> e,
04053        IntPropLevel ipl=IPL_DEF);
04055   GECODE_INT_EXPORT void
04056   when(Home home, BoolVar x,
04057        std::function<void(Space& home)> t,
04058        IntPropLevel ipl=IPL_DEF);
04060 
04061 
04086   GECODE_INT_EXPORT void
04087   unshare(Home home, IntVarArgs& x,
04088           IntPropLevel ipl=IPL_DEF);
04090   GECODE_INT_EXPORT void
04091   unshare(Home home, BoolVarArgs& x,
04092           IntPropLevel ipl=IPL_DEF);
04094 
04095 }
04096 
04097 namespace Gecode {
04098 
04112   typedef std::function<bool(const Space& home, IntVar x, int i)>
04113     IntBranchFilter;
04122   typedef std::function<bool(const Space& home, BoolVar x, int i)>
04123     BoolBranchFilter;
04124 
04134   typedef std::function<double(const Space& home, IntVar x, int i)> 
04135     IntBranchMerit;
04145   typedef std::function<double(const Space& home, BoolVar x, int i)>
04146     BoolBranchMerit;
04147 
04158   typedef std::function<int(const Space& home, IntVar x, int i)>
04159     IntBranchVal;
04170   typedef std::function<int(const Space& home, BoolVar x, int i)>
04171     BoolBranchVal;
04172 
04184   typedef std::function<void(Space& home, unsigned int a,
04185                              IntVar x, int i, int n)>
04186     IntBranchCommit;
04198   typedef std::function<void(Space& home, unsigned int a,
04199                              BoolVar x, int i, int n)>
04200     BoolBranchCommit;
04201 
04202 }
04203 
04204 #include <gecode/int/branch/traits.hpp>
04205 
04206 namespace Gecode {
04207 
04213   class IntAFC : public AFC {
04214   public:
04222     IntAFC(void);
04224     IntAFC(const IntAFC& a);
04226     IntAFC& operator =(const IntAFC& a);
04234     IntAFC(Home home, const IntVarArgs& x, double d=1.0, bool share=true);
04245     void init(Home home, const IntVarArgs& x, double d=1.0, bool share=true);
04246   };
04247 
04253   class BoolAFC : public AFC {
04254   public:
04262     BoolAFC(void);
04264     BoolAFC(const BoolAFC& a);
04266     BoolAFC& operator =(const BoolAFC& a);
04274     BoolAFC(Home home, const BoolVarArgs& x, double d=1.0, bool share=true);
04285     void init(Home home, const BoolVarArgs& x, double d=1.0, bool share=true);
04286   };
04287 
04288 }
04289 
04290 #include <gecode/int/branch/afc.hpp>
04291 
04292 namespace Gecode {
04293 
04299   class IntAction : public Action {
04300   public:
04308     IntAction(void);
04310     IntAction(const IntAction& a);
04312     IntAction& operator =(const IntAction& a);
04320     GECODE_INT_EXPORT
04321     IntAction(Home home, const IntVarArgs& x, double d=1.0,
04322               IntBranchMerit bm=nullptr);
04334     GECODE_INT_EXPORT void
04335     init(Home home, const IntVarArgs& x, double d=1.0,
04336          IntBranchMerit bm=nullptr);
04337   };
04338 
04344   class BoolAction : public Action {
04345   public:
04353     BoolAction(void);
04355     BoolAction(const BoolAction& a);
04357     BoolAction& operator =(const BoolAction& a);
04365     GECODE_INT_EXPORT
04366     BoolAction(Home home, const BoolVarArgs& x, double d=1.0,
04367                BoolBranchMerit bm=nullptr);
04379     GECODE_INT_EXPORT void
04380     init(Home home, const BoolVarArgs& x, double d=1.0,
04381          BoolBranchMerit bm=nullptr);
04382   };
04383 
04384 }
04385 
04386 #include <gecode/int/branch/action.hpp>
04387 
04388 namespace Gecode {
04389 
04395   class IntCHB : public CHB {
04396   public:
04404     IntCHB(void);
04406     IntCHB(const IntCHB& chb);
04408     IntCHB& operator =(const IntCHB& chb);
04417     GECODE_INT_EXPORT
04418     IntCHB(Home home, const IntVarArgs& x, IntBranchMerit bm=nullptr);
04430     GECODE_INT_EXPORT void
04431     init(Home home, const IntVarArgs& x, IntBranchMerit bm=nullptr);
04432   };
04433 
04439   class BoolCHB : public CHB {
04440   public:
04448     BoolCHB(void);
04450     BoolCHB(const BoolCHB& chb);
04452     BoolCHB& operator =(const BoolCHB& chb);
04461     GECODE_INT_EXPORT
04462     BoolCHB(Home home, const BoolVarArgs& x, BoolBranchMerit bm=nullptr);
04474     GECODE_INT_EXPORT void
04475     init(Home home, const BoolVarArgs& x, BoolBranchMerit bm=nullptr);
04476   };
04477 
04478 }
04479 
04480 #include <gecode/int/branch/chb.hpp>
04481 
04482 namespace Gecode {
04483 
04485   typedef std::function<void(const Space &home, const Brancher& b,
04486                              unsigned int a,
04487                              IntVar x, int i, const int& n,
04488                              std::ostream& o)>
04489     IntVarValPrint;
04490 
04492   typedef std::function<void(const Space &home, const Brancher& b,
04493                              unsigned int a,
04494                              BoolVar x, int i, const int& n,
04495                              std::ostream& o)>
04496     BoolVarValPrint;
04497 
04498 }
04499 
04500 namespace Gecode {
04501 
04507   class IntVarBranch : public VarBranch<IntVar> {
04508   public:
04510     enum Select {
04511       SEL_NONE = 0,        
04512       SEL_RND,             
04513       SEL_MERIT_MIN,       
04514       SEL_MERIT_MAX,       
04515       SEL_DEGREE_MIN,      
04516       SEL_DEGREE_MAX,      
04517       SEL_AFC_MIN,         
04518       SEL_AFC_MAX,         
04519       SEL_ACTION_MIN,      
04520       SEL_ACTION_MAX,      
04521       SEL_CHB_MIN,         
04522       SEL_CHB_MAX,         
04523       SEL_MIN_MIN,         
04524       SEL_MIN_MAX,         
04525       SEL_MAX_MIN,         
04526       SEL_MAX_MAX,         
04527       SEL_SIZE_MIN,        
04528       SEL_SIZE_MAX,        
04529       SEL_DEGREE_SIZE_MIN, 
04530       SEL_DEGREE_SIZE_MAX, 
04531       SEL_AFC_SIZE_MIN,    
04532       SEL_AFC_SIZE_MAX,    
04533       SEL_ACTION_SIZE_MIN, 
04534       SEL_ACTION_SIZE_MAX, 
04535       SEL_CHB_SIZE_MIN,    
04536       SEL_CHB_SIZE_MAX,    
04537 
04542       SEL_REGRET_MIN_MIN,
04548       SEL_REGRET_MIN_MAX,
04554       SEL_REGRET_MAX_MIN,
04560       SEL_REGRET_MAX_MAX
04561     };
04562   protected:
04564     Select s;
04565   public:
04567     IntVarBranch(void);
04569     IntVarBranch(Rnd r);
04571     IntVarBranch(Select s, BranchTbl t);
04573     IntVarBranch(Select s, double d, BranchTbl t);
04575     IntVarBranch(Select s, IntAFC a, BranchTbl t);
04577     IntVarBranch(Select s, IntAction a, BranchTbl t);
04579     IntVarBranch(Select s, IntCHB c, BranchTbl t);
04581     IntVarBranch(Select s, IntBranchMerit mf, BranchTbl t);
04583     Select select(void) const;
04585     void expand(Home home, const IntVarArgs& x);
04586   };
04587 
04593   class BoolVarBranch : public VarBranch<BoolVar> {
04594   public:
04596     enum Select {
04597       SEL_NONE = 0,        
04598       SEL_RND,             
04599       SEL_MERIT_MIN,       
04600       SEL_MERIT_MAX,       
04601       SEL_DEGREE_MIN,      
04602       SEL_DEGREE_MAX,      
04603       SEL_AFC_MIN,         
04604       SEL_AFC_MAX,         
04605       SEL_ACTION_MIN,      
04606       SEL_ACTION_MAX,      
04607       SEL_CHB_MIN,         
04608       SEL_CHB_MAX          
04609     };
04610   protected:
04612     Select s;
04613   public:
04615     BoolVarBranch(void);
04617     BoolVarBranch(Rnd r);
04619     BoolVarBranch(Select s, BranchTbl t);
04621     BoolVarBranch(Select s, double d, BranchTbl t);
04623     BoolVarBranch(Select s, BoolAFC a, BranchTbl t);
04625     BoolVarBranch(Select s, BoolAction a, BranchTbl t);
04627     BoolVarBranch(Select s, BoolCHB c, BranchTbl t);
04629     BoolVarBranch(Select s, BoolBranchMerit mf, BranchTbl t);
04631     Select select(void) const;
04633     void expand(Home home, const BoolVarArgs& x);
04634   };
04635 
04641 
04642   IntVarBranch INT_VAR_NONE(void);
04644   IntVarBranch INT_VAR_RND(Rnd r);
04646   IntVarBranch INT_VAR_MERIT_MIN(IntBranchMerit bm, BranchTbl tbl=nullptr);
04648   IntVarBranch INT_VAR_MERIT_MAX(IntBranchMerit bm, BranchTbl tbl=nullptr);
04650   IntVarBranch INT_VAR_DEGREE_MIN(BranchTbl tbl=nullptr);
04652   IntVarBranch INT_VAR_DEGREE_MAX(BranchTbl tbl=nullptr);
04654   IntVarBranch INT_VAR_AFC_MIN(double d=1.0, BranchTbl tbl=nullptr);
04656   IntVarBranch INT_VAR_AFC_MIN(IntAFC a, BranchTbl tbl=nullptr);
04658   IntVarBranch INT_VAR_AFC_MAX(double d=1.0, BranchTbl tbl=nullptr);
04660   IntVarBranch INT_VAR_AFC_MAX(IntAFC a, BranchTbl tbl=nullptr);
04662   IntVarBranch INT_VAR_ACTION_MIN(double d=1.0, BranchTbl tbl=nullptr);
04664   IntVarBranch INT_VAR_ACTION_MIN(IntAction a, BranchTbl tbl=nullptr);
04666   IntVarBranch INT_VAR_ACTION_MAX(double d=1.0, BranchTbl tbl=nullptr);
04668   IntVarBranch INT_VAR_ACTION_MAX(IntAction a, BranchTbl tbl=nullptr);
04670   IntVarBranch INT_VAR_CHB_MIN(IntCHB c, BranchTbl tbl=nullptr);
04672   IntVarBranch INT_VAR_CHB_MIN(BranchTbl tbl=nullptr);
04674   IntVarBranch INT_VAR_CHB_MAX(IntCHB c, BranchTbl tbl=nullptr);
04676   IntVarBranch INT_VAR_CHB_MAX(BranchTbl tbl=nullptr);
04678   IntVarBranch INT_VAR_MIN_MIN(BranchTbl tbl=nullptr);
04680   IntVarBranch INT_VAR_MIN_MAX(BranchTbl tbl=nullptr);
04682   IntVarBranch INT_VAR_MAX_MIN(BranchTbl tbl=nullptr);
04684   IntVarBranch INT_VAR_MAX_MAX(BranchTbl tbl=nullptr);
04686   IntVarBranch INT_VAR_SIZE_MIN(BranchTbl tbl=nullptr);
04688   IntVarBranch INT_VAR_SIZE_MAX(BranchTbl tbl=nullptr);
04690   IntVarBranch INT_VAR_DEGREE_SIZE_MIN(BranchTbl tbl=nullptr);
04692   IntVarBranch INT_VAR_DEGREE_SIZE_MAX(BranchTbl tbl=nullptr);
04694   IntVarBranch INT_VAR_AFC_SIZE_MIN(double d=1.0, BranchTbl tbl=nullptr);
04696   IntVarBranch INT_VAR_AFC_SIZE_MIN(IntAFC a, BranchTbl tbl=nullptr);
04698   IntVarBranch INT_VAR_AFC_SIZE_MAX(double d=1.0, BranchTbl tbl=nullptr);
04700   IntVarBranch INT_VAR_AFC_SIZE_MAX(IntAFC a, BranchTbl tbl=nullptr);
04702   IntVarBranch INT_VAR_ACTION_SIZE_MIN(double d=1.0, BranchTbl tbl=nullptr);
04704   IntVarBranch INT_VAR_ACTION_SIZE_MIN(IntAction a, BranchTbl tbl=nullptr);
04706   IntVarBranch INT_VAR_ACTION_SIZE_MAX(double d=1.0, BranchTbl tbl=nullptr);
04708   IntVarBranch INT_VAR_ACTION_SIZE_MAX(IntAction a, BranchTbl tbl=nullptr);
04710   IntVarBranch INT_VAR_CHB_SIZE_MIN(IntCHB c, BranchTbl tbl=nullptr);
04712   IntVarBranch INT_VAR_CHB_SIZE_MIN(BranchTbl tbl=nullptr);
04714   IntVarBranch INT_VAR_CHB_SIZE_MAX(IntCHB c, BranchTbl tbl=nullptr);
04716   IntVarBranch INT_VAR_CHB_SIZE_MAX(BranchTbl tbl=nullptr);
04722   IntVarBranch INT_VAR_REGRET_MIN_MIN(BranchTbl tbl=nullptr);
04728   IntVarBranch INT_VAR_REGRET_MIN_MAX(BranchTbl tbl=nullptr);
04734   IntVarBranch INT_VAR_REGRET_MAX_MIN(BranchTbl tbl=nullptr);
04740   IntVarBranch INT_VAR_REGRET_MAX_MAX(BranchTbl tbl=nullptr);
04741 
04743   BoolVarBranch BOOL_VAR_NONE(void);
04745   BoolVarBranch BOOL_VAR_RND(Rnd r);
04747   BoolVarBranch BOOL_VAR_MERIT_MIN(BoolBranchMerit bm, BranchTbl tbl=nullptr);
04749   BoolVarBranch BOOL_VAR_MERIT_MAX(BoolBranchMerit bm, BranchTbl tbl=nullptr);
04751   BoolVarBranch BOOL_VAR_DEGREE_MIN(BranchTbl tbl=nullptr);
04753   BoolVarBranch BOOL_VAR_DEGREE_MAX(BranchTbl tbl=nullptr);
04755   BoolVarBranch BOOL_VAR_AFC_MIN(double d=1.0, BranchTbl tbl=nullptr);
04757   BoolVarBranch BOOL_VAR_AFC_MIN(BoolAFC a, BranchTbl tbl=nullptr);
04759   BoolVarBranch BOOL_VAR_AFC_MAX(double d=1.0, BranchTbl tbl=nullptr);
04761   BoolVarBranch BOOL_VAR_AFC_MAX(BoolAFC a, BranchTbl tbl=nullptr);
04763   BoolVarBranch BOOL_VAR_ACTION_MIN(double d=1.0, BranchTbl tbl=nullptr);
04765   BoolVarBranch BOOL_VAR_ACTION_MIN(BoolAction a, BranchTbl tbl=nullptr);
04767   BoolVarBranch BOOL_VAR_ACTION_MAX(double d=1.0, BranchTbl tbl=nullptr);
04769   BoolVarBranch BOOL_VAR_ACTION_MAX(BoolAction a, BranchTbl tbl=nullptr);
04771   BoolVarBranch BOOL_VAR_CHB_MIN(BoolCHB c, BranchTbl tbl=nullptr);
04773   BoolVarBranch BOOL_VAR_CHB_MIN(BranchTbl tbl=nullptr);
04775   BoolVarBranch BOOL_VAR_CHB_MAX(BoolCHB c, BranchTbl tbl=nullptr);
04777   BoolVarBranch BOOL_VAR_CHB_MAX(BranchTbl tbl=nullptr);
04779 
04780 }
04781 
04782 #include <gecode/int/branch/var.hpp>
04783 
04784 namespace Gecode {
04785 
04791   class IntValBranch : public ValBranch<IntVar> {
04792   public:
04794     enum Select {
04795       SEL_MIN,        
04796       SEL_MED,        
04797       SEL_MAX,        
04798       SEL_RND,        
04799       SEL_SPLIT_MIN,  
04800       SEL_SPLIT_MAX,  
04801       SEL_RANGE_MIN,  
04802       SEL_RANGE_MAX,  
04803       SEL_VAL_COMMIT, 
04804       SEL_VALUES_MIN, 
04805       SEL_VALUES_MAX  
04806    };
04807   protected:
04809     Select s;
04810   public:
04812     IntValBranch(Select s = SEL_MIN);
04814     IntValBranch(Rnd r);
04816     IntValBranch(IntBranchVal v, IntBranchCommit c);
04818     Select select(void) const;
04819   };
04820 
04826   class BoolValBranch : public ValBranch<BoolVar> {
04827   public:
04829     enum Select {
04830       SEL_MIN,       
04831       SEL_MAX,       
04832       SEL_RND,       
04833       SEL_VAL_COMMIT 
04834    };
04835   protected:
04837     Select s;
04838   public:
04840     BoolValBranch(Select s = SEL_MIN);
04842     BoolValBranch(Rnd r);
04844     BoolValBranch(BoolBranchVal v, BoolBranchCommit c);
04846     Select select(void) const;
04847   };
04848 
04854 
04855   IntValBranch INT_VAL_MIN(void);
04857   IntValBranch INT_VAL_MED(void);
04859   IntValBranch INT_VAL_MAX(void);
04861   IntValBranch INT_VAL_RND(Rnd r);
04863   IntValBranch INT_VAL_SPLIT_MIN(void);
04865   IntValBranch INT_VAL_SPLIT_MAX(void);
04867   IntValBranch INT_VAL_RANGE_MIN(void);
04869   IntValBranch INT_VAL_RANGE_MAX(void);
04876   IntValBranch INT_VAL(IntBranchVal v, IntBranchCommit c=nullptr);
04878   IntValBranch INT_VALUES_MIN(void);
04880   IntValBranch INT_VALUES_MAX(void);
04881 
04883   BoolValBranch BOOL_VAL_MIN(void);
04885   BoolValBranch BOOL_VAL_MAX(void);
04887   BoolValBranch BOOL_VAL_RND(Rnd r);
04894   BoolValBranch BOOL_VAL(BoolBranchVal v, BoolBranchCommit c=nullptr);
04896 
04897 }
04898 
04899 #include <gecode/int/branch/val.hpp>
04900 
04901 namespace Gecode {
04902 
04908   class IntAssign : public ValBranch<IntVar> {
04909   public:
04911     enum Select {
04912       SEL_MIN,       
04913       SEL_MED,       
04914       SEL_MAX,       
04915       SEL_RND,       
04916       SEL_VAL_COMMIT 
04917     };
04918   protected:
04920     Select s;
04921   public:
04923     IntAssign(Select s = SEL_MIN);
04925     IntAssign(Rnd r);
04927     IntAssign(IntBranchVal v, IntBranchCommit c);
04929     Select select(void) const;
04930   };
04931 
04937   class BoolAssign : public ValBranch<BoolVar> {
04938   public:
04940     enum Select {
04941       SEL_MIN,       
04942       SEL_MAX,       
04943       SEL_RND,       
04944       SEL_VAL_COMMIT 
04945     };
04946   protected:
04948     Select s;
04949   public:
04951     BoolAssign(Select s = SEL_MIN);
04953     BoolAssign(Rnd r);
04955     BoolAssign(BoolBranchVal v, BoolBranchCommit c);
04957     Select select(void) const;
04958   };
04959 
04965 
04966   IntAssign INT_ASSIGN_MIN(void);
04968   IntAssign INT_ASSIGN_MED(void);
04970   IntAssign INT_ASSIGN_MAX(void);
04972   IntAssign INT_ASSIGN_RND(Rnd r);
04979   IntAssign INT_ASSIGN(IntBranchVal v, IntBranchCommit c=nullptr);
04980 
04982   BoolAssign BOOL_ASSIGN_MIN(void);
04984   BoolAssign BOOL_ASSIGN_MAX(void);
04986   BoolAssign BOOL_ASSIGN_RND(Rnd r);
04993   BoolAssign BOOL_ASSIGN(BoolBranchVal v, BoolBranchCommit c=nullptr);
04995 
04996 }
04997 
04998 #include <gecode/int/branch/assign.hpp>
04999 
05000 namespace Gecode {
05006   GECODE_INT_EXPORT void
05007   branch(Home home, const IntVarArgs& x,
05008          IntVarBranch vars, IntValBranch vals,
05009          IntBranchFilter bf=nullptr,
05010          IntVarValPrint vvp=nullptr);
05016   GECODE_INT_EXPORT void
05017   branch(Home home, const IntVarArgs& x,
05018          TieBreak<IntVarBranch> vars, IntValBranch vals,
05019          IntBranchFilter bf=nullptr,
05020          IntVarValPrint vvp=nullptr);
05026   GECODE_INT_EXPORT void
05027   branch(Home home, IntVar x, IntValBranch vals,
05028          IntVarValPrint vvp=nullptr);
05034   GECODE_INT_EXPORT void
05035   branch(Home home, const BoolVarArgs& x,
05036          BoolVarBranch vars, BoolValBranch vals,
05037          BoolBranchFilter bf=nullptr,
05038          BoolVarValPrint vvp=nullptr);
05044   GECODE_INT_EXPORT void
05045   branch(Home home, const BoolVarArgs& x,
05046          TieBreak<BoolVarBranch> vars, BoolValBranch vals,
05047          BoolBranchFilter bf=nullptr,
05048          BoolVarValPrint vvp=nullptr);
05054   GECODE_INT_EXPORT void
05055   branch(Home home, BoolVar x, BoolValBranch vals,
05056          BoolVarValPrint vvp=nullptr);
05057 
05063   GECODE_INT_EXPORT void
05064   assign(Home home, const IntVarArgs& x, IntAssign vals,
05065          IntBranchFilter bf=nullptr,
05066          IntVarValPrint vvp=nullptr);
05072   GECODE_INT_EXPORT void
05073   assign(Home home, IntVar x, IntAssign vals,
05074          IntVarValPrint vvp=nullptr);
05080   GECODE_INT_EXPORT void
05081   assign(Home home, const BoolVarArgs& x, BoolAssign vals,
05082          BoolBranchFilter bf=nullptr,
05083          BoolVarValPrint vvp=nullptr);
05089   GECODE_INT_EXPORT void
05090   assign(Home home, BoolVar x, BoolAssign vals,
05091          BoolVarValPrint vvp=nullptr);
05092 
05093 }
05094 
05095 namespace Gecode {
05096 
05100   template<class Char, class Traits>
05101   std::basic_ostream<Char,Traits>&
05102   operator <<(std::basic_ostream<Char,Traits>& os, const DFA& d);
05103 
05107   template<class Char, class Traits>
05108   std::basic_ostream<Char,Traits>&
05109   operator <<(std::basic_ostream<Char,Traits>& os, const TupleSet& ts);
05110 
05111 }
05112 
05113 // LDSB-related declarations.
05114 namespace Gecode {
05115 
05116   namespace Int { namespace LDSB {
05117     class SymmetryObject;
05118   }}
05119 
05125   class GECODE_INT_EXPORT SymmetryHandle {
05126   public:
05128     Int::LDSB::SymmetryObject* ref;
05130     void increment(void);
05132     void decrement(void);
05133   public:
05135     SymmetryHandle(void);
05137     SymmetryHandle(Int::LDSB::SymmetryObject* o);
05139     SymmetryHandle(const SymmetryHandle& h);
05141     const SymmetryHandle& operator=(const SymmetryHandle& h);
05143     ~SymmetryHandle(void);
05144   };
05145   class Symmetries;
05147   template<>
05148   class ArrayTraits<ArgArray<SymmetryHandle> > {
05149   public:
05150     typedef Symmetries     StorageType;
05151     typedef SymmetryHandle ValueType;
05152     typedef Symmetries     ArgsType;
05153   };
05154 
05161 
05162   class Symmetries : public ArgArray<SymmetryHandle> {};
05163   // If this is instead a typedef, strange things happen with the
05164   // overloading of the "branch" function.
05165 
05167   GECODE_INT_EXPORT SymmetryHandle VariableSymmetry(const IntVarArgs& x);
05169   GECODE_INT_EXPORT SymmetryHandle VariableSymmetry(const BoolVarArgs& x);
05171   GECODE_INT_EXPORT SymmetryHandle VariableSymmetry(const IntVarArgs& x,
05172                                                     const IntArgs& indices);
05174   GECODE_INT_EXPORT SymmetryHandle ValueSymmetry(const IntArgs& v);
05176   GECODE_INT_EXPORT SymmetryHandle ValueSymmetry(const IntSet& v);
05178   GECODE_INT_EXPORT SymmetryHandle ValueSymmetry(IntVar vars);
05184   GECODE_INT_EXPORT
05185   SymmetryHandle VariableSequenceSymmetry(const IntVarArgs& x, int ss);
05191   GECODE_INT_EXPORT
05192   SymmetryHandle VariableSequenceSymmetry(const BoolVarArgs& x, int ss);
05198   GECODE_INT_EXPORT
05199   SymmetryHandle ValueSequenceSymmetry(const IntArgs& v, int ss);
05200 
05202   GECODE_INT_EXPORT SymmetryHandle values_reflect(int lower, int upper);
05204   GECODE_INT_EXPORT SymmetryHandle values_reflect(IntVar x);
05206 
05218   GECODE_INT_EXPORT void
05219   branch(Home home, const IntVarArgs& x,
05220          IntVarBranch vars, IntValBranch vals,
05221          const Symmetries& syms,
05222          IntBranchFilter bf=nullptr,
05223          IntVarValPrint vvp=nullptr);
05235   GECODE_INT_EXPORT void
05236   branch(Home home, const IntVarArgs& x,
05237          TieBreak<IntVarBranch> vars, IntValBranch vals,
05238          const Symmetries& syms,
05239          IntBranchFilter bf=nullptr,
05240          IntVarValPrint vvp=nullptr);
05252   GECODE_INT_EXPORT void
05253   branch(Home home, const BoolVarArgs& x,
05254          BoolVarBranch vars, BoolValBranch vals,
05255          const Symmetries& syms,
05256          BoolBranchFilter bf=nullptr,
05257          BoolVarValPrint vvp=nullptr);
05269   GECODE_INT_EXPORT void
05270   branch(Home home, const BoolVarArgs& x,
05271          TieBreak<BoolVarBranch> vars, BoolValBranch vals,
05272          const Symmetries& syms,
05273          BoolBranchFilter bf=nullptr,
05274          BoolVarValPrint vvp=nullptr);
05275 
05276 #ifdef GECODE_HAS_CBS
05277 
05298   GECODE_INT_EXPORT void
05299   cbsbranch(Home home, const IntVarArgs& x);
05300 
05301 
05322   GECODE_INT_EXPORT void
05323   cbsbranch(Home home, const BoolVarArgs& x);
05324 
05325 #endif
05326 
05327 }
05328 
05329 namespace Gecode {
05330 
05331   /*
05332    * \brief Relaxed assignment of variables in \a x from values in \a sx
05333    *
05334    * The variables in \a x are assigned values from the assigned variables
05335    * in the solution \a sx with a relaxation probability \a p. That is,
05336    * if \$fp=0.1\f$ approximately 10% of the variables in \a x will be
05337    * assigned a value from \a sx.
05338    *
05339    * The random numbers are generated from the generator \a r. At least
05340    * one variable will not be assigned: in case the relaxation attempt
05341    * would suggest that all variables should be assigned, a single
05342    * variable will be selected randomly to remain unassigned.
05343    *
05344    * Throws an exception of type Int::ArgumentSizeMismatch, if \a x and
05345    * \a sx are of different size.
05346    *
05347    * Throws an exception of type Int::OutOfLimits, if \a p is not between
05348    * \a 0.0 and \a 1.0.
05349    *
05350    * \ingroup TaskModelInt
05351    */
05352   GECODE_INT_EXPORT void
05353   relax(Home home, const IntVarArgs& x, const IntVarArgs& sx,
05354         Rnd r, double p);
05355 
05356   /*
05357    * \brief Relaxed assignment of variables in \a x from values in \a sx
05358    *
05359    * The variables in \a x are assigned values from the assigned variables
05360    * in the solution \a sx with a relaxation probability \a p. That is,
05361    * if \$fp=0.1\f$ approximately 10% of the variables in \a x will be
05362    * assigned a value from \a sx.
05363    *
05364    * The random numbers are generated from the generator \a r. At least
05365    * one variable will not be assigned: in case the relaxation attempt
05366    * would suggest that all variables should be assigned, a single
05367    * variable will be selected randomly to remain unassigned.
05368    *
05369    * Throws an exception of type Int::ArgumentSizeMismatch, if \a x and
05370    * \a sx are of different size.
05371    *
05372    * Throws an exception of type Int::OutOfLimits, if \a p is not between
05373    * \a 0.0 and \a 1.0.
05374    *
05375    * \ingroup TaskModelInt
05376    */
05377   GECODE_INT_EXPORT void
05378   relax(Home home, const BoolVarArgs& x, const BoolVarArgs& sx,
05379         Rnd r, double p);
05380 
05381 }
05382 
05383 
05384 #include <gecode/int/trace/int-trace-view.hpp>
05385 #include <gecode/int/trace/bool-trace-view.hpp>
05386 
05387 namespace Gecode {
05388 
05398   class IntTraceDelta
05399     : public Iter::Ranges::Diff<Iter::Ranges::RangeList,
05400                                 Int::ViewRanges<Int::IntView> > {
05401   protected:
05403     Int::ViewRanges<Int::IntView> rn;
05405     Iter::Ranges::RangeList ro;
05406   public:
05408 
05409 
05410     IntTraceDelta(Int::IntTraceView o, Int::IntView n, const Delta& d);
05412   };
05413 
05418   class BoolTraceDelta {
05419   protected:
05421     int delta;
05422   public:
05424 
05425 
05426     BoolTraceDelta(Int::BoolTraceView o, Int::BoolView n, const Delta& d);
05428 
05429 
05430 
05431     bool operator ()(void) const;
05433     void operator ++(void);
05435 
05437 
05438 
05439     int min(void) const;
05441     int max(void) const;
05443     unsigned int width(void) const;
05445   };
05446 
05447 }
05448 
05449 #include <gecode/int/trace/int-delta.hpp>
05450 #include <gecode/int/trace/bool-delta.hpp>
05451 
05452 #include <gecode/int/trace/traits.hpp>
05453 
05454 namespace Gecode {
05455 
05460   typedef ViewTracer<Int::IntView> IntTracer;
05465   typedef ViewTraceRecorder<Int::IntView> IntTraceRecorder;
05466 
05471   class GECODE_INT_EXPORT StdIntTracer : public IntTracer {
05472   protected:
05474     std::ostream& os;
05475   public:
05477     StdIntTracer(std::ostream& os0 = std::cerr);
05479     virtual void init(const Space& home, const IntTraceRecorder& t);
05481     virtual void prune(const Space& home, const IntTraceRecorder& t,
05482                        const ViewTraceInfo& vti, int i, IntTraceDelta& d);
05484     virtual void fix(const Space& home, const IntTraceRecorder& t);
05486     virtual void fail(const Space& home, const IntTraceRecorder& t);
05488     virtual void done(const Space& home, const IntTraceRecorder& t);
05490     static StdIntTracer def;
05491   };
05492 
05493 
05498   typedef ViewTracer<Int::BoolView> BoolTracer;
05503   typedef ViewTraceRecorder<Int::BoolView> BoolTraceRecorder;
05504 
05509   class GECODE_INT_EXPORT StdBoolTracer : public BoolTracer {
05510   protected:
05512     std::ostream& os;
05513   public:
05515     StdBoolTracer(std::ostream& os0 = std::cerr);
05517     virtual void init(const Space& home, const BoolTraceRecorder& t);
05519     virtual void prune(const Space& home, const BoolTraceRecorder& t,
05520                        const ViewTraceInfo& vti, int i, BoolTraceDelta& d);
05522     virtual void fix(const Space& home, const BoolTraceRecorder& t);
05524     virtual void fail(const Space& home, const BoolTraceRecorder& t);
05526     virtual void done(const Space& home, const BoolTraceRecorder& t);
05528     static StdBoolTracer def;
05529   };
05530 
05535   GECODE_INT_EXPORT void
05536   trace(Home home, const IntVarArgs& x,
05537         TraceFilter tf,
05538         int te = (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE),
05539         IntTracer& t = StdIntTracer::def);
05544   void
05545   trace(Home home, const IntVarArgs& x,
05546         int te = (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE),
05547         IntTracer& t = StdIntTracer::def);
05548 
05553   GECODE_INT_EXPORT void
05554   trace(Home home, const BoolVarArgs& x,
05555         TraceFilter tf,
05556         int te = (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE),
05557         BoolTracer& t = StdBoolTracer::def);
05562   void
05563   trace(Home home, const BoolVarArgs& x,
05564         int te = (TE_INIT | TE_PRUNE | TE_FIX | TE_FAIL | TE_DONE),
05565         BoolTracer& t = StdBoolTracer::def);
05566 
05567 }
05568 
05569 #include <gecode/int/trace.hpp>
05570 
05571 #endif
05572 
05573 // IFDEF: GECODE_HAS_INT_VARS
05574 // STATISTICS: int-post
05575