46 #ifndef __GECODE_INT_HH__
47 #define __GECODE_INT_HH__
62 #if !defined(GECODE_STATIC_LIBS) && \
63 (defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER))
65 #ifdef GECODE_BUILD_INT
66 #define GECODE_INT_EXPORT __declspec( dllexport )
68 #define GECODE_INT_EXPORT __declspec( dllimport )
73 #ifdef GECODE_GCC_HAS_CLASS_VISIBILITY
74 #define GECODE_INT_EXPORT __attribute__ ((visibility("default")))
76 #define GECODE_INT_EXPORT
82 #ifndef GECODE_BUILD_INT
83 #define GECODE_LIBRARY_NAME "Int"
100 namespace Gecode {
namespace Int {
111 const int max = INT_MAX - 1;
117 const long long int llmax = LLONG_MAX - 1;
125 bool valid(
long long int n);
127 void check(
int n,
const char*
l);
129 void check(
long long int n,
const char*
l);
133 void positive(
long long int n,
const char*
l);
160 template<
class I>
class IntSetInit;
236 int min(
int i)
const;
238 int max(
int i)
const;
240 unsigned int width(
int i)
const;
246 bool in(
int n)
const;
248 unsigned int size(
void)
const;
250 unsigned int width(
void)
const;
272 const IntSet::Range* i;
274 const IntSet::Range* e;
301 unsigned int width(
void)
const;
327 template<
class Char,
class Traits>
328 std::basic_ostream<Char,Traits>&
329 operator <<(std::basic_ostream<Char,Traits>& os,
const IntSet& s);
420 unsigned int size(
void)
const;
422 unsigned int width(
void)
const;
432 bool range(
void)
const;
434 bool in(
int n)
const;
442 template<
class Char,
class Traits>
443 std::basic_ostream<Char,Traits>&
444 operator <<(std::basic_ostream<Char,Traits>& os,
const IntVar&
x);
542 unsigned int size(
void)
const;
544 unsigned int width(
void)
const;
554 bool range(
void)
const;
556 bool in(
int n)
const;
562 bool zero(
void)
const;
564 bool one(
void)
const;
566 bool none(
void)
const;
574 template<
class Char,
class Traits>
575 std::basic_ostream<Char,Traits>&
576 operator <<(std::basic_ostream<Char,Traits>& os,
const BoolVar&
x);
616 IntArgs(
const std::vector<int>& x);
618 template<
class InputIterator>
619 IntArgs(InputIterator first, InputIterator last);
629 static IntArgs
create(
int n,
int start,
int inc=1);
649 template<
class InputIterator>
704 template<
class InputIterator>
1544 channel(Home home,
const BoolVarArgs&
x, IntVar y,
int o=0,
1566 sorted(Home home,
const IntVarArgs&
x,
const IntVarArgs& y,
1581 sorted(Home home,
const IntVarArgs&
x,
const IntVarArgs& y,
1582 const IntVarArgs& z,
1613 count(Home home,
const IntVarArgs&
x,
const IntSet& y,
IntRelType irt,
int m,
1633 count(Home home,
const IntVarArgs&
x,
const IntArgs& y,
IntRelType irt,
int m,
1647 count(Home home,
const IntVarArgs&
x,
const IntSet& y,
IntRelType irt, IntVar z,
1667 count(Home home,
const IntVarArgs&
x,
const IntArgs& y,
IntRelType irt, IntVar z,
1684 count(Home home,
const IntVarArgs&
x,
const IntVarArgs&
c,
1721 count(Home home,
const IntVarArgs&
x,
1722 const IntVarArgs&
c,
const IntArgs&
v,
1742 count(Home home,
const IntVarArgs&
x,
1763 count(Home home,
const IntVarArgs&
x,
1764 const IntSet&
c,
const IntArgs&
v,
1827 sequence(Home home,
const IntVarArgs&
x,
const IntSet& s,
1845 sequence(Home home,
const BoolVarArgs&
x,
const IntSet& s,
1884 Transition(
int i_state0,
int symbol0,
int o_state0);
1924 int val(
void)
const;
2079 int arity(
void)
const;
2085 int min(
void)
const;
2087 int max(
void)
const;
2146 min(Home home, IntVar x0, IntVar x1, IntVar x2,
2156 min(Home home,
const IntVarArgs&
x, IntVar y,
2164 max(Home home, IntVar x0, IntVar x1, IntVar x2,
2174 max(Home home,
const IntVarArgs&
x, IntVar y,
2183 abs(Home home, IntVar x0, IntVar x1,
2192 mult(Home home, IntVar x0, IntVar x1, IntVar x2,
2200 divmod(Home home, IntVar x0, IntVar x1, IntVar x2, IntVar x3,
2208 div(Home home, IntVar x0, IntVar x1, IntVar x2,
2216 mod(Home home, IntVar x0, IntVar x1, IntVar x2,
2225 sqr(Home home, IntVar x0, IntVar x1,
2234 sqrt(Home home, IntVar x0, IntVar x1,
2246 pow(Home home, IntVar x0,
int n, IntVar x1,
2258 nroot(Home home, IntVar x0,
int n, IntVar x1,
2295 linear(Home home,
const IntVarArgs&
x,
2302 linear(Home home,
const IntVarArgs&
x,
2309 linear(Home home,
const IntVarArgs&
x,
2316 linear(Home home,
const IntVarArgs&
x,
2326 linear(Home home,
const IntArgs&
a,
const IntVarArgs&
x,
2336 linear(Home home,
const IntArgs&
a,
const IntVarArgs&
x,
2346 linear(Home home,
const IntArgs&
a,
const IntVarArgs&
x,
2356 linear(Home home,
const IntArgs&
a,
const IntVarArgs&
x,
2389 linear(Home home,
const BoolVarArgs&
x,
2396 linear(Home home,
const BoolVarArgs&
x,
2403 linear(Home home,
const BoolVarArgs&
x,
2410 linear(Home home,
const BoolVarArgs&
x,
2420 linear(Home home,
const IntArgs&
a,
const BoolVarArgs&
x,
2430 linear(Home home,
const IntArgs&
a,
const BoolVarArgs&
x,
2440 linear(Home home,
const IntArgs&
a,
const BoolVarArgs&
x,
2450 linear(Home home,
const IntArgs&
a,
const BoolVarArgs&
x,
2483 const IntVarArgs&
l,
2484 const IntVarArgs&
b,
const IntArgs& s,
2506 const IntVarArgs&
x,
const IntArgs& w,
2507 const IntVarArgs& y,
const IntArgs& h,
2524 const IntVarArgs&
x,
const IntArgs& w,
2525 const IntVarArgs& y,
const IntArgs& h,
2526 const BoolVarArgs& o,
2546 const IntVarArgs& x0,
const IntVarArgs& w,
const IntVarArgs& x1,
2547 const IntVarArgs& y0,
const IntVarArgs& h,
const IntVarArgs& y1,
2568 const IntVarArgs& x0,
const IntVarArgs& w,
const IntVarArgs& x1,
2569 const IntVarArgs& y0,
const IntVarArgs& h,
const IntVarArgs& y1,
2570 const BoolVarArgs& o,
2624 const IntVarArgs& s,
const IntVarArgs&
p,
2625 const IntVarArgs& e,
const IntVarArgs&
u,
2626 const IntArgs&
c,
bool at_most,
2634 const IntVarArgs& s,
const IntVarArgs&
p,
2635 const IntVarArgs& e,
const IntVarArgs&
u,
2636 const IntArgs&
c,
bool at_most,
2644 const IntVarArgs& s,
const IntArgs&
p,
2645 const IntVarArgs& e,
const IntVarArgs&
u,
2646 const IntArgs&
c,
bool at_most,
2654 const IntVarArgs& s,
const IntArgs&
p,
2655 const IntVarArgs& e,
const IntVarArgs&
u,
2656 const IntArgs&
c,
bool at_most,
2664 const IntVarArgs& s,
const IntVarArgs&
p,
2665 const IntVarArgs& e,
const IntArgs&
u,
2666 const IntArgs&
c,
bool at_most,
2674 const IntVarArgs& s,
const IntVarArgs&
p,
2675 const IntVarArgs& e,
const IntArgs&
u,
2676 const IntArgs&
c,
bool at_most,
2684 const IntVarArgs& s,
const IntArgs&
p,
2685 const IntVarArgs& e,
const IntArgs&
u,
2686 const IntArgs&
c,
bool at_most,
2694 const IntVarArgs& s,
const IntArgs&
p,
2695 const IntVarArgs& e,
const IntArgs&
u,
2696 const IntArgs&
c,
bool at_most,
2718 unary(Home home,
const IntVarArgs& s,
const IntArgs&
p,
2742 unary(Home home,
const IntVarArgs& s,
const IntArgs&
p,
2809 const IntVarArgs& flex,
const IntArgs& fix,
2832 unary(Home home,
const IntVarArgs& s,
const IntVarArgs&
p,
2857 unary(Home home,
const IntVarArgs& s,
const IntVarArgs&
p,
2896 const IntVarArgs& flex,
const IntArgs& fix,
const IntArgs&
u,
2906 const IntVarArgs& flex,
const IntArgs& fix,
const IntArgs&
u,
2947 const IntVarArgs& flex,
const IntArgs& fix,
const IntArgs&
u,
2955 const IntVarArgs& flex,
const IntArgs& fix,
const IntArgs&
u,
2983 cumulative(Home home,
int c,
const IntVarArgs& s,
const IntArgs&
p,
2990 cumulative(Home home, IntVar
c,
const IntVarArgs& s,
const IntArgs&
p,
3020 cumulative(Home home,
int c,
const IntVarArgs& s,
const IntArgs&
p,
3027 cumulative(Home home, IntVar
c,
const IntVarArgs& s,
const IntArgs&
p,
3059 cumulative(Home home,
int c,
const IntVarArgs& s,
const IntVarArgs&
p,
3066 cumulative(Home home, IntVar
c,
const IntVarArgs& s,
const IntVarArgs&
p,
3100 cumulative(Home home,
int c,
const IntVarArgs& s,
const IntVarArgs&
p,
3101 const IntVarArgs& e,
const IntArgs&
u,
const BoolVarArgs& m,
3108 cumulative(Home home, IntVar
c,
const IntVarArgs& s,
const IntVarArgs&
p,
3109 const IntVarArgs& e,
const IntArgs&
u,
const BoolVarArgs& m,
3134 circuit(Home home,
const IntVarArgs&
x,
3152 circuit(Home home,
int offset,
const IntVarArgs&
x,
3178 const IntVarArgs&
x,
const IntVarArgs& y, IntVar z,
3204 const IntArgs&
c,
int offset,
3205 const IntVarArgs&
x,
const IntVarArgs& y, IntVar z,
3228 const IntVarArgs&
x, IntVar z,
3252 const IntArgs&
c,
int offset,
3253 const IntVarArgs&
x, IntVar z,
3271 path(Home home,
const IntVarArgs&
x, IntVar s, IntVar e,
3291 path(Home home,
int offset,
const IntVarArgs&
x, IntVar s, IntVar e,
3318 const IntVarArgs&
x, IntVar s, IntVar e,
const IntVarArgs& y, IntVar z,
3346 const IntArgs&
c,
int offset,
3347 const IntVarArgs&
x, IntVar s, IntVar e,
const IntVarArgs& y, IntVar z,
3372 const IntVarArgs&
x, IntVar s, IntVar e, IntVar z,
3398 const IntArgs&
c,
int offset,
3399 const IntVarArgs&
x, IntVar s, IntVar e, IntVar z,
3415 wait(Home home, IntVar
x,
void (*
c)(Space& home),
3419 wait(Home home, BoolVar x,
void (*
c)(Space& home),
3423 wait(Home home,
const IntVarArgs& x,
void (*
c)(Space& home),
3427 wait(Home home,
const BoolVarArgs& x,
void (*
c)(Space& home),
3431 when(Home home, BoolVar x,
3432 void (*
t)(Space& home),
void (*e)(Space& home)= NULL,
3462 unshare(Home home, IntVarArgs& x,
3466 unshare(Home home, BoolVarArgs& x,
4025 branch(Home home,
const IntVarArgs& x,
4026 IntVarBranch vars, IntValBranch vals,
4034 branch(Home home,
const IntVarArgs& x,
4035 TieBreak<IntVarBranch> vars, IntValBranch vals,
4043 branch(Home home, IntVar x, IntValBranch vals);
4050 branch(Home home,
const BoolVarArgs& x,
4051 IntVarBranch vars, IntValBranch vals,
4059 branch(Home home,
const BoolVarArgs& x,
4060 TieBreak<IntVarBranch> vars, IntValBranch vals,
4068 branch(Home home, BoolVar x, IntValBranch vals);
4076 assign(Home home,
const IntVarArgs& x, IntAssign vals,
4084 assign(Home home, IntVar x, IntAssign vals);
4091 assign(Home home,
const BoolVarArgs& x, IntAssign vals,
4099 assign(Home home, BoolVar x, IntAssign vals);
4108 template<
class Char,
class Traits>
4109 std::basic_ostream<Char,Traits>&
4110 operator <<(std::basic_ostream<Char,Traits>& os,
const DFA&
d);
4115 template<
class Char,
class Traits>
4116 std::basic_ostream<Char,Traits>&
4117 operator <<(std::basic_ostream<Char,Traits>& os,
const TupleSet& ts);
4124 namespace Int {
namespace LDSB {
4125 class SymmetryObject;
4138 void increment(
void);
4140 void decrement(
void);