Generated on Wed Nov 5 2014 05:18:21 for Gecode by doxygen 1.7.6.1
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  *     Mikael Lagerkvist <lagerkvist@gecode.org>
00009  *     David Rijsman <David.Rijsman@quintiq.com>
00010  *
00011  *  Copyright:
00012  *     David Rijsman, 2009
00013  *     Mikael Lagerkvist, 2006
00014  *     Christian Schulte, 2002
00015  *     Guido Tack, 2004
00016  *
00017  *  Last modified:
00018  *     $Date: 2013-07-23 14:31:03 +0200 (Tue, 23 Jul 2013) $ by $Author: schulte $
00019  *     $Revision: 13939 $
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 #include <iostream>
00052 
00053 #include <vector>
00054 
00055 #include <gecode/kernel.hh>
00056 #include <gecode/iter.hh>
00057 
00058 /*
00059  * Configure linking
00060  *
00061  */
00062 #if !defined(GECODE_STATIC_LIBS) && \
00063     (defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER))
00064 
00065 #ifdef GECODE_BUILD_INT
00066 #define GECODE_INT_EXPORT __declspec( dllexport )
00067 #else
00068 #define GECODE_INT_EXPORT __declspec( dllimport )
00069 #endif
00070 
00071 #else
00072 
00073 #ifdef GECODE_GCC_HAS_CLASS_VISIBILITY
00074 #define GECODE_INT_EXPORT __attribute__ ((visibility("default")))
00075 #else
00076 #define GECODE_INT_EXPORT
00077 #endif
00078 
00079 #endif
00080 
00081 // Configure auto-linking
00082 #ifndef GECODE_BUILD_INT
00083 #define GECODE_LIBRARY_NAME "Int"
00084 #include <gecode/support/auto-link.hpp>
00085 #endif
00086 
00098 #include <gecode/int/exception.hpp>
00099 
00100 namespace Gecode { namespace Int {
00101 
00109   namespace Limits {
00111     const int max = INT_MAX - 1;
00113     const int min = -max;
00115     const int infinity = max + 1;
00117     const long long int llmax =  LLONG_MAX - 1;
00119     const long long int llmin = -llmax;
00121     const long long int llinfinity = llmax + 1;
00123     bool valid(int n);
00125     bool valid(long long int n);
00127     void check(int n, const char* l);
00129     void check(long long int n, const char* l);
00131     void positive(int n, const char* l);
00133     void positive(long long int n, const char* l);
00135     void nonnegative(int n, const char* l);
00137     void nonnegative(long long int n, const char* l);
00139     bool overflow_add(int n, int m);
00141     bool overflow_add(long long int n, long long int m);
00143     bool overflow_sub(int n, int m);
00145     bool overflow_sub(long long int n, long long int m);
00147     bool overflow_mul(int n, int m);
00149     bool overflow_mul(long long int n, long long int m);
00150   }
00151 
00152 }}
00153 
00154 #include <gecode/int/limits.hpp>
00155 
00156 namespace Gecode {
00157 
00158   class IntSetRanges;
00159 
00160   template<class I> class IntSetInit;
00161   
00169   class IntSet : public SharedHandle {
00170     friend class IntSetRanges;
00171     template<class I> friend class IntSetInit;
00172   private:
00174     class Range {
00175     public:
00176       int min, max;
00177     };
00178     class IntSetObject : public SharedHandle::Object {
00179     public:
00181       unsigned int size;
00183       int n;
00185       Range* r;
00187       GECODE_INT_EXPORT static IntSetObject* allocate(int m);
00189       GECODE_INT_EXPORT SharedHandle::Object* copy(void) const;
00191       GECODE_INT_EXPORT bool in(int n) const;
00193       GECODE_INT_EXPORT virtual ~IntSetObject(void);
00194     };
00196     class MinInc;
00198     GECODE_INT_EXPORT void normalize(Range* r, int n);
00200     GECODE_INT_EXPORT void init(int n, int m);
00202     GECODE_INT_EXPORT void init(const int r[], int n);
00204     GECODE_INT_EXPORT void init(const int r[][2], int n);
00205   public:
00207 
00208 
00209     IntSet(void);
00214     IntSet(int n, int m);
00216     IntSet(const int r[],   int n);
00222     IntSet(const int r[][2], int n);
00224     template<class I>
00225     explicit IntSet(I& i);
00227     template<class I>
00228     explicit IntSet(const I& i);
00230 
00232 
00233 
00234     int ranges(void) const;
00236     int min(int i) const;
00238     int max(int i) const;
00240     unsigned int width(int i) const;
00242 
00244 
00245 
00246     bool in(int n) const;
00248     unsigned int size(void) const;
00250     unsigned int width(void) const;
00252     int min(void) const;
00254     int max(void) const;
00256 
00258 
00259 
00260     GECODE_INT_EXPORT static const IntSet empty;
00262   };
00263 
00269   class IntSetRanges {
00270   private:
00272     const IntSet::Range* i;
00274     const IntSet::Range* e;
00275   public:
00277 
00278 
00279     IntSetRanges(void);
00281     IntSetRanges(const IntSet& s);
00283     void init(const IntSet& s);
00285 
00287 
00288 
00289     bool operator ()(void) const;
00291     void operator ++(void);
00293 
00295 
00296 
00297     int min(void) const;
00299     int max(void) const;
00301     unsigned int width(void) const;
00303   };
00304 
00310   class IntSetValues : public Iter::Ranges::ToValues<IntSetRanges> {
00311   public:
00313 
00314 
00315     IntSetValues(void);
00317     IntSetValues(const IntSet& s);
00319     void init(const IntSet& s);
00321   };
00322 
00327   template<class Char, class Traits>
00328   std::basic_ostream<Char,Traits>&
00329   operator <<(std::basic_ostream<Char,Traits>& os, const IntSet& s);
00330 
00331 }
00332 
00333 #include <gecode/int/int-set-1.hpp>
00334 
00335 #include <gecode/int/var-imp.hpp>
00336 
00337 namespace Gecode {
00338 
00339   namespace Int {
00340     class IntView;
00341   }
00342 
00348   class IntVar : public VarImpVar<Int::IntVarImp> {
00349     friend class IntVarArray;
00350     friend class IntVarArgs;
00351   private:
00352     using VarImpVar<Int::IntVarImp>::x;
00359     void _init(Space& home, int min, int max);
00366     void _init(Space& home, const IntSet& d);
00367   public:
00369 
00370 
00371     IntVar(void);
00373     IntVar(const IntVar& y);
00375     IntVar(const Int::IntView& y);
00387     GECODE_INT_EXPORT IntVar(Space& home, int min, int max);
00399     GECODE_INT_EXPORT IntVar(Space& home, const IntSet& d);
00401 
00403 
00404 
00405     int min(void) const;
00407     int max(void) const;
00409     int med(void) const;
00417     int val(void) const;
00418 
00420     unsigned int size(void) const;
00422     unsigned int width(void) const;
00424     unsigned int regret_min(void) const;
00426     unsigned int regret_max(void) const;
00428 
00430 
00431 
00432     bool range(void) const;
00434     bool in(int n) const;
00436   };
00437 
00442   template<class Char, class Traits>
00443   std::basic_ostream<Char,Traits>&
00444   operator <<(std::basic_ostream<Char,Traits>& os, const IntVar& x);
00445 
00450   class IntVarRanges : public Int::IntVarImpFwd {
00451   public:
00453 
00454 
00455     IntVarRanges(void);
00457     IntVarRanges(const IntVar& x);
00459     void init(const IntVar& x);
00461   };
00462 
00467   class IntVarValues : public Iter::Ranges::ToValues<IntVarRanges> {
00468   public:
00470 
00471 
00472     IntVarValues(void);
00474     IntVarValues(const IntVar& x);
00476     void init(const IntVar& x);
00478   };
00479 
00480   namespace Int {
00481     class BoolView;
00482   }
00483 
00489   class BoolVar : public VarImpVar<Int::BoolVarImp> {
00490     friend class BoolVarArray;
00491     friend class BoolVarArgs;
00492   private:
00493     using VarImpVar<Int::BoolVarImp>::x;
00500     void _init(Space& home, int min, int max);
00501   public:
00503 
00504 
00505     BoolVar(void);
00507     BoolVar(const BoolVar& y);
00509     BoolVar(const Int::BoolView& y);
00521     GECODE_INT_EXPORT BoolVar(Space& home, int min, int max);
00523 
00525 
00526 
00527     int min(void) const;
00529     int max(void) const;
00531     int med(void) const;
00539     int val(void) const;
00540 
00542     unsigned int size(void) const;
00544     unsigned int width(void) const;
00546     unsigned int regret_min(void) const;
00548     unsigned int regret_max(void) const;
00550 
00552 
00553 
00554     bool range(void) const;
00556     bool in(int n) const;
00558 
00560 
00561 
00562     bool zero(void) const;
00564     bool one(void) const;
00566     bool none(void) const;
00568   };
00569 
00574   template<class Char, class Traits>
00575   std::basic_ostream<Char,Traits>&
00576   operator <<(std::basic_ostream<Char,Traits>& os, const BoolVar& x);
00577 
00578 }
00579 
00580 
00581 #include <gecode/int/view.hpp>
00582 #include <gecode/int/propagator.hpp>
00583 
00584 namespace Gecode {
00585 
00595 
00596   typedef ArgArray<IntSet> IntSetArgs;
00597 
00598 }
00599 
00600 #include <gecode/int/array-traits.hpp>
00601 
00602 namespace Gecode {
00603 
00605   class IntArgs : public PrimArgArray<int> {
00606   public:
00608 
00609 
00610     IntArgs(void);
00612     explicit IntArgs(int n);
00614     IntArgs(const SharedArray<int>& x);
00616     IntArgs(const std::vector<int>& x);
00618     template<class InputIterator>
00619     IntArgs(InputIterator first, InputIterator last);
00621     GECODE_INT_EXPORT
00622     IntArgs(int n, int e0, ...);
00624     IntArgs(int n, const int* e);
00626     IntArgs(const PrimArgArray<int>& a);
00627 
00629     static IntArgs create(int n, int start, int inc=1);
00631   };
00632 
00634   class IntVarArgs : public VarArgArray<IntVar> {
00635   public:
00637 
00638 
00639     IntVarArgs(void) {}
00641     explicit IntVarArgs(int n) : VarArgArray<IntVar>(n) {}
00643     IntVarArgs(const IntVarArgs& a) : VarArgArray<IntVar>(a) {}
00645     IntVarArgs(const VarArray<IntVar>& a) : VarArgArray<IntVar>(a) {}
00647     IntVarArgs(const std::vector<IntVar>& a) : VarArgArray<IntVar>(a) {}
00649     template<class InputIterator>
00650     IntVarArgs(InputIterator first, InputIterator last)
00651     : VarArgArray<IntVar>(first,last) {}
00663     GECODE_INT_EXPORT
00664     IntVarArgs(Space& home, int n, int min, int max);
00676     GECODE_INT_EXPORT
00677     IntVarArgs(Space& home, int n, const IntSet& s);
00679   };
00688   class BoolVarArgs : public VarArgArray<BoolVar> {
00689   public:
00691 
00692 
00693     BoolVarArgs(void) {}
00695     explicit BoolVarArgs(int n) : VarArgArray<BoolVar>(n) {}
00697     BoolVarArgs(const BoolVarArgs& a) : VarArgArray<BoolVar>(a) {}
00699     BoolVarArgs(const VarArray<BoolVar>& a)
00700      : VarArgArray<BoolVar>(a) {}
00702     BoolVarArgs(const std::vector<BoolVar>& a) : VarArgArray<BoolVar>(a) {}
00704     template<class InputIterator>
00705     BoolVarArgs(InputIterator first, InputIterator last)
00706     : VarArgArray<BoolVar>(first,last) {}
00718     GECODE_INT_EXPORT
00719     BoolVarArgs(Space& home, int n, int min, int max);
00721   };
00723 
00739   class IntVarArray : public VarArray<IntVar> {
00740   public:
00742 
00743 
00744     IntVarArray(void);
00746     IntVarArray(Space& home, int n);
00748     IntVarArray(const IntVarArray& a);
00750     IntVarArray(Space& home, const IntVarArgs& a);
00762     GECODE_INT_EXPORT
00763     IntVarArray(Space& home, int n, int min, int max);
00775     GECODE_INT_EXPORT
00776     IntVarArray(Space& home, int n, const IntSet& s);
00778   };
00779 
00784   class BoolVarArray : public VarArray<BoolVar> {
00785   public:
00787 
00788 
00789     BoolVarArray(void);
00791     BoolVarArray(Space& home, int n);
00793     BoolVarArray(const BoolVarArray& a);
00795     BoolVarArray(Space& home, const BoolVarArgs& a);
00807     GECODE_INT_EXPORT
00808     BoolVarArray(Space& home, int n, int min, int max);
00810   };
00811 
00812 }
00813 
00814 #include <gecode/int/int-set-2.hpp>
00815 
00816 #include <gecode/int/array.hpp>
00817 
00818 namespace Gecode {
00819 
00824   enum ReifyMode {
00831     RM_EQV,
00838     RM_IMP,
00845     RM_PMI
00846   };
00847 
00852   class Reify {
00853   protected:
00855     BoolVar x;
00857     ReifyMode rm;
00858   public:
00860     Reify(void);
00862     Reify(BoolVar x, ReifyMode rm=RM_EQV);
00864     BoolVar var(void) const;
00866     ReifyMode mode(void) const;
00868     void var(BoolVar x);
00870     void mode(ReifyMode rm);
00871   };
00872 
00877   Reify eqv(BoolVar x);
00878   
00883   Reify imp(BoolVar x);
00884   
00889   Reify pmi(BoolVar x);
00890 
00891 }
00892   
00893 #include <gecode/int/reify.hpp>
00894 
00895 namespace Gecode {
00896 
00901   enum IntRelType {
00902     IRT_EQ, 
00903     IRT_NQ, 
00904     IRT_LQ, 
00905     IRT_LE, 
00906     IRT_GQ, 
00907     IRT_GR  
00908   };
00909 
00914   enum BoolOpType {
00915     BOT_AND, 
00916     BOT_OR,  
00917     BOT_IMP, 
00918     BOT_EQV, 
00919     BOT_XOR  
00920   };
00921 
00935   enum IntConLevel {
00936     ICL_VAL, 
00937     ICL_BND, 
00938     ICL_DOM, 
00939     ICL_DEF  
00940   };
00941 
00947   enum TaskType {
00948     TT_FIXP, //< Task with fixed processing time
00949     TT_FIXS, //< Task with fixed start time
00950     TT_FIXE  //< Task with fixed end time
00951   };
00952 
00958   typedef PrimArgArray<TaskType> TaskTypeArgs;
00959 
00961   template<>
00962   class ArrayTraits<PrimArgArray<TaskType> > {
00963   public:
00964     typedef TaskTypeArgs StorageType;
00965     typedef TaskType     ValueType;
00966     typedef TaskTypeArgs ArgsType;
00967   };
00968 
00969 
00977 
00978   GECODE_INT_EXPORT void
00979   dom(Home home, IntVar x, int n,
00980       IntConLevel icl=ICL_DEF);
00982   GECODE_INT_EXPORT void
00983   dom(Home home, const IntVarArgs& x, int n,
00984       IntConLevel icl=ICL_DEF);
00985 
00987   GECODE_INT_EXPORT void
00988   dom(Home home, IntVar x, int l, int m,
00989       IntConLevel icl=ICL_DEF);
00991   GECODE_INT_EXPORT void
00992   dom(Home home, const IntVarArgs& x, int l, int m,
00993       IntConLevel icl=ICL_DEF);
00994 
00996   GECODE_INT_EXPORT void
00997   dom(Home home, IntVar x, const IntSet& s,
00998       IntConLevel icl=ICL_DEF);
01000   GECODE_INT_EXPORT void
01001   dom(Home home, const IntVarArgs& x, const IntSet& s,
01002       IntConLevel icl=ICL_DEF);
01003 
01005   GECODE_INT_EXPORT void
01006   dom(Home home, IntVar x, int n, Reify r,
01007       IntConLevel icl=ICL_DEF);
01009   GECODE_INT_EXPORT void
01010   dom(Home home, IntVar x, int l, int m, Reify r,
01011       IntConLevel icl=ICL_DEF);
01013   GECODE_INT_EXPORT void
01014   dom(Home home, IntVar x, const IntSet& s, Reify r,
01015       IntConLevel icl=ICL_DEF);
01016 
01018   GECODE_INT_EXPORT void
01019   dom(Home home, IntVar x, IntVar d,
01020       IntConLevel icl=ICL_DEF);
01022   GECODE_INT_EXPORT void
01023   dom(Home home, BoolVar x, BoolVar d,
01024       IntConLevel icl=ICL_DEF);
01026   GECODE_INT_EXPORT void
01027   dom(Home home, const IntVarArgs& x, const IntVarArgs& d,
01028       IntConLevel icl=ICL_DEF);
01030   GECODE_INT_EXPORT void
01031   dom(Home home, const BoolVarArgs& x, const BoolVarArgs& d,
01032       IntConLevel icl=ICL_DEF);
01034 
01035 
01046   GECODE_INT_EXPORT void
01047   rel(Home home, IntVar x0, IntRelType irt, IntVar x1,
01048       IntConLevel icl=ICL_DEF);
01055   GECODE_INT_EXPORT void
01056   rel(Home home, const IntVarArgs& x, IntRelType irt, IntVar y,
01057       IntConLevel icl=ICL_DEF);
01061   GECODE_INT_EXPORT void
01062   rel(Home home, IntVar x, IntRelType irt, int c,
01063       IntConLevel icl=ICL_DEF);
01067   GECODE_INT_EXPORT void
01068   rel(Home home, const IntVarArgs& x, IntRelType irt, int c,
01069       IntConLevel icl=ICL_DEF);
01076   GECODE_INT_EXPORT void
01077   rel(Home home, IntVar x0, IntRelType irt, IntVar x1, Reify r,
01078       IntConLevel icl=ICL_DEF);
01085   GECODE_INT_EXPORT void
01086   rel(Home home, IntVar x, IntRelType irt, int c, Reify r,
01087       IntConLevel icl=ICL_DEF);
01102   GECODE_INT_EXPORT void
01103   rel(Home home, const IntVarArgs& x, IntRelType irt,
01104       IntConLevel icl=ICL_DEF);
01119   GECODE_INT_EXPORT void
01120   rel(Home home, const IntVarArgs& x, IntRelType irt, const IntVarArgs& y,
01121       IntConLevel icl=ICL_DEF);
01122 
01130   GECODE_INT_EXPORT void
01131   rel(Home home, BoolVar x0, IntRelType irt, BoolVar x1,
01132       IntConLevel icl=ICL_DEF);
01136   GECODE_INT_EXPORT void
01137   rel(Home home, BoolVar x0, IntRelType irt, BoolVar x1, Reify r,
01138       IntConLevel icl=ICL_DEF);
01142   GECODE_INT_EXPORT void
01143   rel(Home home, const BoolVarArgs& x, IntRelType irt, BoolVar y,
01144       IntConLevel icl=ICL_DEF);
01152   GECODE_INT_EXPORT void
01153   rel(Home home, BoolVar x, IntRelType irt, int n,
01154       IntConLevel icl=ICL_DEF);
01162   GECODE_INT_EXPORT void
01163   rel(Home home, BoolVar x, IntRelType irt, int n, Reify r,
01164       IntConLevel icl=ICL_DEF);
01172   GECODE_INT_EXPORT void
01173   rel(Home home, const BoolVarArgs& x, IntRelType irt, int n,
01174       IntConLevel icl=ICL_DEF);
01184   GECODE_INT_EXPORT void
01185   rel(Home home, const BoolVarArgs& x, IntRelType irt, const BoolVarArgs& y,
01186       IntConLevel icl=ICL_DEF);
01197   GECODE_INT_EXPORT void
01198   rel(Home home, const BoolVarArgs& x, IntRelType irt,
01199       IntConLevel icl=ICL_DEF);
01205   GECODE_INT_EXPORT void
01206   rel(Home home, BoolVar x0, BoolOpType o, BoolVar x1, BoolVar x2,
01207       IntConLevel icl=ICL_DEF);
01216   GECODE_INT_EXPORT void
01217   rel(Home home, BoolVar x0, BoolOpType o, BoolVar x1, int n,
01218       IntConLevel icl=ICL_DEF);
01228   GECODE_INT_EXPORT void
01229   rel(Home home, BoolOpType o, const BoolVarArgs& x, BoolVar y,
01230       IntConLevel icl=ICL_DEF);
01243   GECODE_INT_EXPORT void
01244   rel(Home home, BoolOpType o, const BoolVarArgs& x, int n,
01245       IntConLevel icl=ICL_DEF);
01256   GECODE_INT_EXPORT void
01257   clause(Home home, BoolOpType o, const BoolVarArgs& x, const BoolVarArgs& y,
01258          BoolVar z, IntConLevel icl=ICL_DEF);
01272   GECODE_INT_EXPORT void
01273   clause(Home home, BoolOpType o, const BoolVarArgs& x, const BoolVarArgs& y,
01274          int n, IntConLevel icl=ICL_DEF);
01281   GECODE_INT_EXPORT void
01282   ite(Home home, BoolVar b, IntVar x, IntVar y, IntVar z,
01283       IntConLevel icl=ICL_DEF);
01284 
01285 
01297   GECODE_INT_EXPORT void
01298   precede(Home home, const IntVarArgs& x, int s, int t,
01299           IntConLevel=ICL_DEF);
01307   GECODE_INT_EXPORT void
01308   precede(Home home, const IntVarArgs& x, const IntArgs& c,
01309           IntConLevel=ICL_DEF);
01310 
01311 
01317 
01318   GECODE_INT_EXPORT void
01319   member(Home home, const IntVarArgs& x, IntVar y,
01320          IntConLevel icl=ICL_DEF);
01322   GECODE_INT_EXPORT void
01323   member(Home home, const BoolVarArgs& x, BoolVar y,
01324          IntConLevel icl=ICL_DEF);
01326   GECODE_INT_EXPORT void
01327   member(Home home, const IntVarArgs& x, IntVar y, Reify r,
01328          IntConLevel icl=ICL_DEF);
01330   GECODE_INT_EXPORT void
01331   member(Home home, const BoolVarArgs& x, BoolVar y, Reify r,
01332          IntConLevel icl=ICL_DEF);
01334 
01335 
01342 
01343   typedef SharedArray<int> IntSharedArray;
01349   GECODE_INT_EXPORT void
01350   element(Home home, IntSharedArray n, IntVar x0, IntVar x1,
01351           IntConLevel icl=ICL_DEF);
01357   GECODE_INT_EXPORT void
01358   element(Home home, IntSharedArray n, IntVar x0, BoolVar x1,
01359           IntConLevel icl=ICL_DEF);
01365   GECODE_INT_EXPORT void
01366   element(Home home, IntSharedArray n, IntVar x0, int x1,
01367           IntConLevel icl=ICL_DEF);
01373   GECODE_INT_EXPORT void
01374   element(Home home, const IntVarArgs& x, IntVar y0, IntVar y1,
01375           IntConLevel icl=ICL_DEF);
01381   GECODE_INT_EXPORT void
01382   element(Home home, const IntVarArgs& x, IntVar y0, int y1,
01383           IntConLevel icl=ICL_DEF);
01385   GECODE_INT_EXPORT void
01386   element(Home home, const BoolVarArgs& x, IntVar y0, BoolVar y1,
01387           IntConLevel icl=ICL_DEF);
01389   GECODE_INT_EXPORT void
01390   element(Home home, const BoolVarArgs& x, IntVar y0, int y1,
01391           IntConLevel icl=ICL_DEF);
01392 
01405   GECODE_INT_EXPORT void
01406   element(Home home, IntSharedArray a, 
01407           IntVar x, int w, IntVar y, int h, IntVar z,
01408           IntConLevel icl=ICL_DEF);
01421   GECODE_INT_EXPORT void
01422   element(Home home, IntSharedArray a, 
01423           IntVar x, int w, IntVar y, int h, BoolVar z,
01424           IntConLevel icl=ICL_DEF);
01440   GECODE_INT_EXPORT void
01441   element(Home home, const IntVarArgs& a, 
01442           IntVar x, int w, IntVar y, int h, IntVar z,
01443           IntConLevel icl=ICL_DEF);
01456   GECODE_INT_EXPORT void
01457   element(Home home, const BoolVarArgs& a, 
01458           IntVar x, int w, IntVar y, int h, BoolVar z,
01459           IntConLevel icl=ICL_DEF);
01461 
01462 
01477   GECODE_INT_EXPORT void
01478   distinct(Home home, const IntVarArgs& x,
01479            IntConLevel icl=ICL_DEF);
01492   GECODE_INT_EXPORT void
01493   distinct(Home home, const IntArgs& n, const IntVarArgs& x,
01494            IntConLevel icl=ICL_DEF);
01496 
01497 
01515   GECODE_INT_EXPORT void
01516   channel(Home home, const IntVarArgs& x, const IntVarArgs& y,
01517           IntConLevel icl=ICL_DEF);
01518 
01532   GECODE_INT_EXPORT void
01533   channel(Home home, const IntVarArgs& x, int xoff,
01534           const IntVarArgs& y, int yoff,
01535           IntConLevel icl=ICL_DEF);
01536 
01538   GECODE_INT_EXPORT void
01539   channel(Home home, BoolVar x0, IntVar x1,
01540           IntConLevel icl=ICL_DEF);
01542   forceinline void
01543   channel(Home home, IntVar x0, BoolVar x1,
01544           IntConLevel icl=ICL_DEF) {
01545     channel(home,x1,x0,icl);
01546   }
01552   GECODE_INT_EXPORT void
01553   channel(Home home, const BoolVarArgs& x, IntVar y, int o=0,
01554           IntConLevel icl=ICL_DEF);
01556 
01557 
01574   GECODE_INT_EXPORT void
01575   sorted(Home home, const IntVarArgs& x, const IntVarArgs& y,
01576          IntConLevel icl=ICL_DEF);
01577 
01589   GECODE_INT_EXPORT void
01590   sorted(Home home, const IntVarArgs& x, const IntVarArgs& y,
01591          const IntVarArgs& z,
01592          IntConLevel icl=ICL_DEF);
01594 
01595 
01614   GECODE_INT_EXPORT void
01615   count(Home home, const IntVarArgs& x, int n, IntRelType irt, int m,
01616         IntConLevel icl=ICL_DEF);
01621   GECODE_INT_EXPORT void
01622   count(Home home, const IntVarArgs& x, const IntSet& y, IntRelType irt, int m,
01623         IntConLevel icl=ICL_DEF);
01631   GECODE_INT_EXPORT void
01632   count(Home home, const IntVarArgs& x, IntVar y, IntRelType irt, int m,
01633         IntConLevel icl=ICL_DEF);
01641   GECODE_INT_EXPORT void
01642   count(Home home, const IntVarArgs& x, const IntArgs& y, IntRelType irt, int m,
01643         IntConLevel icl=ICL_DEF);
01648   GECODE_INT_EXPORT void
01649   count(Home home, const IntVarArgs& x, int n, IntRelType irt, IntVar z,
01650         IntConLevel icl=ICL_DEF);
01655   GECODE_INT_EXPORT void
01656   count(Home home, const IntVarArgs& x, const IntSet& y, IntRelType irt, IntVar z,
01657         IntConLevel icl=ICL_DEF);
01665   GECODE_INT_EXPORT void
01666   count(Home home, const IntVarArgs& x, IntVar y, IntRelType irt, IntVar z,
01667         IntConLevel icl=ICL_DEF);
01675   GECODE_INT_EXPORT void
01676   count(Home home, const IntVarArgs& x, const IntArgs& y, IntRelType irt, IntVar z,
01677         IntConLevel icl=ICL_DEF);
01678 
01692   GECODE_INT_EXPORT void
01693   count(Home home, const IntVarArgs& x, const IntVarArgs& c,
01694         IntConLevel icl=ICL_DEF);
01695 
01709   GECODE_INT_EXPORT void
01710   count(Home home, const IntVarArgs& x, const IntSetArgs& c,
01711         IntConLevel icl=ICL_DEF);
01712 
01729   GECODE_INT_EXPORT void
01730   count(Home home, const IntVarArgs& x,
01731         const IntVarArgs& c, const IntArgs& v,
01732         IntConLevel icl=ICL_DEF);
01733 
01750   GECODE_INT_EXPORT void
01751   count(Home home, const IntVarArgs& x,
01752         const IntSetArgs& c, const IntArgs& v,
01753         IntConLevel icl=ICL_DEF);
01754 
01771   GECODE_INT_EXPORT void
01772   count(Home home, const IntVarArgs& x,
01773         const IntSet& c, const IntArgs& v,
01774         IntConLevel icl=ICL_DEF);
01775 
01777 
01792   GECODE_INT_EXPORT void
01793   nvalues(Home home, const IntVarArgs& x, IntRelType irt, int y,
01794           IntConLevel icl=ICL_DEF);
01798   GECODE_INT_EXPORT void
01799   nvalues(Home home, const IntVarArgs& x, IntRelType irt, IntVar y,
01800           IntConLevel icl=ICL_DEF);
01804   GECODE_INT_EXPORT void
01805   nvalues(Home home, const BoolVarArgs& x, IntRelType irt, int y,
01806           IntConLevel icl=ICL_DEF);
01810   GECODE_INT_EXPORT void
01811   nvalues(Home home, const BoolVarArgs& x, IntRelType irt, IntVar y,
01812           IntConLevel icl=ICL_DEF);
01814 
01835   GECODE_INT_EXPORT void
01836   sequence(Home home, const IntVarArgs& x, const IntSet& s, 
01837            int q, int l, int u, IntConLevel icl=ICL_DEF); 
01838   
01853   GECODE_INT_EXPORT void
01854   sequence(Home home, const BoolVarArgs& x, const IntSet& s, 
01855            int q, int l, int u, IntConLevel icl=ICL_DEF); 
01856 
01858 
01871 
01879   class DFA : public SharedHandle {
01880   private:
01882     class DFAI;
01883   public:
01885     class Transition {
01886     public:
01887       int i_state; 
01888       int symbol;  
01889       int o_state; 
01890 
01891       Transition();
01893       Transition(int i_state0, int symbol0, int o_state0);
01894     };
01896     class Transitions {
01897     private:
01899       const Transition* c_trans;
01901       const Transition* e_trans;
01902     public:
01904       Transitions(const DFA& d);
01906       Transitions(const DFA& d, int n);
01908       bool operator ()(void) const;
01910       void operator ++(void);
01912       int i_state(void) const;
01914       int symbol(void) const;
01916       int o_state(void) const;
01917     };
01919     class Symbols {
01920     private:
01922       const Transition* c_trans;
01924       const Transition* e_trans;
01925     public:
01927       Symbols(const DFA& d);
01929       bool operator ()(void) const;
01931       void operator ++(void);
01933       int val(void) const;
01934     };
01935   public:
01936     friend class Transitions;
01938     DFA(void);
01950     GECODE_INT_EXPORT
01951     DFA(int s, Transition t[], int f[], bool minimize=true);
01953     DFA(const DFA& d);
01955     int n_states(void) const;
01957     int n_transitions(void) const;
01959     unsigned int n_symbols(void) const;
01961     unsigned int max_degree(void) const;
01963     int final_fst(void) const;
01965     int final_lst(void) const;
01967     int symbol_min(void) const;
01969     int symbol_max(void) const;
01970   };
01971 
01972 
01980   enum ExtensionalPropKind {
01981     EPK_DEF,    
01982     EPK_SPEED,  
01983     EPK_MEMORY  
01984   };
01985 
01996   GECODE_INT_EXPORT void
01997   extensional(Home home, const IntVarArgs& x, DFA d,
01998               IntConLevel icl=ICL_DEF);
01999 
02010   GECODE_INT_EXPORT void
02011   extensional(Home home, const BoolVarArgs& x, DFA d,
02012               IntConLevel icl=ICL_DEF);
02013 
02020   class TupleSet : public SharedHandle {
02021   public:
02026     typedef int* Tuple;
02027 
02032     class GECODE_VTABLE_EXPORT TupleSetI
02033       : public SharedHandle::Object {
02034     public:
02036       int arity;
02038       int size;
02040       Tuple** tuples;
02042       Tuple* tuple_data;
02044       int* data;
02046       int excess;
02048       int min, max;
02050       unsigned int domsize;
02052       Tuple** last;
02054       Tuple* nullpointer;
02055 
02057       template<class T>
02058       void add(T t);
02060       GECODE_INT_EXPORT void finalize(void);
02062       GECODE_INT_EXPORT void resize(void);
02064       bool finalized(void) const;
02066       TupleSetI(void);
02068       GECODE_INT_EXPORT virtual ~TupleSetI(void);
02070       GECODE_INT_EXPORT virtual SharedHandle::Object* copy(void) const;
02071     };
02072     
02074     TupleSetI* implementation(void);
02075 
02077     TupleSet(void);
02079     TupleSet(const TupleSet& d);
02080 
02082     void add(const IntArgs& tuple);
02084     void finalize(void);
02086     bool finalized(void) const;
02088     int arity(void) const;
02090     int tuples(void) const;
02092     Tuple operator [](int i) const;
02094     int min(void) const;
02096     int max(void) const;
02097   };
02098 
02117   GECODE_INT_EXPORT void
02118   extensional(Home home, const IntVarArgs& x, const TupleSet& t,
02119               ExtensionalPropKind epk=EPK_DEF, IntConLevel icl=ICL_DEF);
02120 
02131   GECODE_INT_EXPORT void
02132   extensional(Home home, const BoolVarArgs& x, const TupleSet& t,
02133               ExtensionalPropKind epk=EPK_DEF, IntConLevel icl=ICL_DEF);
02135 
02136 }
02137 
02138 #include <gecode/int/extensional/dfa.hpp>
02139 #include <gecode/int/extensional/tuple-set.hpp>
02140 
02141 namespace Gecode {
02142 
02154   GECODE_INT_EXPORT void
02155   min(Home home, IntVar x0, IntVar x1, IntVar x2,
02156       IntConLevel icl=ICL_DEF);
02164   GECODE_INT_EXPORT void
02165   min(Home home, const IntVarArgs& x, IntVar y,
02166       IntConLevel icl=ICL_DEF);
02172   GECODE_INT_EXPORT void
02173   max(Home home, IntVar x0, IntVar x1, IntVar x2,
02174       IntConLevel icl=ICL_DEF);
02182   GECODE_INT_EXPORT void
02183   max(Home home, const IntVarArgs& x, IntVar y,
02184       IntConLevel icl=ICL_DEF);
02185 
02191   GECODE_INT_EXPORT void
02192   abs(Home home, IntVar x0, IntVar x1,
02193       IntConLevel icl=ICL_DEF);
02194 
02200   GECODE_INT_EXPORT void
02201   mult(Home home, IntVar x0, IntVar x1, IntVar x2,
02202        IntConLevel icl=ICL_DEF);
02203 
02208   GECODE_INT_EXPORT void
02209   divmod(Home home, IntVar x0, IntVar x1, IntVar x2, IntVar x3,
02210          IntConLevel icl=ICL_DEF);
02211 
02216   GECODE_INT_EXPORT void
02217   div(Home home, IntVar x0, IntVar x1, IntVar x2,
02218       IntConLevel icl=ICL_DEF);
02219 
02224   GECODE_INT_EXPORT void
02225   mod(Home home, IntVar x0, IntVar x1, IntVar x2,
02226       IntConLevel icl=ICL_DEF);
02227 
02233   GECODE_INT_EXPORT void
02234   sqr(Home home, IntVar x0, IntVar x1,
02235       IntConLevel icl=ICL_DEF);
02236 
02242   GECODE_INT_EXPORT void
02243   sqrt(Home home, IntVar x0, IntVar x1,
02244        IntConLevel icl=ICL_DEF);
02245 
02254   GECODE_INT_EXPORT void
02255   pow(Home home, IntVar x0, int n, IntVar x1,
02256       IntConLevel icl=ICL_DEF);
02257 
02266   GECODE_INT_EXPORT void
02267   nroot(Home home, IntVar x0, int n, IntVar x1,
02268        IntConLevel icl=ICL_DEF);
02269 
02271 
02303   GECODE_INT_EXPORT void
02304   linear(Home home, const IntVarArgs& x,
02305          IntRelType irt, int c,
02306          IntConLevel icl=ICL_DEF);
02310   GECODE_INT_EXPORT void
02311   linear(Home home, const IntVarArgs& x,
02312          IntRelType irt, IntVar y,
02313          IntConLevel icl=ICL_DEF);
02317   GECODE_INT_EXPORT void
02318   linear(Home home, const IntVarArgs& x,
02319          IntRelType irt, int c, Reify r,
02320          IntConLevel icl=ICL_DEF);
02324   GECODE_INT_EXPORT void
02325   linear(Home home, const IntVarArgs& x,
02326          IntRelType irt, IntVar y, Reify r,
02327          IntConLevel icl=ICL_DEF);
02334   GECODE_INT_EXPORT void
02335   linear(Home home, const IntArgs& a, const IntVarArgs& x,
02336          IntRelType irt, int c,
02337          IntConLevel icl=ICL_DEF);
02344   GECODE_INT_EXPORT void
02345   linear(Home home, const IntArgs& a, const IntVarArgs& x,
02346          IntRelType irt, IntVar y,
02347          IntConLevel icl=ICL_DEF);
02354   GECODE_INT_EXPORT void
02355   linear(Home home, const IntArgs& a, const IntVarArgs& x,
02356          IntRelType irt, int c, Reify r,
02357          IntConLevel icl=ICL_DEF);
02364   GECODE_INT_EXPORT void
02365   linear(Home home, const IntArgs& a, const IntVarArgs& x,
02366          IntRelType irt, IntVar y, Reify r,
02367          IntConLevel icl=ICL_DEF);
02368 
02369 
02397   GECODE_INT_EXPORT void
02398   linear(Home home, const BoolVarArgs& x,
02399          IntRelType irt, int c,
02400          IntConLevel icl=ICL_DEF);
02404   GECODE_INT_EXPORT void
02405   linear(Home home, const BoolVarArgs& x,
02406          IntRelType irt, int c, Reify r,
02407          IntConLevel icl=ICL_DEF);
02411   GECODE_INT_EXPORT void
02412   linear(Home home, const BoolVarArgs& x,
02413          IntRelType irt, IntVar y,
02414          IntConLevel icl=ICL_DEF);
02418   GECODE_INT_EXPORT void
02419   linear(Home home, const BoolVarArgs& x,
02420          IntRelType irt, IntVar y, Reify r,
02421          IntConLevel icl=ICL_DEF);
02428   GECODE_INT_EXPORT void
02429   linear(Home home, const IntArgs& a, const BoolVarArgs& x,
02430          IntRelType irt, int c,
02431          IntConLevel icl=ICL_DEF);
02438   GECODE_INT_EXPORT void
02439   linear(Home home, const IntArgs& a, const BoolVarArgs& x,
02440          IntRelType irt, int c, Reify r,
02441          IntConLevel icl=ICL_DEF);
02448   GECODE_INT_EXPORT void
02449   linear(Home home, const IntArgs& a, const BoolVarArgs& x,
02450          IntRelType irt, IntVar y,
02451          IntConLevel icl=ICL_DEF);
02458   GECODE_INT_EXPORT void
02459   linear(Home home, const IntArgs& a, const BoolVarArgs& x,
02460          IntRelType irt, IntVar y, Reify r,
02461          IntConLevel icl=ICL_DEF);
02462 
02463 
02490   GECODE_INT_EXPORT void
02491   binpacking(Home home, 
02492              const IntVarArgs& l, 
02493              const IntVarArgs& b, const IntArgs& s,
02494              IntConLevel icl=ICL_DEF);
02513   GECODE_INT_EXPORT void
02514   nooverlap(Home home, 
02515             const IntVarArgs& x, const IntArgs& w,
02516             const IntVarArgs& y, const IntArgs& h,
02517             IntConLevel icl=ICL_DEF);
02531   GECODE_INT_EXPORT void
02532   nooverlap(Home home, 
02533             const IntVarArgs& x, const IntArgs& w,
02534             const IntVarArgs& y, const IntArgs& h,
02535             const BoolVarArgs& o,
02536             IntConLevel icl=ICL_DEF);
02553   GECODE_INT_EXPORT void
02554   nooverlap(Home home, 
02555             const IntVarArgs& x0, const IntVarArgs& w, const IntVarArgs& x1,
02556             const IntVarArgs& y0, const IntVarArgs& h, const IntVarArgs& y1,
02557             IntConLevel icl=ICL_DEF);
02575   GECODE_INT_EXPORT void
02576   nooverlap(Home home, 
02577             const IntVarArgs& x0, const IntVarArgs& w, const IntVarArgs& x1,
02578             const IntVarArgs& y0, const IntVarArgs& h, const IntVarArgs& y1,
02579             const BoolVarArgs& o,
02580             IntConLevel icl=ICL_DEF);
02581 
02582 
02588 
02631   GECODE_INT_EXPORT void
02632   cumulatives(Home home, const IntVarArgs& m,
02633               const IntVarArgs& s, const IntVarArgs& p,
02634               const IntVarArgs& e, const IntVarArgs& u,
02635               const IntArgs& c, bool at_most,
02636               IntConLevel icl=ICL_DEF);
02641   GECODE_INT_EXPORT void
02642   cumulatives(Home home, const IntArgs& m,
02643               const IntVarArgs& s, const IntVarArgs& p,
02644               const IntVarArgs& e, const IntVarArgs& u,
02645               const IntArgs& c, bool at_most,
02646               IntConLevel icl=ICL_DEF);
02651   GECODE_INT_EXPORT void
02652   cumulatives(Home home, const IntVarArgs& m,
02653               const IntVarArgs& s, const IntArgs& p,
02654               const IntVarArgs& e, const IntVarArgs& u,
02655               const IntArgs& c, bool at_most,
02656               IntConLevel icl=ICL_DEF);
02661   GECODE_INT_EXPORT void
02662   cumulatives(Home home, const IntArgs& m,
02663               const IntVarArgs& s, const IntArgs& p,
02664               const IntVarArgs& e, const IntVarArgs& u,
02665               const IntArgs& c, bool at_most,
02666               IntConLevel icl=ICL_DEF);
02671   GECODE_INT_EXPORT void
02672   cumulatives(Home home, const IntVarArgs& m,
02673               const IntVarArgs& s, const IntVarArgs& p,
02674               const IntVarArgs& e, const IntArgs& u,
02675               const IntArgs& c, bool at_most,
02676               IntConLevel icl=ICL_DEF);
02681   GECODE_INT_EXPORT void
02682   cumulatives(Home home, const IntArgs& m,
02683               const IntVarArgs& s, const IntVarArgs& p,
02684               const IntVarArgs& e, const IntArgs& u,
02685               const IntArgs& c, bool at_most,
02686               IntConLevel icl=ICL_DEF);
02691   GECODE_INT_EXPORT void
02692   cumulatives(Home home, const IntVarArgs& m,
02693               const IntVarArgs& s, const IntArgs& p,
02694               const IntVarArgs& e, const IntArgs& u,
02695               const IntArgs& c, bool at_most,
02696               IntConLevel icl=ICL_DEF);
02701   GECODE_INT_EXPORT void
02702   cumulatives(Home home, const IntArgs& m,
02703               const IntVarArgs& s, const IntArgs& p,
02704               const IntVarArgs& e, const IntArgs& u,
02705               const IntArgs& c, bool at_most,
02706               IntConLevel icl=ICL_DEF);
02707 
02726   GECODE_INT_EXPORT void
02727   unary(Home home, const IntVarArgs& s, const IntArgs& p,
02728         IntConLevel icl=ICL_DEF);
02729 
02750   GECODE_INT_EXPORT void
02751   unary(Home home, const IntVarArgs& s, const IntArgs& p, 
02752         const BoolVarArgs& m, IntConLevel icl=ICL_DEF);
02753 
02782   GECODE_INT_EXPORT void
02783   unary(Home home, const TaskTypeArgs& t,
02784         const IntVarArgs& flex, const IntArgs& fix, IntConLevel icl=ICL_DEF);
02785 
02816   GECODE_INT_EXPORT void
02817   unary(Home home, const TaskTypeArgs& t,
02818         const IntVarArgs& flex, const IntArgs& fix,
02819         const BoolVarArgs& m, IntConLevel icl=ICL_DEF);
02820 
02840   GECODE_INT_EXPORT void
02841   unary(Home home, const IntVarArgs& s, const IntVarArgs& p, 
02842         const IntVarArgs& e, IntConLevel icl=ICL_DEF);
02843 
02865   GECODE_INT_EXPORT void
02866   unary(Home home, const IntVarArgs& s, const IntVarArgs& p,
02867         const IntVarArgs& e, const BoolVarArgs& m, IntConLevel icl=ICL_DEF);
02868 
02903   GECODE_INT_EXPORT void
02904   cumulative(Home home, int c, const TaskTypeArgs& t,
02905              const IntVarArgs& flex, const IntArgs& fix, const IntArgs& u,
02906              IntConLevel icl=ICL_DEF);
02907 
02908   
02913   GECODE_INT_EXPORT void
02914   cumulative(Home home, IntVar c, const TaskTypeArgs& t,
02915              const IntVarArgs& flex, const IntArgs& fix, const IntArgs& u,
02916              IntConLevel icl=ICL_DEF);
02917 
02954   GECODE_INT_EXPORT void
02955   cumulative(Home home, int c, const TaskTypeArgs& t,
02956              const IntVarArgs& flex, const IntArgs& fix, const IntArgs& u,
02957              const BoolVarArgs& m, IntConLevel icl=ICL_DEF);
02958 
02962   GECODE_INT_EXPORT void
02963   cumulative(Home home, IntVar c, const TaskTypeArgs& t,
02964              const IntVarArgs& flex, const IntArgs& fix, const IntArgs& u,
02965              const BoolVarArgs& m, IntConLevel icl=ICL_DEF);
02966 
02991   GECODE_INT_EXPORT void
02992   cumulative(Home home, int c, const IntVarArgs& s, const IntArgs& p,
02993              const IntArgs& u, IntConLevel icl=ICL_DEF);
02994 
02998   GECODE_INT_EXPORT void
02999   cumulative(Home home, IntVar c, const IntVarArgs& s, const IntArgs& p,
03000              const IntArgs& u, IntConLevel icl=ICL_DEF);
03001 
03028   GECODE_INT_EXPORT void
03029   cumulative(Home home, int c, const IntVarArgs& s, const IntArgs& p, 
03030              const IntArgs& u, const BoolVarArgs& m, IntConLevel icl=ICL_DEF);
03031 
03035   GECODE_INT_EXPORT void
03036   cumulative(Home home, IntVar c, const IntVarArgs& s, const IntArgs& p, 
03037              const IntArgs& u, const BoolVarArgs& m, IntConLevel icl=ICL_DEF);
03038 
03067   GECODE_INT_EXPORT void
03068   cumulative(Home home, int c, const IntVarArgs& s, const IntVarArgs& p,
03069              const IntVarArgs& e, const IntArgs& u, IntConLevel icl=ICL_DEF);
03070 
03074   GECODE_INT_EXPORT void
03075   cumulative(Home home, IntVar c, const IntVarArgs& s, const IntVarArgs& p,
03076              const IntVarArgs& e, const IntArgs& u, IntConLevel icl=ICL_DEF);
03077 
03108   GECODE_INT_EXPORT void
03109   cumulative(Home home, int c, const IntVarArgs& s, const IntVarArgs& p, 
03110              const IntVarArgs& e, const IntArgs& u, const BoolVarArgs& m, 
03111              IntConLevel icl=ICL_DEF);
03112 
03116   GECODE_INT_EXPORT void
03117   cumulative(Home home, IntVar c, const IntVarArgs& s, const IntVarArgs& p, 
03118              const IntVarArgs& e, const IntArgs& u, const BoolVarArgs& m, 
03119              IntConLevel icl=ICL_DEF);
03121 
03122 
03142   GECODE_INT_EXPORT void
03143   circuit(Home home, const IntVarArgs& x,
03144           IntConLevel icl=ICL_DEF);
03160   GECODE_INT_EXPORT void
03161   circuit(Home home, int offset, const IntVarArgs& x,
03162           IntConLevel icl=ICL_DEF);
03184   GECODE_INT_EXPORT void
03185   circuit(Home home, 
03186           const IntArgs& c,
03187           const IntVarArgs& x, const IntVarArgs& y, IntVar z,
03188           IntConLevel icl=ICL_DEF);
03211   GECODE_INT_EXPORT void
03212   circuit(Home home, 
03213           const IntArgs& c, int offset,
03214           const IntVarArgs& x, const IntVarArgs& y, IntVar z,
03215           IntConLevel icl=ICL_DEF);
03234   GECODE_INT_EXPORT void
03235   circuit(Home home, 
03236           const IntArgs& c,
03237           const IntVarArgs& x, IntVar z,
03238           IntConLevel icl=ICL_DEF);
03259   GECODE_INT_EXPORT void
03260   circuit(Home home, 
03261           const IntArgs& c, int offset,
03262           const IntVarArgs& x, IntVar z,
03263           IntConLevel icl=ICL_DEF);
03279   GECODE_INT_EXPORT void
03280   path(Home home, const IntVarArgs& x, IntVar s, IntVar e,
03281        IntConLevel icl=ICL_DEF);
03299   GECODE_INT_EXPORT void
03300   path(Home home, int offset, const IntVarArgs& x, IntVar s, IntVar e,
03301        IntConLevel icl=ICL_DEF);
03324   GECODE_INT_EXPORT void
03325   path(Home home, 
03326        const IntArgs& c,
03327        const IntVarArgs& x, IntVar s, IntVar e, const IntVarArgs& y, IntVar z,
03328        IntConLevel icl=ICL_DEF);
03353   GECODE_INT_EXPORT void
03354   path(Home home, 
03355        const IntArgs& c, int offset,
03356        const IntVarArgs& x, IntVar s, IntVar e, const IntVarArgs& y, IntVar z,
03357        IntConLevel icl=ICL_DEF);
03378   GECODE_INT_EXPORT void
03379   path(Home home, 
03380        const IntArgs& c,
03381        const IntVarArgs& x, IntVar s, IntVar e, IntVar z,
03382        IntConLevel icl=ICL_DEF);
03405   GECODE_INT_EXPORT void
03406   path(Home home, 
03407        const IntArgs& c, int offset,
03408        const IntVarArgs& x, IntVar s, IntVar e, IntVar z,
03409        IntConLevel icl=ICL_DEF);
03411 
03412 
03413 
03422 
03423   GECODE_INT_EXPORT void
03424   wait(Home home, IntVar x, void (*c)(Space& home),
03425        IntConLevel icl=ICL_DEF);
03427   GECODE_INT_EXPORT void
03428   wait(Home home, BoolVar x, void (*c)(Space& home),
03429        IntConLevel icl=ICL_DEF);
03431   GECODE_INT_EXPORT void
03432   wait(Home home, const IntVarArgs& x, void (*c)(Space& home),
03433        IntConLevel icl=ICL_DEF);
03435   GECODE_INT_EXPORT void
03436   wait(Home home, const BoolVarArgs& x, void (*c)(Space& home),
03437        IntConLevel icl=ICL_DEF);
03439   GECODE_INT_EXPORT void
03440   when(Home home, BoolVar x, 
03441        void (*t)(Space& home), void (*e)(Space& home)= NULL,
03442        IntConLevel icl=ICL_DEF);
03444 
03445 
03470   GECODE_INT_EXPORT void
03471   unshare(Home home, IntVarArgs& x,
03472           IntConLevel icl=ICL_DEF);
03474   GECODE_INT_EXPORT void
03475   unshare(Home home, BoolVarArgs& x,
03476           IntConLevel icl=ICL_DEF);
03478 
03479 }
03480 
03481 namespace Gecode {
03482 
03496   typedef bool (*IntBranchFilter)(const Space& home, IntVar x, int i);
03505   typedef bool (*BoolBranchFilter)(const Space& home, BoolVar x, int i);
03506 
03516   typedef double (*IntBranchMerit)(const Space& home, IntVar x, int i);
03526   typedef double (*BoolBranchMerit)(const Space& home, BoolVar x, int i);
03527 
03538   typedef int (*IntBranchVal)(const Space& home, IntVar x, int i);
03549   typedef int (*BoolBranchVal)(const Space& home, BoolVar x, int i);
03550 
03562   typedef void (*IntBranchCommit)(Space& home, unsigned int a,
03563                                   IntVar x, int i, int n);
03575   typedef void (*BoolBranchCommit)(Space& home, unsigned int a,
03576                                    BoolVar x, int i, int n);
03577 }
03578 
03579 #include <gecode/int/branch/traits.hpp>
03580 
03581 namespace Gecode {
03582 
03588   class IntAFC : public AFC {
03589   public:
03597     IntAFC(void);
03599     IntAFC(const IntAFC& a);
03601     IntAFC& operator =(const IntAFC& a);      
03603     IntAFC(Home home, const IntVarArgs& x, double d=1.0);
03605     IntAFC(Home home, const BoolVarArgs& x, double d=1.0);
03613     void init(Home, const IntVarArgs& x, double d=1.0);
03621     void init(Home, const BoolVarArgs& x, double d=1.0);
03622   };
03623 
03624 }
03625 
03626 #include <gecode/int/branch/afc.hpp>
03627 
03628 namespace Gecode {
03629 
03635   class IntActivity : public Activity {
03636   public:
03644     IntActivity(void);
03646     IntActivity(const IntActivity& a);
03648     IntActivity& operator =(const IntActivity& a);      
03656     GECODE_INT_EXPORT 
03657     IntActivity(Home home, const IntVarArgs& x, double d=1.0,
03658                 IntBranchMerit bm=NULL);
03666     GECODE_INT_EXPORT 
03667     IntActivity(Home home, const BoolVarArgs& x, double d=1.0,
03668                 BoolBranchMerit bm=NULL);
03680     GECODE_INT_EXPORT void
03681     init(Home home, const IntVarArgs& x, double d=1.0,
03682          IntBranchMerit bm=NULL);
03694     GECODE_INT_EXPORT void
03695     init(Home home, const BoolVarArgs& x, double d=1.0,
03696          BoolBranchMerit bm=NULL);
03697   };
03698 
03699 }
03700 
03701 #include <gecode/int/branch/activity.hpp>
03702 
03703 namespace Gecode {
03704 
03706   typedef void (*IntVarValPrint)(const Space &home, const BrancherHandle& bh,
03707                                  unsigned int a,
03708                                  IntVar x, int i, const int& n,
03709                                  std::ostream& o);
03710 
03712   typedef void (*BoolVarValPrint)(const Space &home, const BrancherHandle& bh,
03713                                   unsigned int a,
03714                                   BoolVar x, int i, const int& n,
03715                                   std::ostream& o);
03716 
03717 }
03718 
03719 namespace Gecode {
03720 
03726   class IntVarBranch : public VarBranch {
03727   public:
03729     enum Select {
03730       SEL_NONE = 0,        
03731       SEL_RND,             
03732       SEL_MERIT_MIN,       
03733       SEL_MERIT_MAX,       
03734       SEL_DEGREE_MIN,      
03735       SEL_DEGREE_MAX,      
03736       SEL_AFC_MIN,         
03737       SEL_AFC_MAX,         
03738       SEL_ACTIVITY_MIN,    
03739       SEL_ACTIVITY_MAX,    
03740       SEL_MIN_MIN,         
03741       SEL_MIN_MAX,         
03742       SEL_MAX_MIN,         
03743       SEL_MAX_MAX,         
03744       SEL_SIZE_MIN,        
03745       SEL_SIZE_MAX,        
03746       SEL_DEGREE_SIZE_MIN, 
03747       SEL_DEGREE_SIZE_MAX, 
03748       SEL_AFC_SIZE_MIN,    
03749       SEL_AFC_SIZE_MAX,    
03750       SEL_ACTIVITY_SIZE_MIN, 
03751       SEL_ACTIVITY_SIZE_MAX, 
03752 
03757       SEL_REGRET_MIN_MIN,
03763       SEL_REGRET_MIN_MAX,
03769       SEL_REGRET_MAX_MIN,
03775       SEL_REGRET_MAX_MAX
03776     };
03777   protected:
03779     Select s;
03780   public:
03782     IntVarBranch(void);
03784     IntVarBranch(Rnd r);
03786     IntVarBranch(Select s, BranchTbl t);
03788     IntVarBranch(Select s, double d, BranchTbl t);
03790     IntVarBranch(Select s, AFC a, BranchTbl t);
03792     IntVarBranch(Select s, Activity a, BranchTbl t);
03794     IntVarBranch(Select s, VoidFunction mf, BranchTbl t);
03796     Select select(void) const;
03798     void expand(Home home, const IntVarArgs& x);
03800     void expand(Home home, const BoolVarArgs& x);
03801   };
03802 
03808 
03809   IntVarBranch INT_VAR_NONE(void);
03811   IntVarBranch INT_VAR_RND(Rnd r);
03813   IntVarBranch INT_VAR_MERIT_MIN(IntBranchMerit bm, BranchTbl tbl=NULL);
03815   IntVarBranch INT_VAR_MERIT_MIN(BoolBranchMerit bm, BranchTbl tbl=NULL);
03817   IntVarBranch INT_VAR_MERIT_MAX(IntBranchMerit bm, BranchTbl tbl=NULL);
03819   IntVarBranch INT_VAR_MERIT_MAX(BoolBranchMerit bm, BranchTbl tbl=NULL);
03821   IntVarBranch INT_VAR_DEGREE_MIN(BranchTbl tbl=NULL);
03823   IntVarBranch INT_VAR_DEGREE_MAX(BranchTbl tbl=NULL);
03825   IntVarBranch INT_VAR_AFC_MIN(double d=1.0, BranchTbl tbl=NULL);
03827   IntVarBranch INT_VAR_AFC_MIN(IntAFC a, BranchTbl tbl=NULL);
03829   IntVarBranch INT_VAR_AFC_MAX(double d=1.0, BranchTbl tbl=NULL);
03831   IntVarBranch INT_VAR_AFC_MAX(IntAFC a, BranchTbl tbl=NULL);
03833   IntVarBranch INT_VAR_ACTIVITY_MIN(double d=1.0, BranchTbl tbl=NULL);    
03835   IntVarBranch INT_VAR_ACTIVITY_MIN(IntActivity a, BranchTbl tbl=NULL);    
03837   IntVarBranch INT_VAR_ACTIVITY_MAX(double d=1.0, BranchTbl tbl=NULL);     
03839   IntVarBranch INT_VAR_ACTIVITY_MAX(IntActivity a, BranchTbl tbl=NULL);     
03841   IntVarBranch INT_VAR_MIN_MIN(BranchTbl tbl=NULL);         
03843   IntVarBranch INT_VAR_MIN_MAX(BranchTbl tbl=NULL);
03845   IntVarBranch INT_VAR_MAX_MIN(BranchTbl tbl=NULL); 
03847   IntVarBranch INT_VAR_MAX_MAX(BranchTbl tbl=NULL);
03849   IntVarBranch INT_VAR_SIZE_MIN(BranchTbl tbl=NULL);
03851   IntVarBranch INT_VAR_SIZE_MAX(BranchTbl tbl=NULL);
03853   IntVarBranch INT_VAR_DEGREE_SIZE_MIN(BranchTbl tbl=NULL);
03855   IntVarBranch INT_VAR_DEGREE_SIZE_MAX(BranchTbl tbl=NULL);
03857   IntVarBranch INT_VAR_AFC_SIZE_MIN(double d=1.0, BranchTbl tbl=NULL);
03859   IntVarBranch INT_VAR_AFC_SIZE_MIN(IntAFC a, BranchTbl tbl=NULL);
03861   IntVarBranch INT_VAR_AFC_SIZE_MAX(double d=1.0, BranchTbl tbl=NULL);
03863   IntVarBranch INT_VAR_AFC_SIZE_MAX(IntAFC a, BranchTbl tbl=NULL);
03865   IntVarBranch INT_VAR_ACTIVITY_SIZE_MIN(double d=1.0, BranchTbl tbl=NULL);
03867   IntVarBranch INT_VAR_ACTIVITY_SIZE_MIN(IntActivity a, BranchTbl tbl=NULL);
03869   IntVarBranch INT_VAR_ACTIVITY_SIZE_MAX(double d=1.0, BranchTbl tbl=NULL);
03871   IntVarBranch INT_VAR_ACTIVITY_SIZE_MAX(IntActivity a, BranchTbl tbl=NULL);
03877   IntVarBranch INT_VAR_REGRET_MIN_MIN(BranchTbl tbl=NULL);
03883   IntVarBranch INT_VAR_REGRET_MIN_MAX(BranchTbl tbl=NULL);
03889   IntVarBranch INT_VAR_REGRET_MAX_MIN(BranchTbl tbl=NULL);
03895   IntVarBranch INT_VAR_REGRET_MAX_MAX(BranchTbl tbl=NULL);
03897 
03898 }
03899 
03900 #include <gecode/int/branch/var.hpp>
03901 
03902 namespace Gecode {
03903 
03909   class IntValBranch : public ValBranch {
03910   public:
03912     enum Select {
03913       SEL_MIN,        
03914       SEL_MED,        
03915       SEL_MAX,        
03916       SEL_RND,        
03917       SEL_SPLIT_MIN,  
03918       SEL_SPLIT_MAX,  
03919       SEL_RANGE_MIN,  
03920       SEL_RANGE_MAX,  
03921       SEL_VAL_COMMIT, 
03922       SEL_VALUES_MIN, 
03923       SEL_VALUES_MAX, 
03924       SEL_NEAR_MIN,   
03925       SEL_NEAR_MAX,   
03926       SEL_NEAR_INC,   
03927       SEL_NEAR_DEC    
03928    };
03929   protected:
03931     IntSharedArray n;
03933     Select s;
03934   public:
03936     IntValBranch(Select s = SEL_MIN);
03938     IntValBranch(Rnd r);
03940     IntValBranch(VoidFunction v, VoidFunction c);
03942     IntValBranch(Select s, IntSharedArray n);
03944     Select select(void) const;
03946     IntSharedArray values(void) const;
03947   };
03948 
03954 
03955   IntValBranch INT_VAL_MIN(void);
03957   IntValBranch INT_VAL_MED(void);
03959   IntValBranch INT_VAL_MAX(void);
03961   IntValBranch INT_VAL_RND(Rnd r);
03963   IntValBranch INT_VAL_SPLIT_MIN(void);
03965   IntValBranch INT_VAL_SPLIT_MAX(void);
03967   IntValBranch INT_VAL_RANGE_MIN(void);
03969   IntValBranch INT_VAL_RANGE_MAX(void);
03976   IntValBranch INT_VAL(IntBranchVal v, IntBranchCommit c=NULL);
03983   IntValBranch INT_VAL(BoolBranchVal v, BoolBranchCommit c=NULL);
03985   IntValBranch INT_VALUES_MIN(void); 
03987   IntValBranch INT_VALUES_MAX(void);
03989   IntValBranch INT_VAL_NEAR_MIN(IntSharedArray n);
03991   IntValBranch INT_VAL_NEAR_MAX(IntSharedArray n);
03993   IntValBranch INT_VAL_NEAR_INC(IntSharedArray n);
03995   IntValBranch INT_VAL_NEAR_DEC(IntSharedArray n);
03997 
03998 }
03999 
04000 #include <gecode/int/branch/val.hpp>
04001 
04002 namespace Gecode {
04003 
04009   class IntAssign : public ValBranch {
04010   public:
04012     enum Select {
04013       SEL_MIN,       
04014       SEL_MED,       
04015       SEL_MAX,       
04016       SEL_RND,       
04017       SEL_VAL_COMMIT 
04018     };
04019   protected:
04021     Select s;
04022   public:
04024     IntAssign(Select s = SEL_MIN);
04026     IntAssign(Rnd r);
04028     IntAssign(VoidFunction v, VoidFunction c);
04030     Select select(void) const;
04031   };
04032 
04038 
04039   IntAssign INT_ASSIGN_MIN(void);
04041   IntAssign INT_ASSIGN_MED(void);
04043   IntAssign INT_ASSIGN_MAX(void);
04045   IntAssign INT_ASSIGN_RND(Rnd r);
04052   IntAssign INT_ASSIGN(IntBranchVal v, IntBranchCommit c=NULL);
04059   IntAssign INT_ASSIGN(BoolBranchVal v, BoolBranchCommit c=NULL);
04061 
04062 }
04063 
04064 #include <gecode/int/branch/assign.hpp>
04065 
04066 namespace Gecode {
04072   GECODE_INT_EXPORT BrancherHandle
04073   branch(Home home, const IntVarArgs& x,
04074          IntVarBranch vars, IntValBranch vals, 
04075          IntBranchFilter bf=NULL,
04076          IntVarValPrint vvp=NULL);
04082   GECODE_INT_EXPORT BrancherHandle
04083   branch(Home home, const IntVarArgs& x,
04084          TieBreak<IntVarBranch> vars, IntValBranch vals,
04085          IntBranchFilter bf=NULL,
04086          IntVarValPrint vvp=NULL);
04092   GECODE_INT_EXPORT BrancherHandle
04093   branch(Home home, IntVar x, IntValBranch vals,
04094          IntVarValPrint vvp=NULL);
04100   GECODE_INT_EXPORT BrancherHandle
04101   branch(Home home, const BoolVarArgs& x,
04102          IntVarBranch vars, IntValBranch vals,
04103          BoolBranchFilter bf=NULL,
04104          BoolVarValPrint vvp=NULL);
04110   GECODE_INT_EXPORT BrancherHandle
04111   branch(Home home, const BoolVarArgs& x,
04112          TieBreak<IntVarBranch> vars, IntValBranch vals,
04113          BoolBranchFilter bf=NULL,
04114          BoolVarValPrint vvp=NULL);
04120   GECODE_INT_EXPORT BrancherHandle
04121   branch(Home home, BoolVar x, IntValBranch vals,
04122          BoolVarValPrint vvp=NULL);
04123 
04129   GECODE_INT_EXPORT BrancherHandle
04130   assign(Home home, const IntVarArgs& x, IntAssign vals,
04131          IntBranchFilter ibf=NULL,
04132          IntVarValPrint vvp=NULL);
04138   GECODE_INT_EXPORT BrancherHandle
04139   assign(Home home, IntVar x, IntAssign vals,
04140          IntVarValPrint vvp=NULL);
04146   GECODE_INT_EXPORT BrancherHandle
04147   assign(Home home, const BoolVarArgs& x, IntAssign vals,
04148          BoolBranchFilter bbf=NULL,
04149          BoolVarValPrint vvp=NULL);
04155   GECODE_INT_EXPORT BrancherHandle
04156   assign(Home home, BoolVar x, IntAssign vals,
04157          BoolVarValPrint vvp=NULL);
04158 
04159 }
04160 
04161 namespace Gecode {
04162 
04166   template<class Char, class Traits>
04167   std::basic_ostream<Char,Traits>&
04168   operator <<(std::basic_ostream<Char,Traits>& os, const DFA& d);
04169 
04173   template<class Char, class Traits>
04174   std::basic_ostream<Char,Traits>&
04175   operator <<(std::basic_ostream<Char,Traits>& os, const TupleSet& ts);
04176 
04177 }
04178 
04179 // LDSB-related declarations.
04180 namespace Gecode {
04181 
04182   namespace Int { namespace LDSB {
04183     class SymmetryObject;
04184   }}
04185 
04191   class GECODE_INT_EXPORT SymmetryHandle {
04192   public:
04194     Int::LDSB::SymmetryObject* ref;
04196     void increment(void);
04198     void decrement(void);
04199   public:
04201     SymmetryHandle(void);
04203     SymmetryHandle(Int::LDSB::SymmetryObject* o);
04205     SymmetryHandle(const SymmetryHandle& h);
04207     const SymmetryHandle& operator=(const SymmetryHandle& h);
04209     ~SymmetryHandle(void);
04210   };
04211   class Symmetries;
04213   template<>
04214   class ArrayTraits<ArgArray<SymmetryHandle> > {
04215   public:
04216     typedef Symmetries     StorageType;
04217     typedef SymmetryHandle ValueType;
04218     typedef Symmetries     ArgsType;
04219   };
04220 
04227 
04228   class Symmetries : public ArgArray<SymmetryHandle> {};
04229   // If this is instead a typedef, strange things happen with the
04230   // overloading of the "branch" function.
04231 
04233   GECODE_INT_EXPORT SymmetryHandle VariableSymmetry(const IntVarArgs& x);
04235   GECODE_INT_EXPORT SymmetryHandle VariableSymmetry(const BoolVarArgs& x);
04237   GECODE_INT_EXPORT SymmetryHandle VariableSymmetry(const IntVarArgs& x, 
04238                                                     const IntArgs& indices);
04240   GECODE_INT_EXPORT SymmetryHandle ValueSymmetry(const IntArgs& v);
04242   GECODE_INT_EXPORT SymmetryHandle ValueSymmetry(const IntSet& v);
04244   GECODE_INT_EXPORT SymmetryHandle ValueSymmetry(IntVar vars);
04250   GECODE_INT_EXPORT
04251   SymmetryHandle VariableSequenceSymmetry(const IntVarArgs& x, int ss);
04257   GECODE_INT_EXPORT
04258   SymmetryHandle VariableSequenceSymmetry(const BoolVarArgs& x, int ss);
04264   GECODE_INT_EXPORT
04265   SymmetryHandle ValueSequenceSymmetry(const IntArgs& v, int ss);
04266 
04268   GECODE_INT_EXPORT SymmetryHandle values_reflect(int lower, int upper);
04270   GECODE_INT_EXPORT SymmetryHandle values_reflect(IntVar x);
04272 
04284   GECODE_INT_EXPORT BrancherHandle
04285   branch(Home home, const IntVarArgs& x,
04286          IntVarBranch vars, IntValBranch vals,
04287          const Symmetries& syms, 
04288          IntBranchFilter bf=NULL, IntVarValPrint vvp=NULL);
04300   GECODE_INT_EXPORT BrancherHandle
04301   branch(Home home, const IntVarArgs& x,
04302          TieBreak<IntVarBranch> vars, IntValBranch vals,
04303          const Symmetries& syms, 
04304          IntBranchFilter bf=NULL, IntVarValPrint vvp=NULL);
04316   GECODE_INT_EXPORT BrancherHandle
04317   branch(Home home, const BoolVarArgs& x,
04318          IntVarBranch vars, IntValBranch vals,
04319          const Symmetries& syms, 
04320          BoolBranchFilter bf=NULL, BoolVarValPrint vvp=NULL);
04332   GECODE_INT_EXPORT BrancherHandle
04333   branch(Home home, const BoolVarArgs& x,
04334          TieBreak<IntVarBranch> vars, IntValBranch vals,
04335          const Symmetries& syms, 
04336          BoolBranchFilter bf=NULL, BoolVarValPrint vvp=NULL);
04337 }
04338 
04339 #endif
04340 
04341 // IFDEF: GECODE_HAS_INT_VARS
04342 // STATISTICS: int-post
04343