Generated on Wed Mar 13 11:48:21 2013 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  *     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-03-08 02:29:47 +0100 (Fri, 08 Mar 2013) $ by $Author: mears $
00019  *     $Revision: 13473 $
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);
01275 
01276 
01288   GECODE_INT_EXPORT void
01289   precede(Home home, const IntVarArgs& x, int s, int t,
01290           IntConLevel=ICL_DEF);
01298   GECODE_INT_EXPORT void
01299   precede(Home home, const IntVarArgs& x, const IntArgs& c,
01300           IntConLevel=ICL_DEF);
01301 
01302 
01308 
01309   GECODE_INT_EXPORT void
01310   member(Home home, const IntVarArgs& x, IntVar y,
01311          IntConLevel icl=ICL_DEF);
01313   GECODE_INT_EXPORT void
01314   member(Home home, const BoolVarArgs& x, BoolVar y,
01315          IntConLevel icl=ICL_DEF);
01317   GECODE_INT_EXPORT void
01318   member(Home home, const IntVarArgs& x, IntVar y, Reify r,
01319          IntConLevel icl=ICL_DEF);
01321   GECODE_INT_EXPORT void
01322   member(Home home, const BoolVarArgs& x, BoolVar y, Reify r,
01323          IntConLevel icl=ICL_DEF);
01325 
01326 
01333 
01334   typedef SharedArray<int> IntSharedArray;
01340   GECODE_INT_EXPORT void
01341   element(Home home, IntSharedArray n, IntVar x0, IntVar x1,
01342           IntConLevel icl=ICL_DEF);
01348   GECODE_INT_EXPORT void
01349   element(Home home, IntSharedArray n, IntVar x0, BoolVar x1,
01350           IntConLevel icl=ICL_DEF);
01356   GECODE_INT_EXPORT void
01357   element(Home home, IntSharedArray n, IntVar x0, int x1,
01358           IntConLevel icl=ICL_DEF);
01364   GECODE_INT_EXPORT void
01365   element(Home home, const IntVarArgs& x, IntVar y0, IntVar y1,
01366           IntConLevel icl=ICL_DEF);
01372   GECODE_INT_EXPORT void
01373   element(Home home, const IntVarArgs& x, IntVar y0, int y1,
01374           IntConLevel icl=ICL_DEF);
01376   GECODE_INT_EXPORT void
01377   element(Home home, const BoolVarArgs& x, IntVar y0, BoolVar y1,
01378           IntConLevel icl=ICL_DEF);
01380   GECODE_INT_EXPORT void
01381   element(Home home, const BoolVarArgs& x, IntVar y0, int y1,
01382           IntConLevel icl=ICL_DEF);
01383 
01396   GECODE_INT_EXPORT void
01397   element(Home home, IntSharedArray a, 
01398           IntVar x, int w, IntVar y, int h, IntVar z,
01399           IntConLevel icl=ICL_DEF);
01412   GECODE_INT_EXPORT void
01413   element(Home home, IntSharedArray a, 
01414           IntVar x, int w, IntVar y, int h, BoolVar z,
01415           IntConLevel icl=ICL_DEF);
01431   GECODE_INT_EXPORT void
01432   element(Home home, const IntVarArgs& a, 
01433           IntVar x, int w, IntVar y, int h, IntVar z,
01434           IntConLevel icl=ICL_DEF);
01447   GECODE_INT_EXPORT void
01448   element(Home home, const BoolVarArgs& a, 
01449           IntVar x, int w, IntVar y, int h, BoolVar z,
01450           IntConLevel icl=ICL_DEF);
01452 
01453 
01468   GECODE_INT_EXPORT void
01469   distinct(Home home, const IntVarArgs& x,
01470            IntConLevel icl=ICL_DEF);
01483   GECODE_INT_EXPORT void
01484   distinct(Home home, const IntArgs& n, const IntVarArgs& x,
01485            IntConLevel icl=ICL_DEF);
01487 
01488 
01506   GECODE_INT_EXPORT void
01507   channel(Home home, const IntVarArgs& x, const IntVarArgs& y,
01508           IntConLevel icl=ICL_DEF);
01509 
01523   GECODE_INT_EXPORT void
01524   channel(Home home, const IntVarArgs& x, int xoff,
01525           const IntVarArgs& y, int yoff,
01526           IntConLevel icl=ICL_DEF);
01527 
01529   GECODE_INT_EXPORT void
01530   channel(Home home, BoolVar x0, IntVar x1,
01531           IntConLevel icl=ICL_DEF);
01533   forceinline void
01534   channel(Home home, IntVar x0, BoolVar x1,
01535           IntConLevel icl=ICL_DEF) {
01536     channel(home,x1,x0,icl);
01537   }
01543   GECODE_INT_EXPORT void
01544   channel(Home home, const BoolVarArgs& x, IntVar y, int o=0,
01545           IntConLevel icl=ICL_DEF);
01547 
01548 
01565   GECODE_INT_EXPORT void
01566   sorted(Home home, const IntVarArgs& x, const IntVarArgs& y,
01567          IntConLevel icl=ICL_DEF);
01568 
01580   GECODE_INT_EXPORT void
01581   sorted(Home home, const IntVarArgs& x, const IntVarArgs& y,
01582          const IntVarArgs& z,
01583          IntConLevel icl=ICL_DEF);
01585 
01586 
01605   GECODE_INT_EXPORT void
01606   count(Home home, const IntVarArgs& x, int n, IntRelType irt, int m,
01607         IntConLevel icl=ICL_DEF);
01612   GECODE_INT_EXPORT void
01613   count(Home home, const IntVarArgs& x, const IntSet& y, IntRelType irt, int m,
01614         IntConLevel icl=ICL_DEF);
01622   GECODE_INT_EXPORT void
01623   count(Home home, const IntVarArgs& x, IntVar y, IntRelType irt, int m,
01624         IntConLevel icl=ICL_DEF);
01632   GECODE_INT_EXPORT void
01633   count(Home home, const IntVarArgs& x, const IntArgs& y, IntRelType irt, int m,
01634         IntConLevel icl=ICL_DEF);
01639   GECODE_INT_EXPORT void
01640   count(Home home, const IntVarArgs& x, int n, IntRelType irt, IntVar z,
01641         IntConLevel icl=ICL_DEF);
01646   GECODE_INT_EXPORT void
01647   count(Home home, const IntVarArgs& x, const IntSet& y, IntRelType irt, IntVar z,
01648         IntConLevel icl=ICL_DEF);
01656   GECODE_INT_EXPORT void
01657   count(Home home, const IntVarArgs& x, IntVar y, IntRelType irt, IntVar z,
01658         IntConLevel icl=ICL_DEF);
01666   GECODE_INT_EXPORT void
01667   count(Home home, const IntVarArgs& x, const IntArgs& y, IntRelType irt, IntVar z,
01668         IntConLevel icl=ICL_DEF);
01669 
01683   GECODE_INT_EXPORT void
01684   count(Home home, const IntVarArgs& x, const IntVarArgs& c,
01685         IntConLevel icl=ICL_DEF);
01686 
01700   GECODE_INT_EXPORT void
01701   count(Home home, const IntVarArgs& x, const IntSetArgs& c,
01702         IntConLevel icl=ICL_DEF);
01703 
01720   GECODE_INT_EXPORT void
01721   count(Home home, const IntVarArgs& x,
01722         const IntVarArgs& c, const IntArgs& v,
01723         IntConLevel icl=ICL_DEF);
01724 
01741   GECODE_INT_EXPORT void
01742   count(Home home, const IntVarArgs& x,
01743         const IntSetArgs& c, const IntArgs& v,
01744         IntConLevel icl=ICL_DEF);
01745 
01762   GECODE_INT_EXPORT void
01763   count(Home home, const IntVarArgs& x,
01764         const IntSet& c, const IntArgs& v,
01765         IntConLevel icl=ICL_DEF);
01766 
01768 
01783   GECODE_INT_EXPORT void
01784   nvalues(Home home, const IntVarArgs& x, IntRelType irt, int y,
01785           IntConLevel icl=ICL_DEF);
01789   GECODE_INT_EXPORT void
01790   nvalues(Home home, const IntVarArgs& x, IntRelType irt, IntVar y,
01791           IntConLevel icl=ICL_DEF);
01795   GECODE_INT_EXPORT void
01796   nvalues(Home home, const BoolVarArgs& x, IntRelType irt, int y,
01797           IntConLevel icl=ICL_DEF);
01801   GECODE_INT_EXPORT void
01802   nvalues(Home home, const BoolVarArgs& x, IntRelType irt, IntVar y,
01803           IntConLevel icl=ICL_DEF);
01805 
01826   GECODE_INT_EXPORT void
01827   sequence(Home home, const IntVarArgs& x, const IntSet& s, 
01828            int q, int l, int u, IntConLevel icl=ICL_DEF); 
01829   
01844   GECODE_INT_EXPORT void
01845   sequence(Home home, const BoolVarArgs& x, const IntSet& s, 
01846            int q, int l, int u, IntConLevel icl=ICL_DEF); 
01847 
01849 
01862 
01870   class DFA : public SharedHandle {
01871   private:
01873     class DFAI;
01874   public:
01876     class Transition {
01877     public:
01878       int i_state; 
01879       int symbol;  
01880       int o_state; 
01881 
01882       Transition();
01884       Transition(int i_state0, int symbol0, int o_state0);
01885     };
01887     class Transitions {
01888     private:
01890       const Transition* c_trans;
01892       const Transition* e_trans;
01893     public:
01895       Transitions(const DFA& d);
01897       Transitions(const DFA& d, int n);
01899       bool operator ()(void) const;
01901       void operator ++(void);
01903       int i_state(void) const;
01905       int symbol(void) const;
01907       int o_state(void) const;
01908     };
01910     class Symbols {
01911     private:
01913       const Transition* c_trans;
01915       const Transition* e_trans;
01916     public:
01918       Symbols(const DFA& d);
01920       bool operator ()(void) const;
01922       void operator ++(void);
01924       int val(void) const;
01925     };
01926   public:
01927     friend class Transitions;
01929     DFA(void);
01941     GECODE_INT_EXPORT
01942     DFA(int s, Transition t[], int f[], bool minimize=true);
01944     DFA(const DFA& d);
01946     int n_states(void) const;
01948     int n_transitions(void) const;
01950     unsigned int n_symbols(void) const;
01952     unsigned int max_degree(void) const;
01954     int final_fst(void) const;
01956     int final_lst(void) const;
01958     int symbol_min(void) const;
01960     int symbol_max(void) const;
01961   };
01962 
01963 
01971   enum ExtensionalPropKind {
01972     EPK_DEF,    
01973     EPK_SPEED,  
01974     EPK_MEMORY  
01975   };
01976 
01987   GECODE_INT_EXPORT void
01988   extensional(Home home, const IntVarArgs& x, DFA d,
01989               IntConLevel icl=ICL_DEF);
01990 
02001   GECODE_INT_EXPORT void
02002   extensional(Home home, const BoolVarArgs& x, DFA d,
02003               IntConLevel icl=ICL_DEF);
02004 
02011   class TupleSet : public SharedHandle {
02012   public:
02017     typedef int* Tuple;
02018 
02023     class GECODE_VTABLE_EXPORT TupleSetI
02024       : public SharedHandle::Object {
02025     public:
02027       int arity;
02029       int size;
02031       Tuple** tuples;
02033       Tuple* tuple_data;
02035       int* data;
02037       int excess;
02039       int min, max;
02041       unsigned int domsize;
02043       Tuple** last;
02045       Tuple* nullpointer;
02046 
02048       template<class T>
02049       void add(T t);
02051       GECODE_INT_EXPORT void finalize(void);
02053       GECODE_INT_EXPORT void resize(void);
02055       bool finalized(void) const;
02057       TupleSetI(void);
02059       GECODE_INT_EXPORT virtual ~TupleSetI(void);
02061       GECODE_INT_EXPORT virtual SharedHandle::Object* copy(void) const;
02062     };
02063     
02065     TupleSetI* implementation(void);
02066 
02068     TupleSet(void);
02070     TupleSet(const TupleSet& d);
02071 
02073     void add(const IntArgs& tuple);
02075     void finalize(void);
02077     bool finalized(void) const;
02079     int arity(void) const;
02081     int tuples(void) const;
02083     Tuple operator [](int i) const;
02085     int min(void) const;
02087     int max(void) const;
02088   };
02089 
02108   GECODE_INT_EXPORT void
02109   extensional(Home home, const IntVarArgs& x, const TupleSet& t,
02110               ExtensionalPropKind epk=EPK_DEF, IntConLevel icl=ICL_DEF);
02111 
02122   GECODE_INT_EXPORT void
02123   extensional(Home home, const BoolVarArgs& x, const TupleSet& t,
02124               ExtensionalPropKind epk=EPK_DEF, IntConLevel icl=ICL_DEF);
02126 
02127 }
02128 
02129 #include <gecode/int/extensional/dfa.hpp>
02130 #include <gecode/int/extensional/tuple-set.hpp>
02131 
02132 namespace Gecode {
02133 
02145   GECODE_INT_EXPORT void
02146   min(Home home, IntVar x0, IntVar x1, IntVar x2,
02147       IntConLevel icl=ICL_DEF);
02155   GECODE_INT_EXPORT void
02156   min(Home home, const IntVarArgs& x, IntVar y,
02157       IntConLevel icl=ICL_DEF);
02163   GECODE_INT_EXPORT void
02164   max(Home home, IntVar x0, IntVar x1, IntVar x2,
02165       IntConLevel icl=ICL_DEF);
02173   GECODE_INT_EXPORT void
02174   max(Home home, const IntVarArgs& x, IntVar y,
02175       IntConLevel icl=ICL_DEF);
02176 
02182   GECODE_INT_EXPORT void
02183   abs(Home home, IntVar x0, IntVar x1,
02184       IntConLevel icl=ICL_DEF);
02185 
02191   GECODE_INT_EXPORT void
02192   mult(Home home, IntVar x0, IntVar x1, IntVar x2,
02193        IntConLevel icl=ICL_DEF);
02194 
02199   GECODE_INT_EXPORT void
02200   divmod(Home home, IntVar x0, IntVar x1, IntVar x2, IntVar x3,
02201          IntConLevel icl=ICL_DEF);
02202 
02207   GECODE_INT_EXPORT void
02208   div(Home home, IntVar x0, IntVar x1, IntVar x2,
02209       IntConLevel icl=ICL_DEF);
02210 
02215   GECODE_INT_EXPORT void
02216   mod(Home home, IntVar x0, IntVar x1, IntVar x2,
02217       IntConLevel icl=ICL_DEF);
02218 
02224   GECODE_INT_EXPORT void
02225   sqr(Home home, IntVar x0, IntVar x1,
02226       IntConLevel icl=ICL_DEF);
02227 
02233   GECODE_INT_EXPORT void
02234   sqrt(Home home, IntVar x0, IntVar x1,
02235        IntConLevel icl=ICL_DEF);
02236 
02245   GECODE_INT_EXPORT void
02246   pow(Home home, IntVar x0, int n, IntVar x1,
02247       IntConLevel icl=ICL_DEF);
02248 
02257   GECODE_INT_EXPORT void
02258   nroot(Home home, IntVar x0, int n, IntVar x1,
02259        IntConLevel icl=ICL_DEF);
02260 
02262 
02294   GECODE_INT_EXPORT void
02295   linear(Home home, const IntVarArgs& x,
02296          IntRelType irt, int c,
02297          IntConLevel icl=ICL_DEF);
02301   GECODE_INT_EXPORT void
02302   linear(Home home, const IntVarArgs& x,
02303          IntRelType irt, IntVar y,
02304          IntConLevel icl=ICL_DEF);
02308   GECODE_INT_EXPORT void
02309   linear(Home home, const IntVarArgs& x,
02310          IntRelType irt, int c, Reify r,
02311          IntConLevel icl=ICL_DEF);
02315   GECODE_INT_EXPORT void
02316   linear(Home home, const IntVarArgs& x,
02317          IntRelType irt, IntVar y, Reify r,
02318          IntConLevel icl=ICL_DEF);
02325   GECODE_INT_EXPORT void
02326   linear(Home home, const IntArgs& a, const IntVarArgs& x,
02327          IntRelType irt, int c,
02328          IntConLevel icl=ICL_DEF);
02335   GECODE_INT_EXPORT void
02336   linear(Home home, const IntArgs& a, const IntVarArgs& x,
02337          IntRelType irt, IntVar y,
02338          IntConLevel icl=ICL_DEF);
02345   GECODE_INT_EXPORT void
02346   linear(Home home, const IntArgs& a, const IntVarArgs& x,
02347          IntRelType irt, int c, Reify r,
02348          IntConLevel icl=ICL_DEF);
02355   GECODE_INT_EXPORT void
02356   linear(Home home, const IntArgs& a, const IntVarArgs& x,
02357          IntRelType irt, IntVar y, Reify r,
02358          IntConLevel icl=ICL_DEF);
02359 
02360 
02388   GECODE_INT_EXPORT void
02389   linear(Home home, const BoolVarArgs& x,
02390          IntRelType irt, int c,
02391          IntConLevel icl=ICL_DEF);
02395   GECODE_INT_EXPORT void
02396   linear(Home home, const BoolVarArgs& x,
02397          IntRelType irt, int c, Reify r,
02398          IntConLevel icl=ICL_DEF);
02402   GECODE_INT_EXPORT void
02403   linear(Home home, const BoolVarArgs& x,
02404          IntRelType irt, IntVar y,
02405          IntConLevel icl=ICL_DEF);
02409   GECODE_INT_EXPORT void
02410   linear(Home home, const BoolVarArgs& x,
02411          IntRelType irt, IntVar y, Reify r,
02412          IntConLevel icl=ICL_DEF);
02419   GECODE_INT_EXPORT void
02420   linear(Home home, const IntArgs& a, const BoolVarArgs& x,
02421          IntRelType irt, int c,
02422          IntConLevel icl=ICL_DEF);
02429   GECODE_INT_EXPORT void
02430   linear(Home home, const IntArgs& a, const BoolVarArgs& x,
02431          IntRelType irt, int c, Reify r,
02432          IntConLevel icl=ICL_DEF);
02439   GECODE_INT_EXPORT void
02440   linear(Home home, const IntArgs& a, const BoolVarArgs& x,
02441          IntRelType irt, IntVar y,
02442          IntConLevel icl=ICL_DEF);
02449   GECODE_INT_EXPORT void
02450   linear(Home home, const IntArgs& a, const BoolVarArgs& x,
02451          IntRelType irt, IntVar y, Reify r,
02452          IntConLevel icl=ICL_DEF);
02453 
02454 
02481   GECODE_INT_EXPORT void
02482   binpacking(Home home, 
02483              const IntVarArgs& l, 
02484              const IntVarArgs& b, const IntArgs& s,
02485              IntConLevel icl=ICL_DEF);
02504   GECODE_INT_EXPORT void
02505   nooverlap(Home home, 
02506             const IntVarArgs& x, const IntArgs& w,
02507             const IntVarArgs& y, const IntArgs& h,
02508             IntConLevel icl=ICL_DEF);
02522   GECODE_INT_EXPORT void
02523   nooverlap(Home home, 
02524             const IntVarArgs& x, const IntArgs& w,
02525             const IntVarArgs& y, const IntArgs& h,
02526             const BoolVarArgs& o,
02527             IntConLevel icl=ICL_DEF);
02544   GECODE_INT_EXPORT void
02545   nooverlap(Home home, 
02546             const IntVarArgs& x0, const IntVarArgs& w, const IntVarArgs& x1,
02547             const IntVarArgs& y0, const IntVarArgs& h, const IntVarArgs& y1,
02548             IntConLevel icl=ICL_DEF);
02566   GECODE_INT_EXPORT void
02567   nooverlap(Home home, 
02568             const IntVarArgs& x0, const IntVarArgs& w, const IntVarArgs& x1,
02569             const IntVarArgs& y0, const IntVarArgs& h, const IntVarArgs& y1,
02570             const BoolVarArgs& o,
02571             IntConLevel icl=ICL_DEF);
02572 
02573 
02579 
02622   GECODE_INT_EXPORT void
02623   cumulatives(Home home, const IntVarArgs& m,
02624               const IntVarArgs& s, const IntVarArgs& p,
02625               const IntVarArgs& e, const IntVarArgs& u,
02626               const IntArgs& c, bool at_most,
02627               IntConLevel icl=ICL_DEF);
02632   GECODE_INT_EXPORT void
02633   cumulatives(Home home, const IntArgs& m,
02634               const IntVarArgs& s, const IntVarArgs& p,
02635               const IntVarArgs& e, const IntVarArgs& u,
02636               const IntArgs& c, bool at_most,
02637               IntConLevel icl=ICL_DEF);
02642   GECODE_INT_EXPORT void
02643   cumulatives(Home home, const IntVarArgs& m,
02644               const IntVarArgs& s, const IntArgs& p,
02645               const IntVarArgs& e, const IntVarArgs& u,
02646               const IntArgs& c, bool at_most,
02647               IntConLevel icl=ICL_DEF);
02652   GECODE_INT_EXPORT void
02653   cumulatives(Home home, const IntArgs& m,
02654               const IntVarArgs& s, const IntArgs& p,
02655               const IntVarArgs& e, const IntVarArgs& u,
02656               const IntArgs& c, bool at_most,
02657               IntConLevel icl=ICL_DEF);
02662   GECODE_INT_EXPORT void
02663   cumulatives(Home home, const IntVarArgs& m,
02664               const IntVarArgs& s, const IntVarArgs& p,
02665               const IntVarArgs& e, const IntArgs& u,
02666               const IntArgs& c, bool at_most,
02667               IntConLevel icl=ICL_DEF);
02672   GECODE_INT_EXPORT void
02673   cumulatives(Home home, const IntArgs& m,
02674               const IntVarArgs& s, const IntVarArgs& p,
02675               const IntVarArgs& e, const IntArgs& u,
02676               const IntArgs& c, bool at_most,
02677               IntConLevel icl=ICL_DEF);
02682   GECODE_INT_EXPORT void
02683   cumulatives(Home home, const IntVarArgs& m,
02684               const IntVarArgs& s, const IntArgs& p,
02685               const IntVarArgs& e, const IntArgs& u,
02686               const IntArgs& c, bool at_most,
02687               IntConLevel icl=ICL_DEF);
02692   GECODE_INT_EXPORT void
02693   cumulatives(Home home, const IntArgs& m,
02694               const IntVarArgs& s, const IntArgs& p,
02695               const IntVarArgs& e, const IntArgs& u,
02696               const IntArgs& c, bool at_most,
02697               IntConLevel icl=ICL_DEF);
02698 
02717   GECODE_INT_EXPORT void
02718   unary(Home home, const IntVarArgs& s, const IntArgs& p,
02719         IntConLevel icl=ICL_DEF);
02720 
02741   GECODE_INT_EXPORT void
02742   unary(Home home, const IntVarArgs& s, const IntArgs& p, 
02743         const BoolVarArgs& m, IntConLevel icl=ICL_DEF);
02744 
02773   GECODE_INT_EXPORT void
02774   unary(Home home, const TaskTypeArgs& t,
02775         const IntVarArgs& flex, const IntArgs& fix, IntConLevel icl=ICL_DEF);
02776 
02807   GECODE_INT_EXPORT void
02808   unary(Home home, const TaskTypeArgs& t,
02809         const IntVarArgs& flex, const IntArgs& fix,
02810         const BoolVarArgs& m, IntConLevel icl=ICL_DEF);
02811 
02831   GECODE_INT_EXPORT void
02832   unary(Home home, const IntVarArgs& s, const IntVarArgs& p, 
02833         const IntVarArgs& e, IntConLevel icl=ICL_DEF);
02834 
02856   GECODE_INT_EXPORT void
02857   unary(Home home, const IntVarArgs& s, const IntVarArgs& p,
02858         const IntVarArgs& e, const BoolVarArgs& m, IntConLevel icl=ICL_DEF);
02859 
02894   GECODE_INT_EXPORT void
02895   cumulative(Home home, int c, const TaskTypeArgs& t,
02896              const IntVarArgs& flex, const IntArgs& fix, const IntArgs& u,
02897              IntConLevel icl=ICL_DEF);
02898 
02899   
02904   GECODE_INT_EXPORT void
02905   cumulative(Home home, IntVar c, const TaskTypeArgs& t,
02906              const IntVarArgs& flex, const IntArgs& fix, const IntArgs& u,
02907              IntConLevel icl=ICL_DEF);
02908 
02945   GECODE_INT_EXPORT void
02946   cumulative(Home home, int c, const TaskTypeArgs& t,
02947              const IntVarArgs& flex, const IntArgs& fix, const IntArgs& u,
02948              const BoolVarArgs& m, IntConLevel icl=ICL_DEF);
02949 
02953   GECODE_INT_EXPORT void
02954   cumulative(Home home, IntVar c, const TaskTypeArgs& t,
02955              const IntVarArgs& flex, const IntArgs& fix, const IntArgs& u,
02956              const BoolVarArgs& m, IntConLevel icl=ICL_DEF);
02957 
02982   GECODE_INT_EXPORT void
02983   cumulative(Home home, int c, const IntVarArgs& s, const IntArgs& p,
02984              const IntArgs& u, IntConLevel icl=ICL_DEF);
02985 
02989   GECODE_INT_EXPORT void
02990   cumulative(Home home, IntVar c, const IntVarArgs& s, const IntArgs& p,
02991              const IntArgs& u, IntConLevel icl=ICL_DEF);
02992 
03019   GECODE_INT_EXPORT void
03020   cumulative(Home home, int c, const IntVarArgs& s, const IntArgs& p, 
03021              const IntArgs& u, const BoolVarArgs& m, IntConLevel icl=ICL_DEF);
03022 
03026   GECODE_INT_EXPORT void
03027   cumulative(Home home, IntVar c, const IntVarArgs& s, const IntArgs& p, 
03028              const IntArgs& u, const BoolVarArgs& m, IntConLevel icl=ICL_DEF);
03029 
03058   GECODE_INT_EXPORT void
03059   cumulative(Home home, int c, const IntVarArgs& s, const IntVarArgs& p,
03060              const IntVarArgs& e, const IntArgs& u, IntConLevel icl=ICL_DEF);
03061 
03065   GECODE_INT_EXPORT void
03066   cumulative(Home home, IntVar c, const IntVarArgs& s, const IntVarArgs& p,
03067              const IntVarArgs& e, const IntArgs& u, IntConLevel icl=ICL_DEF);
03068 
03099   GECODE_INT_EXPORT void
03100   cumulative(Home home, int c, const IntVarArgs& s, const IntVarArgs& p, 
03101              const IntVarArgs& e, const IntArgs& u, const BoolVarArgs& m, 
03102              IntConLevel icl=ICL_DEF);
03103 
03107   GECODE_INT_EXPORT void
03108   cumulative(Home home, IntVar c, const IntVarArgs& s, const IntVarArgs& p, 
03109              const IntVarArgs& e, const IntArgs& u, const BoolVarArgs& m, 
03110              IntConLevel icl=ICL_DEF);
03112 
03113 
03133   GECODE_INT_EXPORT void
03134   circuit(Home home, const IntVarArgs& x,
03135           IntConLevel icl=ICL_DEF);
03151   GECODE_INT_EXPORT void
03152   circuit(Home home, int offset, const IntVarArgs& x,
03153           IntConLevel icl=ICL_DEF);
03175   GECODE_INT_EXPORT void
03176   circuit(Home home, 
03177           const IntArgs& c,
03178           const IntVarArgs& x, const IntVarArgs& y, IntVar z,
03179           IntConLevel icl=ICL_DEF);
03202   GECODE_INT_EXPORT void
03203   circuit(Home home, 
03204           const IntArgs& c, int offset,
03205           const IntVarArgs& x, const IntVarArgs& y, IntVar z,
03206           IntConLevel icl=ICL_DEF);
03225   GECODE_INT_EXPORT void
03226   circuit(Home home, 
03227           const IntArgs& c,
03228           const IntVarArgs& x, IntVar z,
03229           IntConLevel icl=ICL_DEF);
03250   GECODE_INT_EXPORT void
03251   circuit(Home home, 
03252           const IntArgs& c, int offset,
03253           const IntVarArgs& x, IntVar z,
03254           IntConLevel icl=ICL_DEF);
03270   GECODE_INT_EXPORT void
03271   path(Home home, const IntVarArgs& x, IntVar s, IntVar e,
03272        IntConLevel icl=ICL_DEF);
03290   GECODE_INT_EXPORT void
03291   path(Home home, int offset, const IntVarArgs& x, IntVar s, IntVar e,
03292        IntConLevel icl=ICL_DEF);
03315   GECODE_INT_EXPORT void
03316   path(Home home, 
03317        const IntArgs& c,
03318        const IntVarArgs& x, IntVar s, IntVar e, const IntVarArgs& y, IntVar z,
03319        IntConLevel icl=ICL_DEF);
03344   GECODE_INT_EXPORT void
03345   path(Home home, 
03346        const IntArgs& c, int offset,
03347        const IntVarArgs& x, IntVar s, IntVar e, const IntVarArgs& y, IntVar z,
03348        IntConLevel icl=ICL_DEF);
03369   GECODE_INT_EXPORT void
03370   path(Home home, 
03371        const IntArgs& c,
03372        const IntVarArgs& x, IntVar s, IntVar e, IntVar z,
03373        IntConLevel icl=ICL_DEF);
03396   GECODE_INT_EXPORT void
03397   path(Home home, 
03398        const IntArgs& c, int offset,
03399        const IntVarArgs& x, IntVar s, IntVar e, IntVar z,
03400        IntConLevel icl=ICL_DEF);
03402 
03403 
03404 
03413 
03414   GECODE_INT_EXPORT void
03415   wait(Home home, IntVar x, void (*c)(Space& home),
03416        IntConLevel icl=ICL_DEF);
03418   GECODE_INT_EXPORT void
03419   wait(Home home, BoolVar x, void (*c)(Space& home),
03420        IntConLevel icl=ICL_DEF);
03422   GECODE_INT_EXPORT void
03423   wait(Home home, const IntVarArgs& x, void (*c)(Space& home),
03424        IntConLevel icl=ICL_DEF);
03426   GECODE_INT_EXPORT void
03427   wait(Home home, const BoolVarArgs& x, void (*c)(Space& home),
03428        IntConLevel icl=ICL_DEF);
03430   GECODE_INT_EXPORT void
03431   when(Home home, BoolVar x, 
03432        void (*t)(Space& home), void (*e)(Space& home)= NULL,
03433        IntConLevel icl=ICL_DEF);
03435 
03436 
03461   GECODE_INT_EXPORT void
03462   unshare(Home home, IntVarArgs& x,
03463           IntConLevel icl=ICL_DEF);
03465   GECODE_INT_EXPORT void
03466   unshare(Home home, BoolVarArgs& x,
03467           IntConLevel icl=ICL_DEF);
03469 
03470 }
03471 
03472 namespace Gecode {
03473 
03487   typedef bool (*IntBranchFilter)(const Space& home, IntVar x, int i);
03496   typedef bool (*BoolBranchFilter)(const Space& home, BoolVar x, int i);
03497 
03507   typedef double (*IntBranchMerit)(const Space& home, IntVar x, int i);
03517   typedef double (*BoolBranchMerit)(const Space& home, BoolVar x, int i);
03518 
03529   typedef int (*IntBranchVal)(const Space& home, IntVar x, int i);
03540   typedef int (*BoolBranchVal)(const Space& home, BoolVar x, int i);
03541 
03553   typedef void (*IntBranchCommit)(Space& home, unsigned int a,
03554                                   IntVar x, int i, int n);
03566   typedef void (*BoolBranchCommit)(Space& home, unsigned int a,
03567                                    BoolVar x, int i, int n);
03568 
03569 }
03570 
03571 #include <gecode/int/branch/traits.hpp>
03572 
03573 namespace Gecode {
03574 
03580   class IntAFC : public AFC {
03581   public:
03589     IntAFC(void);
03591     IntAFC(const IntAFC& a);
03593     IntAFC& operator =(const IntAFC& a);      
03595     IntAFC(Home home, const IntVarArgs& x, double d=1.0);
03597     IntAFC(Home home, const BoolVarArgs& x, double d=1.0);
03605     void init(Home, const IntVarArgs& x, double d=1.0);
03613     void init(Home, const BoolVarArgs& x, double d=1.0);
03614   };
03615 
03616 }
03617 
03618 #include <gecode/int/branch/afc.hpp>
03619 
03620 namespace Gecode {
03621 
03627   class IntActivity : public Activity {
03628   public:
03636     IntActivity(void);
03638     IntActivity(const IntActivity& a);
03640     IntActivity& operator =(const IntActivity& a);      
03642     GECODE_INT_EXPORT 
03643     IntActivity(Home home, const IntVarArgs& x, double d=1.0);
03645     GECODE_INT_EXPORT 
03646     IntActivity(Home home, const BoolVarArgs& x, double d=1.0);
03654     GECODE_INT_EXPORT void
03655     init(Home, const IntVarArgs& x, double d=1.0);
03663     GECODE_INT_EXPORT void
03664     init(Home, const BoolVarArgs& x, double d=1.0);
03665   };
03666 
03667 }
03668 
03669 #include <gecode/int/branch/activity.hpp>
03670 
03671 namespace Gecode {
03672 
03678   class IntVarBranch : public VarBranch {
03679   public:
03681     enum Select {
03682       SEL_NONE = 0,        
03683       SEL_RND,             
03684       SEL_MERIT_MIN,       
03685       SEL_MERIT_MAX,       
03686       SEL_DEGREE_MIN,      
03687       SEL_DEGREE_MAX,      
03688       SEL_AFC_MIN,         
03689       SEL_AFC_MAX,         
03690       SEL_ACTIVITY_MIN,    
03691       SEL_ACTIVITY_MAX,    
03692       SEL_MIN_MIN,         
03693       SEL_MIN_MAX,         
03694       SEL_MAX_MIN,         
03695       SEL_MAX_MAX,         
03696       SEL_SIZE_MIN,        
03697       SEL_SIZE_MAX,        
03698       SEL_DEGREE_SIZE_MIN, 
03699       SEL_DEGREE_SIZE_MAX, 
03700       SEL_AFC_SIZE_MIN,    
03701       SEL_AFC_SIZE_MAX,    
03702       SEL_ACTIVITY_SIZE_MIN, 
03703       SEL_ACTIVITY_SIZE_MAX, 
03704 
03709       SEL_REGRET_MIN_MIN,
03715       SEL_REGRET_MIN_MAX,
03721       SEL_REGRET_MAX_MIN,
03727       SEL_REGRET_MAX_MAX
03728     };
03729   protected:
03731     Select s;
03732   public:
03734     IntVarBranch(void);
03736     IntVarBranch(Rnd r);
03738     IntVarBranch(Select s, BranchTbl t);
03740     IntVarBranch(Select s, double d, BranchTbl t);
03742     IntVarBranch(Select s, AFC a, BranchTbl t);
03744     IntVarBranch(Select s, Activity a, BranchTbl t);
03746     IntVarBranch(Select s, VoidFunction mf, BranchTbl t);
03748     Select select(void) const;
03750     void expand(Home home, const IntVarArgs& x);
03752     void expand(Home home, const BoolVarArgs& x);
03753   };
03754 
03760 
03761   IntVarBranch INT_VAR_NONE(void);
03763   IntVarBranch INT_VAR_RND(Rnd r);
03765   IntVarBranch INT_VAR_MERIT_MIN(IntBranchMerit bm, BranchTbl tbl=NULL);
03767   IntVarBranch INT_VAR_MERIT_MIN(BoolBranchMerit bm, BranchTbl tbl=NULL);
03769   IntVarBranch INT_VAR_MERIT_MAX(IntBranchMerit bm, BranchTbl tbl=NULL);
03771   IntVarBranch INT_VAR_MERIT_MAX(BoolBranchMerit bm, BranchTbl tbl=NULL);
03773   IntVarBranch INT_VAR_DEGREE_MIN(BranchTbl tbl=NULL);
03775   IntVarBranch INT_VAR_DEGREE_MAX(BranchTbl tbl=NULL);
03777   IntVarBranch INT_VAR_AFC_MIN(double d=1.0, BranchTbl tbl=NULL);
03779   IntVarBranch INT_VAR_AFC_MIN(IntAFC a, BranchTbl tbl=NULL);
03781   IntVarBranch INT_VAR_AFC_MAX(double d=1.0, BranchTbl tbl=NULL);
03783   IntVarBranch INT_VAR_AFC_MAX(IntAFC a, BranchTbl tbl=NULL);
03785   IntVarBranch INT_VAR_ACTIVITY_MIN(double d=1.0, BranchTbl tbl=NULL);    
03787   IntVarBranch INT_VAR_ACTIVITY_MIN(IntActivity a, BranchTbl tbl=NULL);    
03789   IntVarBranch INT_VAR_ACTIVITY_MAX(double d=1.0, BranchTbl tbl=NULL);     
03791   IntVarBranch INT_VAR_ACTIVITY_MAX(IntActivity a, BranchTbl tbl=NULL);     
03793   IntVarBranch INT_VAR_MIN_MIN(BranchTbl tbl=NULL);         
03795   IntVarBranch INT_VAR_MIN_MAX(BranchTbl tbl=NULL);
03797   IntVarBranch INT_VAR_MAX_MIN(BranchTbl tbl=NULL); 
03799   IntVarBranch INT_VAR_MAX_MAX(BranchTbl tbl=NULL);
03801   IntVarBranch INT_VAR_SIZE_MIN(BranchTbl tbl=NULL);
03803   IntVarBranch INT_VAR_SIZE_MAX(BranchTbl tbl=NULL);
03805   IntVarBranch INT_VAR_DEGREE_SIZE_MIN(BranchTbl tbl=NULL);
03807   IntVarBranch INT_VAR_DEGREE_SIZE_MAX(BranchTbl tbl=NULL);
03809   IntVarBranch INT_VAR_AFC_SIZE_MIN(double d=1.0, BranchTbl tbl=NULL);
03811   IntVarBranch INT_VAR_AFC_SIZE_MIN(IntAFC a, BranchTbl tbl=NULL);
03813   IntVarBranch INT_VAR_AFC_SIZE_MAX(double d=1.0, BranchTbl tbl=NULL);
03815   IntVarBranch INT_VAR_AFC_SIZE_MAX(IntAFC a, BranchTbl tbl=NULL);
03817   IntVarBranch INT_VAR_ACTIVITY_SIZE_MIN(double d=1.0, BranchTbl tbl=NULL);
03819   IntVarBranch INT_VAR_ACTIVITY_SIZE_MIN(IntActivity a, BranchTbl tbl=NULL);
03821   IntVarBranch INT_VAR_ACTIVITY_SIZE_MAX(double d=1.0, BranchTbl tbl=NULL);
03823   IntVarBranch INT_VAR_ACTIVITY_SIZE_MAX(IntActivity a, BranchTbl tbl=NULL);
03829   IntVarBranch INT_VAR_REGRET_MIN_MIN(BranchTbl tbl=NULL);
03835   IntVarBranch INT_VAR_REGRET_MIN_MAX(BranchTbl tbl=NULL);
03841   IntVarBranch INT_VAR_REGRET_MAX_MIN(BranchTbl tbl=NULL);
03847   IntVarBranch INT_VAR_REGRET_MAX_MAX(BranchTbl tbl=NULL);
03849 
03850 }
03851 
03852 #include <gecode/int/branch/var.hpp>
03853 
03854 namespace Gecode {
03855 
03861   class IntValBranch : public ValBranch {
03862   public:
03864     enum Select {
03865       SEL_MIN,        
03866       SEL_MED,        
03867       SEL_MAX,        
03868       SEL_RND,        
03869       SEL_SPLIT_MIN,  
03870       SEL_SPLIT_MAX,  
03871       SEL_RANGE_MIN,  
03872       SEL_RANGE_MAX,  
03873       SEL_VAL_COMMIT, 
03874       SEL_VALUES_MIN, 
03875       SEL_VALUES_MAX, 
03876       SEL_NEAR_MIN,   
03877       SEL_NEAR_MAX,   
03878       SEL_NEAR_INC,   
03879       SEL_NEAR_DEC    
03880    };
03881   protected:
03883     IntSharedArray n;
03885     Select s;
03886   public:
03888     IntValBranch(Select s = SEL_MIN);
03890     IntValBranch(Rnd r);
03892     IntValBranch(VoidFunction v, VoidFunction c);
03894     IntValBranch(Select s, IntSharedArray n);
03896     Select select(void) const;
03898     IntSharedArray values(void) const;
03899   };
03900 
03906 
03907   IntValBranch INT_VAL_MIN(void);
03909   IntValBranch INT_VAL_MED(void);
03911   IntValBranch INT_VAL_MAX(void);
03913   IntValBranch INT_VAL_RND(Rnd r);
03915   IntValBranch INT_VAL_SPLIT_MIN(void);
03917   IntValBranch INT_VAL_SPLIT_MAX(void);
03919   IntValBranch INT_VAL_RANGE_MIN(void);
03921   IntValBranch INT_VAL_RANGE_MAX(void);
03928   IntValBranch INT_VAL(IntBranchVal v, IntBranchCommit c=NULL);
03935   IntValBranch INT_VAL(BoolBranchVal v, BoolBranchCommit c=NULL);
03937   IntValBranch INT_VALUES_MIN(void); 
03939   IntValBranch INT_VALUES_MAX(void);
03941   IntValBranch INT_VAL_NEAR_MIN(IntSharedArray n);
03943   IntValBranch INT_VAL_NEAR_MAX(IntSharedArray n);
03945   IntValBranch INT_VAL_NEAR_INC(IntSharedArray n);
03947   IntValBranch INT_VAL_NEAR_DEC(IntSharedArray n);
03949 
03950 }
03951 
03952 #include <gecode/int/branch/val.hpp>
03953 
03954 namespace Gecode {
03955 
03961   class IntAssign : public ValBranch {
03962   public:
03964     enum Select {
03965       SEL_MIN,       
03966       SEL_MED,       
03967       SEL_MAX,       
03968       SEL_RND,       
03969       SEL_VAL_COMMIT 
03970     };
03971   protected:
03973     Select s;
03974   public:
03976     IntAssign(Select s = SEL_MIN);
03978     IntAssign(Rnd r);
03980     IntAssign(VoidFunction v, VoidFunction c);
03982     Select select(void) const;
03983   };
03984 
03990 
03991   IntAssign INT_ASSIGN_MIN(void);
03993   IntAssign INT_ASSIGN_MED(void);
03995   IntAssign INT_ASSIGN_MAX(void);
03997   IntAssign INT_ASSIGN_RND(Rnd r);
04004   IntAssign INT_ASSIGN(IntBranchVal v, IntBranchCommit c=NULL);
04011   IntAssign INT_ASSIGN(BoolBranchVal v, BoolBranchCommit c=NULL);
04013 
04014 }
04015 
04016 #include <gecode/int/branch/assign.hpp>
04017 
04018 namespace Gecode {
04024   GECODE_INT_EXPORT BrancherHandle
04025   branch(Home home, const IntVarArgs& x,
04026          IntVarBranch vars, IntValBranch vals, 
04027          IntBranchFilter bf=NULL);
04033   GECODE_INT_EXPORT BrancherHandle
04034   branch(Home home, const IntVarArgs& x,
04035          TieBreak<IntVarBranch> vars, IntValBranch vals,
04036          IntBranchFilter bf=NULL);
04042   GECODE_INT_EXPORT BrancherHandle
04043   branch(Home home, IntVar x, IntValBranch vals);
04049   GECODE_INT_EXPORT BrancherHandle
04050   branch(Home home, const BoolVarArgs& x,
04051          IntVarBranch vars, IntValBranch vals,
04052          BoolBranchFilter bf=NULL);
04058   GECODE_INT_EXPORT BrancherHandle
04059   branch(Home home, const BoolVarArgs& x,
04060          TieBreak<IntVarBranch> vars, IntValBranch vals,
04061          BoolBranchFilter bf=NULL);
04067   GECODE_INT_EXPORT BrancherHandle
04068   branch(Home home, BoolVar x, IntValBranch vals);
04069 
04075   GECODE_INT_EXPORT BrancherHandle
04076   assign(Home home, const IntVarArgs& x, IntAssign vals,
04077          IntBranchFilter ibf=NULL);
04083   GECODE_INT_EXPORT BrancherHandle
04084   assign(Home home, IntVar x, IntAssign vals);
04090   GECODE_INT_EXPORT BrancherHandle
04091   assign(Home home, const BoolVarArgs& x, IntAssign vals,
04092          BoolBranchFilter bbf=NULL);
04098   GECODE_INT_EXPORT BrancherHandle
04099   assign(Home home, BoolVar x, IntAssign vals);
04100 
04101 }
04102 
04103 namespace Gecode {
04104 
04108   template<class Char, class Traits>
04109   std::basic_ostream<Char,Traits>&
04110   operator <<(std::basic_ostream<Char,Traits>& os, const DFA& d);
04111 
04115   template<class Char, class Traits>
04116   std::basic_ostream<Char,Traits>&
04117   operator <<(std::basic_ostream<Char,Traits>& os, const TupleSet& ts);
04118 
04119 }
04120 
04121 // LDSB-related declarations.
04122 namespace Gecode {
04123 
04124   namespace Int { namespace LDSB {
04125     class SymmetryObject;
04126   }}
04127 
04133   class GECODE_INT_EXPORT SymmetryHandle {
04134   public:
04136     Int::LDSB::SymmetryObject* ref;
04138     void increment(void);
04140     void decrement(void);
04141   public:
04143     SymmetryHandle(void);
04145     SymmetryHandle(Int::LDSB::SymmetryObject* o);
04147     SymmetryHandle(const SymmetryHandle& h);
04149     const SymmetryHandle& operator=(const SymmetryHandle& h);
04151     ~SymmetryHandle(void);
04152   };
04153   class Symmetries;
04155   template<>
04156   class ArrayTraits<ArgArray<SymmetryHandle> > {
04157   public:
04158     typedef Symmetries     StorageType;
04159     typedef SymmetryHandle ValueType;
04160     typedef Symmetries     ArgsType;
04161   };
04162 
04169 
04170   class Symmetries : public ArgArray<SymmetryHandle> {};
04171   // If this is instead a typedef, strange things happen with the
04172   // overloading of the "branch" function.
04173 
04175   GECODE_INT_EXPORT SymmetryHandle VariableSymmetry(const IntVarArgs& x);
04177   GECODE_INT_EXPORT SymmetryHandle VariableSymmetry(const BoolVarArgs& x);
04179   GECODE_INT_EXPORT SymmetryHandle VariableSymmetry(const IntVarArgs& x, 
04180                                                     const IntArgs& indices);
04182   GECODE_INT_EXPORT SymmetryHandle ValueSymmetry(const IntArgs& v);
04184   GECODE_INT_EXPORT SymmetryHandle ValueSymmetry(const IntSet& v);
04186   GECODE_INT_EXPORT SymmetryHandle ValueSymmetry(IntVar vars);
04192   GECODE_INT_EXPORT
04193   SymmetryHandle VariableSequenceSymmetry(const IntVarArgs& x, int ss);
04199   GECODE_INT_EXPORT
04200   SymmetryHandle VariableSequenceSymmetry(const BoolVarArgs& x, int ss);
04206   GECODE_INT_EXPORT
04207   SymmetryHandle ValueSequenceSymmetry(const IntArgs& v, int ss);
04208 
04210   GECODE_INT_EXPORT SymmetryHandle values_reflect(int lower, int upper);
04212   GECODE_INT_EXPORT SymmetryHandle values_reflect(IntVar x);
04214 
04226   GECODE_INT_EXPORT BrancherHandle
04227   branch(Home home, const IntVarArgs& x,
04228          IntVarBranch vars, IntValBranch vals,
04229          const Symmetries& syms, IntBranchFilter bf=NULL);
04241   GECODE_INT_EXPORT BrancherHandle
04242   branch(Home home, const IntVarArgs& x,
04243          TieBreak<IntVarBranch> vars, IntValBranch vals,
04244          const Symmetries& syms, IntBranchFilter bf=NULL);
04256   GECODE_INT_EXPORT BrancherHandle
04257   branch(Home home, const BoolVarArgs& x,
04258          IntVarBranch vars, IntValBranch vals,
04259          const Symmetries& syms, BoolBranchFilter bf=NULL);
04271   GECODE_INT_EXPORT BrancherHandle
04272   branch(Home home, const BoolVarArgs& x,
04273          TieBreak<IntVarBranch> vars, IntValBranch vals,
04274          const Symmetries& syms, BoolBranchFilter bf=NULL);
04275 }
04276 
04277 #endif
04278 
04279 // IFDEF: GECODE_HAS_INT_VARS
04280 // STATISTICS: int-post
04281