Generated on Mon May 5 05:53:52 2008 for Gecode by doxygen 1.5.5

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  *
00010  *  Copyright:
00011  *     Christian Schulte, 2002
00012  *     Guido Tack, 2004
00013  *
00014  *  Last modified:
00015  *     $Date: 2008-02-29 01:09:17 +0100 (Fri, 29 Feb 2008) $ by $Author: schulte $
00016  *     $Revision: 6355 $
00017  *
00018  *  This file is part of Gecode, the generic constraint
00019  *  development environment:
00020  *     http://www.gecode.org
00021  *
00022  *  Permission is hereby granted, free of charge, to any person obtaining
00023  *  a copy of this software and associated documentation files (the
00024  *  "Software"), to deal in the Software without restriction, including
00025  *  without limitation the rights to use, copy, modify, merge, publish,
00026  *  distribute, sublicense, and/or sell copies of the Software, and to
00027  *  permit persons to whom the Software is furnished to do so, subject to
00028  *  the following conditions:
00029  *
00030  *  The above copyright notice and this permission notice shall be
00031  *  included in all copies or substantial portions of the Software.
00032  *
00033  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00034  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00035  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00036  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00037  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00038  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00039  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00040  *
00041  */
00042 
00043 #ifndef __GECODE_INT_HH__
00044 #define __GECODE_INT_HH__
00045 
00046 #include <climits>
00047 #include <iostream>
00048 
00049 #include "gecode/kernel.hh"
00050 #include "gecode/iter.hh"
00051 
00052 /*
00053  * Configure linking
00054  *
00055  */
00056 #if !defined(GECODE_STATIC_LIBS) && \
00057     (defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER))
00058 
00059 #ifdef GECODE_BUILD_INT
00060 #define GECODE_INT_EXPORT __declspec( dllexport )
00061 #else
00062 #define GECODE_INT_EXPORT __declspec( dllimport )
00063 #endif
00064 
00065 #else
00066 
00067 #ifdef GECODE_GCC_HAS_CLASS_VISIBILITY
00068 #define GECODE_INT_EXPORT __attribute__ ((visibility("default")))
00069 #else
00070 #define GECODE_INT_EXPORT
00071 #endif
00072 
00073 #endif
00074 
00086 #include "gecode/int/exception.icc"
00087 
00088 namespace Gecode { namespace Int {
00089 
00097   namespace Limits {
00099     const int max =  INT_MAX - 1;
00101     const int min = -max;
00103     void check(int n, const char* l);
00105     void check(double n, const char* l);
00106   }
00107 
00108 }}
00109 
00110 #include "gecode/int/limits.icc"
00111 
00112 namespace Gecode {
00113 
00114   class IntSetRanges;
00115 
00123   class IntSet : public SharedHandle {
00124     friend class IntSetRanges;
00125   private:
00127     class Range {
00128     public:
00129       int min, max;
00130     };
00131     class IntSetObject : public SharedHandle::Object {
00132     public:
00134       int n;
00136       Range* r;
00138       GECODE_INT_EXPORT static IntSetObject* allocate(int m);
00140       GECODE_INT_EXPORT SharedHandle::Object* copy(void) const;
00142       GECODE_INT_EXPORT virtual ~IntSetObject(void);
00143     };
00145     class MinInc;
00147     GECODE_INT_EXPORT void normalize(Range* r, int n);
00149     GECODE_INT_EXPORT void init(int n, int m);
00151     GECODE_INT_EXPORT void init(const int r[], int n);
00153     GECODE_INT_EXPORT void init(const int r[][2], int n);
00154   public:
00156 
00157 
00158     IntSet(void);
00163     IntSet(int n, int m);
00165     IntSet(const int r[],   int n);
00171     IntSet(const int r[][2], int n);
00173     template <class I>
00174     explicit IntSet(I& i);
00176 
00178 
00179 
00180     int size(void) const;
00182 
00184 
00185 
00186     int min(int i) const;
00188     int max(int i) const;
00190     unsigned int width(int i) const;
00192 
00194 
00195 
00196     int min(void) const;
00198     int max(void) const;
00200 
00202 
00203 
00204     GECODE_INT_EXPORT static const IntSet empty;
00206   };
00207 
00213   class IntSetRanges {
00214   private:
00216     const IntSet::Range* i;
00218     const IntSet::Range* e;
00219   public:
00221 
00222 
00223     IntSetRanges(void);
00225     IntSetRanges(const IntSet& s);
00227     void init(const IntSet& s);
00229 
00231 
00232 
00233     bool operator()(void) const;
00235     void operator++(void);
00237 
00239 
00240 
00241     int min(void) const;
00243     int max(void) const;
00245     unsigned int width(void) const;
00247   };
00248 
00254   class IntSetValues : public Iter::Ranges::ToValues<IntSetRanges> {
00255   public:
00257 
00258 
00259     IntSetValues(void);
00261     IntSetValues(const IntSet& s);
00263     void init(const IntSet& s);
00265   };
00266 
00267 }
00268 
00273 GECODE_INT_EXPORT std::ostream&
00274 operator<<(std::ostream&, const Gecode::IntSet& s);
00275 
00276 #include "gecode/int/int-set.icc"
00277 
00278 #include "gecode/int/var-imp.icc"
00279 
00280 namespace Gecode {
00281 
00282   namespace Int {
00283     class IntView;
00284   }
00285 
00291   class IntVar : public VarBase<Int::IntVarImp> {
00292     friend class IntVarArray;
00293   private:
00294     using VarBase<Int::IntVarImp>::varimp;
00301     void _init(Space* home, int min, int max);
00308     void _init(Space* home, const IntSet& d);
00309   public:
00311 
00312 
00313     IntVar(void);
00315     IntVar(const IntVar& x);
00317     IntVar(const Int::IntView& x);
00319     IntVar(const Reflection::Var& x);
00331     GECODE_INT_EXPORT IntVar(Space* home, int min ,int max);
00343     GECODE_INT_EXPORT IntVar(Space* home, const IntSet& d);
00355     GECODE_INT_EXPORT void init(Space* home, int min, int max);
00367     GECODE_INT_EXPORT void init(Space* home, const IntSet& d);
00369 
00371 
00372 
00373     int min(void) const;
00375     int max(void) const;
00377     int med(void) const;
00379     int val(void) const;
00380 
00382     unsigned int size(void) const;
00384     unsigned int width(void) const;
00386 
00388 
00389 
00390     bool range(void) const;
00392     bool assigned(void) const;
00393 
00395     bool in(int n) const;
00397 
00399 
00400 
00401     void update(Space* home, bool share, IntVar& x);
00403   };
00404 
00405 
00410   class IntVarRanges : public Int::IntVarImpFwd {
00411   public:
00413 
00414 
00415     IntVarRanges(void);
00417     IntVarRanges(const IntVar& x);
00419     void init(const IntVar& x);
00421   };
00422 
00427   class IntVarValues : public Iter::Ranges::ToValues<IntVarRanges> {
00428   public:
00430 
00431 
00432     IntVarValues(void);
00434     IntVarValues(const IntVar& x);
00436     void init(const IntVar& x);
00438   };
00439 
00440   namespace Int {
00441     class BoolView;
00442   }
00443 
00449   class BoolVar : public VarBase<Int::BoolVarImp> {
00450     friend class BoolVarArray;
00451   private:
00452     using VarBase<Int::BoolVarImp>::varimp;
00459     void _init(Space* home, int min, int max);
00460   public:
00462 
00463 
00464     BoolVar(void);
00466     BoolVar(const BoolVar& x);
00468     BoolVar(const Int::BoolView& x);
00470     BoolVar(const Reflection::Var& x);
00482     GECODE_INT_EXPORT BoolVar(Space* home, int min, int max);
00494     GECODE_INT_EXPORT void init(Space* home, int min, int max);
00496 
00498 
00499 
00500     int min(void) const;
00502     int max(void) const;
00504     int med(void) const;
00506     int val(void) const;
00507 
00509     unsigned int size(void) const;
00511     unsigned int width(void) const;
00513 
00515 
00516 
00517     bool range(void) const;
00519     bool assigned(void) const;
00520 
00522     bool in(int n) const;
00524 
00526 
00527 
00528     bool zero(void) const;
00530     bool one(void) const;
00532     bool none(void) const;
00534 
00536 
00537 
00538     void update(Space* home, bool share, BoolVar& x);
00540     
00541   };
00542 
00543 }
00544 
00549 std::ostream&
00550 operator<<(std::ostream&, const Gecode::IntVar& x);
00555 std::ostream&
00556 operator<<(std::ostream&, const Gecode::BoolVar& x);
00557 
00558 #include "gecode/int/view.icc"
00559 #include "gecode/int/propagator.icc"
00560 
00561 namespace Gecode {
00562 
00572 
00573   typedef PrimArgArray<int>    IntArgs;
00575   typedef VarArgArray<IntVar>  IntVarArgs;
00577   typedef VarArgArray<BoolVar> BoolVarArgs;
00579   typedef PrimArgArray<IntSet> IntSetArgs;
00581 
00597   class IntVarArray : public VarArray<IntVar> {
00598   public:
00600 
00601 
00602     IntVarArray(void);
00604     IntVarArray(Space* home, int n);
00606     IntVarArray(const IntVarArray& a);
00618     GECODE_INT_EXPORT
00619     IntVarArray(Space* home, int n, int min, int max);
00631     GECODE_INT_EXPORT
00632     IntVarArray(Space* home, int n, const IntSet& s);
00634   };
00635 
00640   class BoolVarArray : public VarArray<BoolVar> {
00641   public:
00643 
00644 
00645     BoolVarArray(void);
00647     BoolVarArray(Space* home, int n);
00649     BoolVarArray(const BoolVarArray& a);
00661     GECODE_INT_EXPORT
00662     BoolVarArray(Space* home, int n, int min, int max);
00664   };
00665 
00666 }
00667 
00668 #include "gecode/int/array.icc"
00669 
00670 namespace Gecode {
00671 
00676   enum IntRelType {
00677     IRT_EQ, 
00678     IRT_NQ, 
00679     IRT_LQ, 
00680     IRT_LE, 
00681     IRT_GQ, 
00682     IRT_GR  
00683   };
00684 
00689   enum BoolOpType {
00690     BOT_AND, 
00691     BOT_OR,  
00692     BOT_IMP, 
00693     BOT_EQV, 
00694     BOT_XOR  
00695   };
00696 
00710   enum IntConLevel {
00711     ICL_VAL, 
00712     ICL_BND, 
00713     ICL_DOM, 
00714     ICL_DEF  
00715   };
00716 
00717 
00718 
00726 
00727   GECODE_INT_EXPORT void
00728   dom(Space* home, IntVar x, int l, int m,
00729       IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00731   GECODE_INT_EXPORT void
00732   dom(Space* home, const IntVarArgs& x, int l, int m,
00733       IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00734 
00736   GECODE_INT_EXPORT void
00737   dom(Space* home, IntVar x, const IntSet& s,
00738       IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00740   GECODE_INT_EXPORT void
00741   dom(Space* home, const IntVarArgs& x, const IntSet& s,
00742       IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00743 
00745   GECODE_INT_EXPORT void
00746   dom(Space* home, IntVar x, int l, int m, BoolVar b,
00747       IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00749   GECODE_INT_EXPORT void
00750   dom(Space* home, IntVar x, const IntSet& s, BoolVar b,
00751       IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00753 
00754 
00765   GECODE_INT_EXPORT void
00766   rel(Space* home, IntVar x0, IntRelType r, IntVar x1,
00767       IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00773   GECODE_INT_EXPORT void
00774   rel(Space* home, const IntVarArgs& x, IntRelType r, IntVar y,
00775       IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00777   GECODE_INT_EXPORT void
00778   rel(Space* home, IntVar x, IntRelType r, int c,
00779       IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00781   GECODE_INT_EXPORT void
00782   rel(Space* home, const IntVarArgs& x, IntRelType r, int c,
00783       IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00789   GECODE_INT_EXPORT void
00790   rel(Space* home, IntVar x0, IntRelType r, IntVar x1, BoolVar b,
00791       IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00797   GECODE_INT_EXPORT void
00798   rel(Space* home, IntVar x, IntRelType r, int c, BoolVar b,
00799       IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00817   GECODE_INT_EXPORT void
00818   rel(Space* home, const IntVarArgs& x, IntRelType r,
00819       IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00831   GECODE_INT_EXPORT void
00832   rel(Space* home, const IntVarArgs& x, IntRelType r, const IntVarArgs& y,
00833       IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00835 
00836 
00842 
00843   GECODE_INT_EXPORT void
00844   rel(Space* home, BoolVar x0, IntRelType r, BoolVar x1,
00845       IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00847   GECODE_INT_EXPORT void
00848   rel(Space* home, const BoolVarArgs& x, IntRelType r, BoolVar y,
00849       IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00856   GECODE_INT_EXPORT void
00857   rel(Space* home, BoolVar x, IntRelType r, int n,
00858       IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00865   GECODE_INT_EXPORT void
00866   rel(Space* home, const BoolVarArgs& x, IntRelType r, int n,
00867       IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00876   GECODE_INT_EXPORT void
00877   rel(Space* home, const BoolVarArgs& x, IntRelType r, const BoolVarArgs& y,
00878       IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00889   GECODE_INT_EXPORT void
00890   rel(Space* home, const BoolVarArgs& x, IntRelType r,
00891       IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00896   GECODE_INT_EXPORT void
00897   rel(Space* home, BoolVar x0, BoolOpType o, BoolVar x1, BoolVar x2, 
00898       IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00906   GECODE_INT_EXPORT void
00907   rel(Space* home, BoolVar x0, BoolOpType o, BoolVar x1, int n, 
00908       IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00917   GECODE_INT_EXPORT void
00918   rel(Space* home, BoolOpType o, const BoolVarArgs& x, BoolVar y,
00919       IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00931   GECODE_INT_EXPORT void
00932   rel(Space* home, BoolOpType o, const BoolVarArgs& x, int n,
00933       IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00935 
00936 
00948   GECODE_INT_EXPORT void
00949   element(Space* home, const IntArgs& n, IntVar x0, IntVar x1,
00950           IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00956   GECODE_INT_EXPORT void
00957   element(Space* home, const IntArgs& n, IntVar x0, BoolVar x1,
00958           IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00964   GECODE_INT_EXPORT void
00965   element(Space* home, const IntArgs& n, IntVar x0, int x1,
00966           IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00972   GECODE_INT_EXPORT void
00973   element(Space* home, const IntVarArgs& x, IntVar y0, IntVar y1,
00974           IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00980   GECODE_INT_EXPORT void
00981   element(Space* home, const IntVarArgs& x, IntVar y0, int y1,
00982           IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00984   GECODE_INT_EXPORT void
00985   element(Space* home, const BoolVarArgs& x, IntVar y0, BoolVar y1, 
00986           IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00988   GECODE_INT_EXPORT void
00989   element(Space* home, const BoolVarArgs& x, IntVar y0, int y1,
00990           IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
00992 
00993 
01008   GECODE_INT_EXPORT void
01009   distinct(Space* home, const IntVarArgs& x,
01010            IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01023   GECODE_INT_EXPORT void
01024   distinct(Space* home, const IntArgs& n, const IntVarArgs& x,
01025            IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01027 
01028 
01046   GECODE_INT_EXPORT void
01047   channel(Space* home, const IntVarArgs& x, const IntVarArgs& y,
01048           IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01049 
01051   GECODE_INT_EXPORT void
01052   channel(Space* home, BoolVar x0, IntVar x1,
01053           IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01055   forceinline void
01056   channel(Space* home, IntVar x0, BoolVar x1,
01057           IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF) {
01058     channel(home,x1,x0,icl,pk);
01059   }
01065   GECODE_INT_EXPORT void
01066   channel(Space* home, const BoolVarArgs& x, IntVar y, int o=0,
01067           IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01069 
01070 
01089   GECODE_INT_EXPORT void
01090   circuit(Space* home, const IntVarArgs& x, 
01091           IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01093 
01094 
01138   GECODE_INT_EXPORT void
01139   cumulatives(Space* home, const IntVarArgs& machine,
01140               const IntVarArgs& start, const IntVarArgs& duration,
01141               const IntVarArgs& end, const IntVarArgs& height,
01142               const IntArgs& limit, bool at_most, 
01143               IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01148   GECODE_INT_EXPORT void
01149   cumulatives(Space* home, const IntArgs& machine,
01150               const IntVarArgs& start, const IntVarArgs& duration,
01151               const IntVarArgs& end, const IntVarArgs& height,
01152               const IntArgs& limit, bool at_most, 
01153               IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01158   GECODE_INT_EXPORT void
01159   cumulatives(Space* home, const IntVarArgs& machine,
01160               const IntVarArgs& start, const IntArgs& duration,
01161               const IntVarArgs& end, const IntVarArgs& height,
01162               const IntArgs& limit, bool at_most, 
01163               IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01168   GECODE_INT_EXPORT void
01169   cumulatives(Space* home, const IntArgs& machine,
01170               const IntVarArgs& start, const IntArgs& duration,
01171               const IntVarArgs& end, const IntVarArgs& height,
01172               const IntArgs& limit, bool at_most, 
01173               IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01178   GECODE_INT_EXPORT void
01179   cumulatives(Space* home, const IntVarArgs& machine,
01180               const IntVarArgs& start, const IntVarArgs& duration,
01181               const IntVarArgs& end, const IntArgs& height,
01182               const IntArgs& limit, bool at_most, 
01183               IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01188   GECODE_INT_EXPORT void
01189   cumulatives(Space* home, const IntArgs& machine,
01190               const IntVarArgs& start, const IntVarArgs& duration,
01191               const IntVarArgs& end, const IntArgs& height,
01192               const IntArgs& limit, bool at_most, 
01193               IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01198   GECODE_INT_EXPORT void
01199   cumulatives(Space* home, const IntVarArgs& machine,
01200               const IntVarArgs& start, const IntArgs& duration,
01201               const IntVarArgs& end, const IntArgs& height,
01202               const IntArgs& limit, bool at_most, 
01203               IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01208   GECODE_INT_EXPORT void
01209   cumulatives(Space* home, const IntArgs& machine,
01210               const IntVarArgs& start, const IntArgs& duration,
01211               const IntVarArgs& end, const IntArgs& height,
01212               const IntArgs& limit, bool at_most, 
01213               IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01215 
01216 
01233   GECODE_INT_EXPORT void
01234   sorted(Space* home, const IntVarArgs& x, const IntVarArgs& y,
01235          IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01236 
01248   GECODE_INT_EXPORT void
01249   sorted(Space*, const IntVarArgs& x, const IntVarArgs& y,
01250          const IntVarArgs& z,
01251          IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01253 
01254 
01273   GECODE_INT_EXPORT void
01274   count(Space* home, const IntVarArgs& x, int n, IntRelType r, int m,
01275         IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01280   GECODE_INT_EXPORT void
01281   count(Space* home, const IntVarArgs& x, IntVar y, IntRelType r, int m,
01282         IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01290   GECODE_INT_EXPORT void
01291   count(Space* home, const IntVarArgs& x, const IntArgs& y, IntRelType r, int m,
01292         IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01297   GECODE_INT_EXPORT void
01298   count(Space* home, const IntVarArgs& x, int n, IntRelType r, IntVar z,
01299         IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01304   GECODE_INT_EXPORT void
01305   count(Space* home, const IntVarArgs& x, IntVar y, IntRelType r, IntVar z,
01306         IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01314   GECODE_INT_EXPORT void
01315   count(Space* home, const IntVarArgs& x, const IntArgs& y, IntRelType r, IntVar z,
01316         IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01317 
01331   GECODE_INT_EXPORT void
01332   count(Space* home, const IntVarArgs& x, const IntVarArgs& c,
01333         IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01334 
01348   GECODE_INT_EXPORT void
01349   count(Space* home, const IntVarArgs& x, const IntSetArgs& c,
01350         IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01351 
01368   GECODE_INT_EXPORT void
01369   count(Space* home, const IntVarArgs& x,
01370         const IntVarArgs& c, const IntArgs& v, 
01371         IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01372 
01389   GECODE_INT_EXPORT void
01390   count(Space* home, const IntVarArgs& x,
01391         const IntSetArgs& c, const IntArgs& v, 
01392         IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF); 
01393 
01410   GECODE_INT_EXPORT void
01411   count(Space* home, const IntVarArgs& x,
01412         const IntSet& c, const IntArgs& v,
01413         IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01414 
01416 
01429 
01437   class DFA : public SharedHandle {
01438   private:
01440     class DFAI;
01441   public:
01443     class Transition {
01444     public:
01445       int i_state; 
01446       int symbol;  
01447       int o_state; 
01448     };
01450     class Transitions {
01451     private:
01453       const Transition* c_trans;
01455       const Transition* e_trans;
01456     public:
01458       Transitions(const DFA& d);
01460       Transitions(const DFA& d, int n);
01462       bool operator()(void) const;
01464       void operator++(void);
01466       int i_state(void) const;
01468       int symbol(void) const;
01470       int o_state(void) const;
01471     };
01473     class Symbols {
01474     private:
01476       const Transition* c_trans;
01478       const Transition* e_trans;
01479     public:
01481       Symbols(const DFA& d);
01483       bool operator()(void) const;
01485       void operator++(void);
01487       int val(void) const;
01488     };
01489   public:
01490     friend class Transitions;
01492     DFA(void);
01504     GECODE_INT_EXPORT
01505     DFA(int s, Transition t[], int f[], bool minimize=true);
01507     DFA(const DFA& d);
01509     unsigned int n_states(void) const;
01511     unsigned int n_symbols(void) const;
01513     unsigned int n_transitions(void) const;
01515     int final_fst(void) const;
01517     int final_lst(void) const;
01519     int symbol_min(void) const;
01521     int symbol_max(void) const;
01522 
01524     GECODE_INT_EXPORT DFA(Reflection::VarMap& vm, Reflection::Arg* arg);
01526     GECODE_INT_EXPORT Reflection::Arg* spec(Reflection::VarMap& vm) const;
01527   };
01528 
01539   GECODE_INT_EXPORT void
01540   extensional(Space* home, const IntVarArgs& x, DFA d,
01541               IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01542 
01553   GECODE_INT_EXPORT void
01554   extensional(Space* home, const BoolVarArgs& x, DFA d,
01555               IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01556 
01563   class TupleSet : public SharedHandle {
01564   public:
01569     typedef int* Tuple;
01570 
01572     class TupleSetI;
01574     TupleSetI* implementation(void);
01575 
01577     TupleSet(void);
01579     TupleSet(const TupleSet& d);
01580 
01582     void add(const IntArgs& tuple);
01584     void finalize(void);
01586     bool finalized(void) const;
01588     int arity(void) const;
01590     int tuples(void) const;
01592     Tuple operator[](int i) const;
01594     int min(void) const;
01596     int max(void) const;
01597 
01599     GECODE_INT_EXPORT TupleSet(Reflection::VarMap& vm, Reflection::Arg* arg);
01601     GECODE_INT_EXPORT Reflection::Arg* spec(Reflection::VarMap& vm) const;
01602   };
01603  
01620   GECODE_INT_EXPORT void
01621   extensional(Space* home, const IntVarArgs& x, const TupleSet& t, 
01622               IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01623 
01632   GECODE_INT_EXPORT void
01633   extensional(Space* home, const BoolVarArgs& x, const TupleSet& t, 
01634               IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01636 }
01637 
01638 #include "gecode/int/extensional/dfa.icc"
01639 #include "gecode/int/extensional/tuple-set.icc"
01640 
01641 namespace Gecode {
01642 
01653   GECODE_INT_EXPORT void
01654   min(Space* home, IntVar x0, IntVar x1, IntVar x2,
01655       IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01660   GECODE_INT_EXPORT void
01661   min(Space* home, const IntVarArgs& x, IntVar y,
01662       IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01668   GECODE_INT_EXPORT void
01669   max(Space* home, IntVar x0, IntVar x1, IntVar x2,
01670       IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01676   GECODE_INT_EXPORT void
01677   max(Space* home, const IntVarArgs& x, IntVar y,
01678       IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01679 
01684   GECODE_INT_EXPORT void
01685   abs(Space* home, IntVar x0, IntVar x1,
01686       IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01687 
01692   GECODE_INT_EXPORT void
01693   mult(Space* home, IntVar x0, IntVar x1, IntVar x2,
01694        IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01695 
01700   GECODE_INT_EXPORT void
01701   sqr(Space* home, IntVar x0, IntVar x1,
01702       IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01703 
01708   GECODE_INT_EXPORT void
01709   sqrt(Space* home, IntVar x0, IntVar x1,
01710        IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01712 
01743 
01744   GECODE_INT_EXPORT void
01745   linear(Space* home, const IntVarArgs& x,
01746          IntRelType r, int c,
01747          IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01749   GECODE_INT_EXPORT void
01750   linear(Space* home, const IntVarArgs& x,
01751          IntRelType r, IntVar y,
01752          IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01754   GECODE_INT_EXPORT void
01755   linear(Space* home, const IntVarArgs& x,
01756          IntRelType r, int c, BoolVar b, 
01757          IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01759   GECODE_INT_EXPORT void
01760   linear(Space* home, const IntVarArgs& x,
01761          IntRelType r, IntVar y, BoolVar b, 
01762          IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01768   GECODE_INT_EXPORT void
01769   linear(Space* home, const IntArgs& a, const IntVarArgs& x,
01770          IntRelType r, int c,
01771          IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01777   GECODE_INT_EXPORT void
01778   linear(Space* home, const IntArgs& a, const IntVarArgs& x,
01779          IntRelType r, IntVar y,
01780          IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01786   GECODE_INT_EXPORT void
01787   linear(Space* home, const IntArgs& a, const IntVarArgs& x,
01788          IntRelType r, int c, BoolVar b,
01789          IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01795   GECODE_INT_EXPORT void
01796   linear(Space* home, const IntArgs& a, const IntVarArgs& x,
01797          IntRelType r, IntVar y, BoolVar b,
01798          IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01800 
01801 
01827 
01828   GECODE_INT_EXPORT void
01829   linear(Space* home, const BoolVarArgs& x,
01830          IntRelType r, int c,
01831          IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01833   GECODE_INT_EXPORT void
01834   linear(Space* home, const BoolVarArgs& x,
01835          IntRelType r, int c, BoolVar b,
01836          IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01838   GECODE_INT_EXPORT void
01839   linear(Space* home, const BoolVarArgs& x,
01840          IntRelType r, IntVar y,
01841          IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01843   GECODE_INT_EXPORT void
01844   linear(Space* home, const BoolVarArgs& x,
01845          IntRelType r, IntVar y, BoolVar b,
01846          IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01852   GECODE_INT_EXPORT void
01853   linear(Space* home, const IntArgs& a, const BoolVarArgs& x,
01854          IntRelType r, int c,
01855          IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01861   GECODE_INT_EXPORT void
01862   linear(Space* home, const IntArgs& a, const BoolVarArgs& x,
01863          IntRelType r, int c, BoolVar b,
01864          IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01870   GECODE_INT_EXPORT void
01871   linear(Space* home, const IntArgs& a, const BoolVarArgs& x,
01872          IntRelType r, IntVar y,
01873          IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01879   GECODE_INT_EXPORT void
01880   linear(Space* home, const IntArgs& a, const BoolVarArgs& x,
01881          IntRelType r, IntVar y, BoolVar b,
01882          IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01884 
01885 
01910   GECODE_INT_EXPORT void
01911   unshare(Space* home, IntVarArgs& x,
01912           IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01914   GECODE_INT_EXPORT void
01915   unshare(Space* home, BoolVarArgs& x,
01916           IntConLevel icl=ICL_DEF, PropKind pk=PK_DEF);
01918 
01919 
01926 
01927   enum IntVarBranch {
01928     INT_VAR_NONE,            
01929     INT_VAR_MIN_MIN,         
01930     INT_VAR_MIN_MAX,         
01931     INT_VAR_MAX_MIN,         
01932     INT_VAR_MAX_MAX,         
01933     INT_VAR_SIZE_MIN,        
01934     INT_VAR_SIZE_MAX,        
01935 
01941     INT_VAR_DEGREE_MIN,
01948     INT_VAR_DEGREE_MAX,
01949     INT_VAR_SIZE_DEGREE_MIN, 
01950     INT_VAR_SIZE_DEGREE_MAX, 
01951 
01956     INT_VAR_REGRET_MIN_MIN,
01962     INT_VAR_REGRET_MIN_MAX,
01968     INT_VAR_REGRET_MAX_MIN,
01974     INT_VAR_REGRET_MAX_MAX
01975   };
01976 
01978   enum IntValBranch {
01979     INT_VAL_MIN,       
01980     INT_VAL_MED,       
01981     INT_VAL_MAX,       
01982     INT_VAL_SPLIT_MIN, 
01983     INT_VAL_SPLIT_MAX  
01984   };
01985 
01987   GECODE_INT_EXPORT void
01988   branch(Space* home, const IntVarArgs& x, 
01989          IntVarBranch vars, IntValBranch vals);
01991   GECODE_INT_EXPORT void
01992   branch(Space* home, const BoolVarArgs& x, 
01993          IntVarBranch vars, IntValBranch vals);
01995 
02001 
02002   enum IntAssign {
02003     INT_ASSIGN_MIN, 
02004     INT_ASSIGN_MED, 
02005     INT_ASSIGN_MAX  
02006   };
02007 
02009   GECODE_INT_EXPORT void
02010   assign(Space* home, const IntVarArgs& x, IntAssign vals);
02012   GECODE_INT_EXPORT void
02013   assign(Space* home, const BoolVarArgs& x, IntAssign vals);
02014 
02016 
02017 }
02018 
02022 GECODE_INT_EXPORT std::ostream&
02023 operator<<(std::ostream&, const Gecode::DFA& d);
02024 
02028 GECODE_INT_EXPORT std::ostream&
02029 operator<<(std::ostream&, const Gecode::TupleSet& ts);
02030 
02031 #endif
02032 
02033 // IFDEF: GECODE_HAS_INT_VARS
02034 // STATISTICS: int-post
02035