48 #ifndef __GECODE_INT_HH__ 49 #define __GECODE_INT_HH__ 64 #if !defined(GECODE_STATIC_LIBS) && \ 65 (defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER)) 67 #ifdef GECODE_BUILD_INT 68 #define GECODE_INT_EXPORT __declspec( dllexport ) 70 #define GECODE_INT_EXPORT __declspec( dllimport ) 75 #ifdef GECODE_GCC_HAS_CLASS_VISIBILITY 76 #define GECODE_INT_EXPORT __attribute__ ((visibility("default"))) 78 #define GECODE_INT_EXPORT 84 #ifndef GECODE_BUILD_INT 85 #define GECODE_LIBRARY_NAME "Int" 102 namespace Gecode {
namespace Int {
113 const int max = INT_MAX - 1;
119 const long long int llmax = LLONG_MAX - 1;
127 bool valid(
long long int n);
129 void check(
int n,
const char*
l);
131 void check(
long long int n,
const char*
l);
135 void positive(
long long int n,
const char*
l);
235 int ranges(
void)
const;
238 int min(
int i)
const;
240 int max(
int i)
const;
242 unsigned int width(
int i)
const;
247 bool in(
int n)
const;
250 unsigned int size(
void)
const;
252 unsigned int width(
void)
const;
274 const IntSet::Range*
i;
276 const IntSet::Range* e;
285 void init(
const IntSet& s);
290 bool operator ()(
void)
const;
293 void operator ++(
void);
303 unsigned int width(
void)
const;
321 void init(
const IntSet& s);
329 template<
class Char,
class Traits>
330 std::basic_ostream<Char,Traits>&
331 operator <<(std::basic_ostream<Char,Traits>& os,
const IntSet& s);
422 unsigned int size(
void)
const;
424 unsigned int width(
void)
const;
426 unsigned int regret_min(
void)
const;
428 unsigned int regret_max(
void)
const;
433 bool range(
void)
const;
436 bool in(
int n)
const;
444 template<
class Char,
class Traits>
445 std::basic_ostream<Char,Traits>&
446 operator <<(std::basic_ostream<Char,Traits>& os,
const IntVar&
x);
461 void init(
const IntVar& x);
478 void init(
const IntVar& x);
544 unsigned int size(
void)
const;
546 unsigned int width(
void)
const;
548 unsigned int regret_min(
void)
const;
550 unsigned int regret_max(
void)
const;
555 bool range(
void)
const;
558 bool in(
int n)
const;
563 bool zero(
void)
const;
566 bool one(
void)
const;
568 bool none(
void)
const;
576 template<
class Char,
class Traits>
577 std::basic_ostream<Char,Traits>&
578 operator <<(std::basic_ostream<Char,Traits>& os,
const BoolVar&
x);
618 IntArgs(
const std::vector<int>& x);
620 template<
class InputIterator>
621 IntArgs(InputIterator first, InputIterator last);
626 IntArgs(
int n,
const int* e);
631 static IntArgs create(
int n,
int start,
int inc=1);
651 template<
class InputIterator>
706 template<
class InputIterator>
1895 Transition(
int i_state0,
int symbol0,
int o_state0);
1910 bool operator ()(
void)
const;
1912 void operator ++(
void);
1914 int i_state(
void)
const;
1916 int symbol(
void)
const;
1918 int o_state(
void)
const;
1931 bool operator ()(
void)
const;
1933 void operator ++(
void);
1935 int val(
void)
const;
1957 int n_states(
void)
const;
1959 int n_transitions(
void)
const;
1961 unsigned int n_symbols(
void)
const;
1963 unsigned int max_degree(
void)
const;
1965 int final_fst(
void)
const;
1967 int final_lst(
void)
const;
1969 int symbol_min(
void)
const;
1971 int symbol_max(
void)
const;
2066 bool finalized(
void)
const;
2084 void add(
const IntArgs& tuple);
2086 void finalize(
void);
2088 bool finalized(
void)
const;
2090 int arity(
void)
const;
2092 int tuples(
void)
const;
2094 Tuple operator [](
int i)
const;
2096 int min(
void)
const;
2098 int max(
void)
const;
3513 void (*
t)(
Space& home),
void (*e)(
Space& home)= NULL,
3868 Select select(
void)
const;
4016 Select select(
void)
const;
4102 Select select(
void)
const;
4238 template<
class Char,
class Traits>
4239 std::basic_ostream<Char,Traits>&
4240 operator <<(std::basic_ostream<Char,Traits>& os,
const DFA&
d);
4245 template<
class Char,
class Traits>
4246 std::basic_ostream<Char,Traits>&
4247 operator <<(std::basic_ostream<Char,Traits>& os,
const TupleSet& ts);
4254 namespace Int {
namespace LDSB {
4268 void increment(
void);
4270 void decrement(
void);
Value iterator for integer variables.
With smallest accumulated failure count.
IntVarBranch INT_VAR_DEGREE_SIZE_MIN(BranchTbl tbl)
Select variable with smallest degree divided by domain size.
IntValBranch INT_VAL_RANGE_MIN(void)
Select the smallest range of the variable domain if it has several ranges, otherwise select values no...
IntVarArgs(const VarArray< IntVar > &a)
Initialize from variable array a (copy elements)
void cumulative(Home home, Cap c, const TaskTypeArgs &t, const IntVarArgs &s, const IntArgs &p, const IntArgs &u, IntConLevel icl)
Variables as interfaces to variable implementations.
IntVarBranch INT_VAR_NONE(void)
Select first unassigned variable.
bool(* BoolBranchFilter)(const Space &home, BoolVar x, int i)
Branch filter function type for Boolean variables.
Combine variable selection criteria for tie-breaking.
IntVarBranch INT_VAR_MERIT_MAX(IntBranchMerit bm, BranchTbl tbl)
Select variable with highest merit according to branch merit function bm.
Select s
Which variable to select.
IntConLevel
Consistency levels for integer propagators.
void mult(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
void linear(Home home, const FloatVarArgs &x, FloatRelType frt, FloatNum c)
Post propagator for .
TaskType
Type of task for scheduling constraints.
Inverse implication for reification.
With smallest activity divided by domain size.
void mod(Home home, IntVar x0, IntVar x1, IntVar x2, IntConLevel icl)
Post propagator for .
Range iterator for integer sets.
BoolVarArgs(const VarArray< BoolVar > &a)
Initialize from variable array a (copy elements)
Iterator for DFA symbols.
void channel(Home home, FloatVar x0, IntVar x1)
Post propagator for channeling a float and an integer variable .
IntVarBranch INT_VAR_DEGREE_SIZE_MAX(BranchTbl tbl)
Select variable with largest degree divided by domain size.
bool one(const Gecode::FloatValArgs &a)
Check whether has only one coefficients.
Select
Which value selection.
Argument array for primtive types.
BoolOpType
Operation types for Booleans.
Which values to select for branching first.
BoolVarArgs(const BoolVarArgs &a)
Initialize from variable argument array a (copy elements)
int(* BoolBranchVal)(const Space &home, BoolVar x, int i)
Branch value function type for Boolean variables.
Which variable to select for branching.
int excess
Excess storage.
Value propagation or consistency (naive)
IntVarBranch INT_VAR_REGRET_MAX_MAX(BranchTbl tbl)
Select variable with largest max-regret.
With largest accumulated failure count.
void abs(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
IntAssign INT_ASSIGN_MED(void)
Select greatest value not greater than the median.
void nroot(Home home, FloatVar x0, int n, FloatVar x1)
Post propagator for for $n 0$.
void pow(Home home, FloatVar x0, int n, FloatVar x1)
Post propagator for for $n 0$.
Select value nearest to a given value, use smaller one in case of ties.
bool normalize(Term< View > *t, int &n, Term< View > *&t_p, int &n_p, Term< View > *&t_n, int &n_n, int &g)
Normalize linear integer constraints.
With largest accumulated failure count divided by domain size.
int * Tuple
Type of a tuple.
BoolVarArgs(const std::vector< BoolVar > &a)
Initialize from vector a.
void dom(Home home, FloatVar x, FloatVal n)
Propagates .
Collection of symmetries.
IntVarBranch INT_VAR_SIZE_MIN(BranchTbl tbl)
Select variable with smallest domain size.
IntVarBranch INT_VAR_MIN_MIN(BranchTbl tbl)
Select variable with smallest min.
IntVarBranch INT_VAR_REGRET_MAX_MIN(BranchTbl tbl)
Select variable with smallest max-regret.
Implementation of a symmetry at the modelling level.
IntValBranch INT_VAL_RANGE_MAX(void)
Select the largest range of the variable domain if it has several ranges, otherwise select values gre...
void nonnegative(int n, const char *l)
Check whether n is in range and nonnegative, otherwise throw out of limits with information l...
IntVarArgs(InputIterator first, InputIterator last)
Initialize from InputIterator first and last.
Select the smallest range of the variable domain if it has several ranges, otherwise select values no...
With largest activity divided by domain size.
void(* BoolVarValPrint)(const Space &home, const BrancherHandle &bh, unsigned int a, BoolVar x, int i, const int &n, std::ostream &o)
Function type for printing branching alternatives for Boolean variables.
IntVarArgs(const std::vector< IntVar > &a)
Initialize from vector a.
void path(Home home, int offset, const IntVarArgs &x, IntVar s, IntVar e, IntConLevel icl)
Post propagator such that x forms a Hamiltonian path.
IntVarBranch INT_VAR_ACTIVITY_MAX(double d, BranchTbl tbl)
Select variable with highest activity with decay factor d.
Select s
Which value to select.
bool(* IntBranchFilter)(const Space &home, IntVar x, int i)
Branch filter function type for integer variables.
ArgArray< IntSet > IntSetArgs
Passing set arguments.
const int max
Largest allowed integer value.
Select s
Which value to select.
const int min
Smallest allowed integer value.
double(* IntBranchMerit)(const Space &home, IntVar x, int i)
Branch merit function type for integer variables.
IntVarBranch INT_VAR_REGRET_MIN_MAX(BranchTbl tbl)
Select variable with largest min-regret.
IntVarArgs(int n)
Allocate array with n elements.
void argmin(Home home, const IntVarArgs &x, IntVar y, bool tiebreak, IntConLevel)
Post propagator for .
int(* IntBranchVal)(const Space &home, IntVar x, int i)
Branch value function type for integer variables.
Range iterator for integer variables
IntAssign INT_ASSIGN_MIN(void)
Select smallest value.
IntValBranch INT_VAL_RND(Rnd r)
Select random value.
Select value nearest to a given value, use larger one in case of ties.
bool overflow_mul(int n, int m)
Check whether multiplying n and m would overflow.
std::string expand(Gecode::IntRelType irt)
Expand relation to abbreviation.
Reify imp(BoolVar x)
Use implication for reification.
void sequence(Home home, const IntVarArgs &x, const IntSet &s, int q, int l, int u, IntConLevel)
Post propagator for .
void argmax(Home home, const IntVarArgs &x, IntVar y, bool tiebreak, IntConLevel)
Post propagator for .
Gecode::FloatVal c(-8, 8)
void when(Home home, BoolVar x, void(*t)(Space &home), void(*e)(Space &home), IntConLevel)
Execute t (then) when x is assigned one, and e (else) otherwise.
SymmetryHandle VariableSymmetry(const IntVarArgs &vars)
Variables in x are interchangeable.
Deterministic finite automaton (DFA)
int p
Number of positive literals for node type.
With smallest max-regret.
IntVarBranch INT_VAR_AFC_MAX(double d, BranchTbl tbl)
Select variable with largest accumulated failure count with decay factor d.
Gecode::IntArgs i(4, 1, 2, 3, 4)
Class for AFC (accumulated failure count) management.
int n
Number of negative literals for node type.
IntVarBranch INT_VAR_DEGREE_MAX(BranchTbl tbl)
Select variable with largest degree.
const long long int llmin
Smallest allowed long long integer value.
Select all values starting from largest.
IntVarBranch INT_VAR_ACTIVITY_MIN(double d, BranchTbl tbl)
Select variable with lowest activity with decay factor d.
Tuple ** last
Initial last structure.
Prefer speed over memory consumption.
With smallest min-regret.
A reference-counted pointer to a SymmetryObject.
IntAssign INT_ASSIGN_RND(Rnd r)
Select random value.
IntRelType
Relation types for integers.
SymmetryHandle ValueSequenceSymmetry(const IntArgs &vs, int ss)
Value sequences in v of size ss are interchangeable.
Select greatest value not greater than the median.
void sqr(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
void(* IntBranchCommit)(Space &home, unsigned int a, IntVar x, int i, int n)
Branch commit function type for integer variables.
IntAssign INT_ASSIGN_MAX(void)
Select largest value.
void clause(Home home, BoolOpType o, const BoolVarArgs &x, const BoolVarArgs &y, int n, IntConLevel)
Post domain consistent propagator for Boolean clause with positive variables x and negative variables...
void(* BoolBranchCommit)(Space &home, unsigned int a, BoolVar x, int i, int n)
Branch commit function type for Boolean variables.
Recording AFC information for integer and Boolean variables.
IntValBranch INT_VAL_MIN(void)
Select smallest value.
Specification of a DFA transition.
void sqrt(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Value iterator from range iterator.
unsigned int size(I &i)
Size of all ranges of range iterator i.
Reification specification.
SymmetryHandle ValueSymmetry(const IntArgs &vs)
Values in v are interchangeable.
IntValBranch INT_VAL_SPLIT_MAX(void)
Select values greater than mean of smallest and largest value.
void range(Home home, const IntVarArgs &x, SetVar y, SetVar z)
Post constraint .
IntVarBranch INT_VAR_MAX_MAX(BranchTbl tbl)
Select variable with largest max.
void unshare(Home home, IntVarArgs &x, IntConLevel icl)
Replace multiple variable occurences in x by fresh variables.
unsigned int domsize
Domain size.
Range iterator for ranges of integer variable implementation.
IntVarBranch INT_VAR_RND(Rnd r)
Select random variable (uniform distribution, for tie breaking)
IntVarBranch INT_VAR_AFC_MIN(double d, BranchTbl tbl)
Select variable with smallest accumulated failure count with decay factor d.
IntVarBranch INT_VAR_ACTIVITY_SIZE_MAX(double d, BranchTbl tbl)
Select variable with largest activity divided by domain size with decay factor d. ...
With largest domain size.
Tuple ** tuples
Tuples index.
bool overflow_add(int n, int m)
Check whether adding n and m would overflow.
IntVarBranch INT_VAR_MIN_MAX(BranchTbl tbl)
Select variable with largest min.
void precede(Home home, const IntVarArgs &x, int s, int t, IntConLevel)
Post propagator that s precedes t in x.
int min
Minimum and maximum in domain-values.
struct Gecode::@519::NNF::@60::@62 a
For atomic nodes.
Integer set initialization.
void(* VoidFunction)(void)
Base type for any function pointer.
int o_state
output state Default constructor
Tuple * nullpointer
Pointer to NULL-pointer.
void cumulatives(Home home, const IntVarArgs &m, const IntVarArgs &s, const IntVarArgs &p, const IntVarArgs &e, const IntVarArgs &u, const IntArgs &c, bool at_most, IntConLevel cl)
Post propagators for the cumulatives constraint.
void element(Home home, IntSharedArray c, IntVar x0, IntVar x1, IntConLevel)
Post domain consistent propagator for .
union Gecode::@519::NNF::@60 u
Union depending on nodetype t.
ExtensionalPropKind
Extensional propagation kind.
Reify eqv(BoolVar x)
Use equivalence for reification.
With largest degree divided by domain size.
IntVarArgs(const IntVarArgs &a)
Initialize from variable argument array a (copy elements)
IntValBranch INT_VAL_NEAR_MIN(IntSharedArray n)
Try value nearest to a given value for a variable, in case of ties use the smaller value...
Recording activities for integer and Boolean variables.
Passing integer variables.
SharedArray< int > IntSharedArray
Arrays of integers that can be shared among several element constraints.
void divmod(Home home, IntVar x0, IntVar x1, IntVar x2, IntVar x3, IntConLevel)
Post propagator for .
void sorted(Home home, const IntVarArgs &x, const IntVarArgs &y, const IntVarArgs &z, IntConLevel)
Post propagator that y is x sorted in increasing order.
void ite(Home home, BoolVar b, IntVar x, IntVar y, IntVar z, IntConLevel icl)
Post propagator for if-then-else constraint.
Passing integer arguments.
BoolVarArgs(InputIterator first, InputIterator last)
Initialize from InputIterator first and last.
Passing Boolean variables.
Select values greater than mean of smallest and largest value.
double(* BoolBranchMerit)(const Space &home, BoolVar x, int i)
Branch merit function type for Boolean variables.
Tuple * tuple_data
Tuple index data.
IntVarBranch INT_VAR_AFC_SIZE_MIN(double d, BranchTbl tbl)
Select variable with smallest accumulated failure count divided by domain size with decay factor d...
Boolean integer variables.
Class represeting a set of tuples.
TieBreak< VarBranch > tiebreak(VarBranch a, VarBranch b)
Combine variable selection criteria a and b for tie-breaking.
With smallest degree divided by domain size.
void extensional(Home home, const IntVarArgs &x, DFA dfa, IntConLevel)
Post domain consistent propagator for extensional constraint described by a DFA.
IntValBranch INT_VAL_MAX(void)
Select largest value.
void values(Home home, const IntVarArgs &x, IntSet y, IntConLevel icl=ICL_DEF)
Post constraint .
Integer view for integer variables.
const int infinity
Infinity for integers.
struct Gecode::@519::NNF::@60::@61 b
For binary nodes (and, or, eqv)
Select the largest range of the variable domain if it has several ranges, otherwise select values gre...
BoolVarArgs(int n)
Allocate array with n elements.
Value branching information.
void div(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
IntValBranch INT_VALUES_MIN(void)
Try all values starting from smallest.
Variable branching information.
IntAssign INT_ASSIGN(IntBranchVal v, IntBranchCommit c)
Select value as defined by the value function v and commit function c.
BrancherHandle assign(Home home, const FloatVarArgs &x, FloatAssign fa, FloatBranchFilter bf, FloatVarValPrint vvp)
Assign all x with value selection vals.
bool overflow_sub(int n, int m)
Check whether subtracting m from n would overflow.
Select values not greater than mean of smallest and largest value.
Node * x
Pointer to corresponding Boolean expression node.
void count(Home home, const IntVarArgs &x, int n, IntRelType irt, int m, IntConLevel)
Post propagator for .
IntValBranch INT_VALUES_MAX(void)
Try all values starting from largest.
IntSharedArray n
Array of values for near strategies.
IntVarBranch INT_VAR_MERIT_MIN(IntBranchMerit bm, BranchTbl tbl)
Select variable with least merit according to branch merit function bm.
void(* IntVarValPrint)(const Space &home, const BrancherHandle &bh, unsigned int a, IntVar x, int i, const int &n, std::ostream &o)
Function type for printing branching alternatives for integer variables.
Which values to select for assignment.
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
SymmetryHandle values_reflect(int lower, int upper)
The values from lower to upper (inclusive) can be reflected.
Sort ranges according to increasing minimum.
IntVarBranch INT_VAR_AFC_SIZE_MAX(double d, BranchTbl tbl)
Select variable with largest accumulated failure count divided by domain size with decay factor d...
The default consistency for a constraint.
IntValBranch INT_VAL_NEAR_MAX(IntSharedArray n)
Try value nearest to a given value for a variable, in case of ties use the larger value...
Select
Which variable selection.
bool valid(int n)
Return whether n is in range.
Value iterator for integer sets.
IntValBranch INT_VAL_MED(void)
Select greatest value not greater than the median.
IntVarBranch INT_VAR_ACTIVITY_SIZE_MIN(double d, BranchTbl tbl)
Select variable with smallest activity divided by domain size with decay factor d.
Iterator for DFA transitions (sorted by symbols)
Int::LDSB::SymmetryObject * ref
Symmetry object that this handle refers to.
PrimArgArray< TaskType > TaskTypeArgs
Argument arrays for passing task type arguments.
Random (uniform, for tie breaking)
void distinct(Home home, const IntVarArgs &x, IntConLevel icl)
Post propagator for for all .
With smallest domain size.
Select
Which value selection.
Select greatest value not greater than the median.
SymmetryHandle VariableSequenceSymmetry(const IntVarArgs &vars, int ss)
Variable sequences in x of size ss are interchangeable.
const long long int llmax
Largest allowed long long integer value.
IntValBranch INT_VAL_NEAR_INC(IntSharedArray n)
Try value larger than a given value for a variable first.
Traits of arrays in Gecode.
void binpacking(Home home, const IntVarArgs &l, const IntVarArgs &b, const IntArgs &s, IntConLevel)
Post propagator for bin packing.
Bounds propagation or consistency.
IntValBranch INT_VAL_SPLIT_MIN(void)
Select values not greater than mean of smallest and largest value.
int size
Number of Tuples.
Prefer little memory over speed.
void nooverlap(Home home, const IntVarArgs &x, const IntArgs &w, const IntVarArgs &y, const IntArgs &h, IntConLevel)
Post propagator for rectangle packing.
Gecode toplevel namespace
Argument array for variables.
IntVarBranch INT_VAR_MAX_MIN(BranchTbl tbl)
Select variable with smallest max.
void wait(Home home, FloatVar x, void(*c)(Space &home))
Execute c when x becomes assigned.
Implication for reification.
IntValBranch INT_VAL(IntBranchVal v, IntBranchCommit c)
Select value as defined by the value function v and commit function c Uses a commit function as defau...
#define GECODE_VTABLE_EXPORT
BoolVar x
The Boolean control variable.
BrancherHandle branch(Home home, const FloatVarArgs &x, FloatVarBranch vars, FloatValBranch vals, FloatBranchFilter bf, FloatVarValPrint vvp)
Branch over x with variable selection vars and value selection vals.
Class for activity management.
#define GECODE_INT_EXPORT
const long long int llinfinity
Infinity for long long integers.
void circuit(Home home, int offset, const IntVarArgs &x, IntConLevel icl)
Post propagator such that x forms a circuit.
void check(int n, const char *l)
Check whether n is in range, otherwise throw out of limits with information l.
Home class for posting propagators
double tbl(const Gecode::Space &, double w, double b)
Test function for tie-break limit function.
ReifyMode
Mode for reification.
Select value according to user-defined functions.
void nvalues(Home home, const IntVarArgs &x, IntRelType irt, int y, IntConLevel)
Post propagator for .
ReifyMode rm
The reification mode.
void positive(int n, const char *l)
Check whether n is in range and strictly positive, otherwise throw out of limits with information l...
void member(Home home, const IntVarArgs &x, IntVar y, IntConLevel)
Post domain consistent propagator for .
IntValBranch INT_VAL_NEAR_DEC(IntSharedArray n)
Try value smaller than a given value for a variable first.
Domain propagation or consistency.
IntVarBranch INT_VAR_SIZE_MAX(BranchTbl tbl)
Select variable with largest domain size.
void unary(Home home, const IntVarArgs &s, const IntArgs &p, IntConLevel icl)
Post propagators for scheduling tasks on unary resources.
Select value near to a given value, increment values first.
IntVarBranch INT_VAR_REGRET_MIN_MIN(BranchTbl tbl)
Select variable with smallest min-regret.
Select all values starting from smallest.
IntVarBranch INT_VAR_DEGREE_MIN(BranchTbl tbl)
Select variable with smallest degree.
With smallest accumulated failure count divided by domain size.
Equivalence for reification (default)
Reify pmi(BoolVar x)
Use reverse implication for reification.
Boolean view for Boolean variables.
double(* BranchTbl)(const Space &home, double w, double b)
Tie-break limit function.