44 #ifndef __GECODE_SET_HH__
45 #define __GECODE_SET_HH__
55 #if !defined(GECODE_STATIC_LIBS) && \
56 (defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER))
58 #ifdef GECODE_BUILD_SET
59 #define GECODE_SET_EXPORT __declspec( dllexport )
61 #define GECODE_SET_EXPORT __declspec( dllimport )
66 #ifdef GECODE_GCC_HAS_CLASS_VISIBILITY
67 #define GECODE_SET_EXPORT __attribute__ ((visibility("default")))
69 #define GECODE_SET_EXPORT
75 #ifndef GECODE_BUILD_SET
76 #define GECODE_LIBRARY_NAME "Set"
94 namespace Gecode {
namespace Set {
103 const unsigned int card = max-min+1;
105 void check(
int n,
const char*
l);
107 void check(
unsigned int n,
const char*
l);
236 unsigned int glbSize(
void)
const;
239 unsigned int lubSize(
void)
const;
243 unsigned int cardMin(
void)
const;
245 unsigned int cardMax(
void)
const;
299 unsigned int width(
void)
const;
331 unsigned int width(
void)
const;
363 unsigned int width(
void)
const;
457 template<
class Char,
class Traits>
458 std::basic_ostream<Char,Traits>&
459 operator <<(std::basic_ostream<Char,Traits>& os,
const SetVar&
x);
505 template<
class InputIterator>
516 int lubMin,
int lubMax,
517 unsigned int minCard = 0,
527 int lubMin,
int lubMax,
528 unsigned int minCard = 0,
539 unsigned int minCard = 0,
550 unsigned int minCard = 0,
591 unsigned int minCard = 0,
601 unsigned int minCard = 0,
611 unsigned int minCard = 0,
622 unsigned int minCard = 0,
696 cardinality(Home home, SetVar
x,
unsigned int i,
unsigned int j);
699 cardinality(Home home,
const SetVarArgs&
x,
unsigned int i,
unsigned int j);
711 dom(Home home, SetVar
x, SetVar
d);
714 dom(Home home,
const SetVarArgs&
x,
const SetVarArgs&
d);
778 rel(Home home,
SetOpType op,
const SetVarArgs&
x,
const IntSet& z, SetVar y);
782 rel(Home home,
SetOpType op,
const IntVarArgs&
x,
const IntSet& z, SetVar y);
829 convex(Home home, SetVar
x, SetVar y);
842 sequence(Home home,
const SetVarArgs&
x);
846 sequence(Home home,
const SetVarArgs& y, SetVar
x);
860 atmostOne(Home home,
const SetVarArgs&
x,
unsigned int c);
875 min(Home home, SetVar s, IntVar
x);
880 notMin(Home home, SetVar s, IntVar
x);
885 min(Home home, SetVar s, IntVar
x, Reify
r);
890 max(Home home, SetVar s, IntVar
x);
895 notMax(Home home, SetVar s, IntVar
x);
900 max(Home home, SetVar s, IntVar
x, Reify
r);
932 channel(Home home,
const IntVarArgs&
x,
const SetVarArgs& y);
940 channel(Home home,
const BoolVarArgs&
x, SetVar y);
944 channel(Home home,
const SetVarArgs&
x,
const SetVarArgs& y);
960 precede(Home home,
const SetVarArgs&
x,
int s,
int t);
965 precede(Home home,
const SetVarArgs&
x,
const IntArgs&
c);
1039 element(Home home,
const SetVarArgs& x, IntVar y, SetVar z);
1056 IntVar x,
int w, IntVar y,
int h, SetVar z);
1063 element(Home home,
const SetVarArgs&
a,
1064 IntVar x,
int w, IntVar y,
int h, SetVar z);
1079 wait(Home home, SetVar x,
void (*
c)(Space& home));
1082 wait(Home home,
const SetVarArgs& x,
void (*
c)(Space& home));
1522 branch(Home home,
const SetVarArgs& x,
1523 SetVarBranch vars, SetValBranch vals,
1532 branch(Home home,
const SetVarArgs& x,
1533 TieBreak<SetVarBranch> vars, SetValBranch vals,
1542 branch(Home home, SetVar x, SetValBranch vals,
1550 assign(Home home,
const SetVarArgs& x, SetAssign vals,
1559 assign(Home home, SetVar x, SetAssign vals,
1582 branch(Home home,
const SetVarArgs& x,
1583 SetVarBranch vars, SetValBranch vals,
1584 const Symmetries& syms,
1594 branch(Home home,
const SetVarArgs& x,
1595 TieBreak<SetVarBranch> vars, SetValBranch vals,
1596 const Symmetries& syms,
SetVarBranch SET_VAR_SIZE_MIN(BranchTbl tbl)
Select variable with smallest unknown set.
void operator++(void)
Move iterator to next value (if possible)
Which values to select for branching first.
SetVarArgs(InputIterator first, InputIterator last)
Initialize from InputIterator first and last.
unsigned int cardMax(void) const
Return cardinality maximum.
SetVarBranch SET_VAR_AFC_MIN(double d, BranchTbl tbl)
Select variable with smallest accumulated failure count with decay factor d.
bool operator()(void) const
Test whether iterator is still at a range or done.
Select
Which value selection.
SetVarBranch SET_VAR_MIN_MAX(BranchTbl tbl)
Select variable with largest minimum unknown element.
void channelSorted(Home home, const IntVarArgs &x, SetVar y)
Post propagator for and .
SetVarArray(void)
Default constructor (array of size 0)
int val(void) const
Return current value.
Variables as interfaces to variable implementations.
int min(void) const
Return smallest value of range.
void check(int n, const char *l)
Check whether integer n is in range, otherwise throw overflow exception with information l...
SetRelType
Common relation types for sets.
SetValBranch(Select s=SEL_MIN_INC)
Initialize with selection strategy s.
Select value according to user-defined functions.
SetAssign SET_ASSIGN_MIN_EXC(void)
Exclude smallest element.
Range iterator for the unknown set.
SetVarBranch SET_VAR_NONE(void)
Select first unassigned variable.
int min(void) const
Return smallest value of range.
Include smallest element.
const int min
Smallest allowed integer in integer set.
void channel(Home home, FloatVar x0, IntVar x1)
Post propagator for channeling a float and an integer variable .
SetVarBranch SET_VAR_DEGREE_MIN(BranchTbl tbl)
Select variable with smallest degree.
SetValBranch SET_VAL_MED_INC(void)
Include median element (rounding downwards)
With smallest minimum unknown element.
Include median element (rounding downwards)
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
SetVarBranch SET_VAR_ACTIVITY_MIN(double d, BranchTbl tbl)
Select variable with lowest activity with decay factor d.
Select
Which value selection.
int glbMax(void) const
Return maximum of greatest lower bound.
SetValBranch SET_VAL_MIN_INC(void)
Include smallest element.
SetVarBranch SET_VAR_ACTIVITY_SIZE_MIN(double d, BranchTbl tbl)
Select variable with smallest activity divided by domain size with decay factor d.
With largest degree divided by domain size.
void dom(Home home, FloatVar x, FloatVal n)
Propagates .
SetAssign SET_ASSIGN(SetBranchVal v, SetBranchCommit c)
Select value as defined by the value function v and commit function c.
void atmostOne(Home home, const SetVarArgs &xa, unsigned int c)
Post propagator for and .
unsigned int width(void) const
Return width of range (distance between minimum and maximum)
unsigned int width(void) const
Return width of range (distance between minimum and maximum)
Select select(void) const
Return selection strategy.
Range iterator for the greatest lower bound.
int max(void) const
Return largest value of range.
unsigned int lubSize(void) const
Return number of elements in the least upper bound.
SetOpType
Common operations for sets.
Recording activities for set variables.
SetAssign SET_ASSIGN_MAX_INC(void)
Include largest element.
SetValBranch SET_VAL_RND_EXC(Rnd r)
Exclude random element.
const unsigned int card
Maximum cardinality of an integer set.
const int max
Largest allowed integer in integer set.
Include smallest element.
ArgArray< IntSet > IntSetArgs
Passing set arguments.
const int max
Largest allowed integer value.
bool contains(int i) const
Test whether i is in greatest lower bound.
Exclude median element (rounding downwards)
SetAssign SET_ASSIGN_RND_EXC(Rnd r)
Exclude random element.
unsigned int unknownSize(void) const
Return number of unknown elements (elements in lub but not in glb)
Range iterator for the least upper bound.
With largest maximum unknown element.
bool operator()(void) const
Test whether iterator is still at a value or done.
SetVarBranch SET_VAR_SIZE_MAX(BranchTbl tbl)
Select variable with largest unknown set.
unsigned int cardMin(void) const
Return cardinality minimum.
unsigned int glbSize(void) const
Return number of elements in the greatest lower bound.
Iterator for the unknown ranges of a set variable.
Iterator for the values in the unknown set of a set variable.
Exclude median element (rounding downwards)
void sequence(Home home, const IntVarArgs &x, const IntSet &s, int q, int l, int u, IntConLevel)
Post propagator for .
int val(void) const
Return current value.
Gecode::FloatVal c(-8, 8)
With smallest accumulated failure count.
SetAssign SET_ASSIGN_MAX_EXC(void)
Exclude largest element.
SymmetryHandle VariableSymmetry(const IntVarArgs &vars)
Variables in x are interchangeable.
Select select(void) const
Return selection strategy.
void init(Home, const SetVarArgs &x, double d=1.0)
Initialize for set variables x with decay factor d.
SetVarBranch SET_VAR_DEGREE_SIZE_MIN(BranchTbl tbl)
Select variable with smallest degree divided by domain size.
SetVarLubRanges(void)
Default constructor.
Gecode::IntArgs i(4, 1, 2, 3, 4)
With smallest maximum unknown element.
Class for AFC (accumulated failure count) management.
int max(void) const
Return largest value of range.
int n
Number of negative literals for node type.
int(* SetBranchVal)(const Space &home, SetVar x, int i)
Branch value function type for set variables.
int val(void) const
Return current value.
IntRelType
Relation types for integers.
SetVarBranch SET_VAR_MERIT_MAX(SetBranchMerit bm, BranchTbl tbl)
Select variable with highest merit according to branch merit function bm.
SetActivity(void)
Construct as not yet initialized.
int lubMax(void) const
Return maximum element of least upper bound.
With smallest degree divided by domain size.
SetVarBranch SET_VAR_ACTIVITY_MAX(double d, BranchTbl tbl)
Select variable with highest activity with decay factor d.
Exclude smallest element.
With largest accumulated failure count divided by domain size.
SetVarBranch(void)
Initialize with strategy SEL_NONE.
Value iterator from range iterator.
With largest accumulated failure count.
void(* SetBranchCommit)(Space &home, unsigned int a, SetVar x, int i, int n)
Branch commit function type for set variables.
SetValBranch SET_VAL_MAX_EXC(void)
Exclude largest element.
Iterator for the greatest lower bound ranges of a set variable.
bool notContains(int i) const
Test whether i is not in the least upper bound.
SetVarBranch SET_VAR_DEGREE_MAX(BranchTbl tbl)
Select variable with largest degree.
void precede(Home home, const IntVarArgs &x, int s, int t, IntConLevel)
Post propagator that s precedes t in x.
With smallest activity divided by domain size.
SetValBranch SET_VAL_MAX_INC(void)
Include largest element.
SetVarBranch SET_VAR_MAX_MAX(BranchTbl tbl)
Select variable with largest maximum unknown element.
double(* SetBranchMerit)(const Space &home, SetVar x, int i)
Branch merit function type for set variables.
void(* VoidFunction)(void)
Base type for any function pointer.
With largest activity divided by domain size.
void element(Home home, IntSharedArray c, IntVar x0, IntVar x1, IntConLevel)
Post domain consistent propagator for .
SetVarBranch SET_VAR_AFC_SIZE_MIN(double d, BranchTbl tbl)
Select variable with smallest accumulated failure count divided by domain size with decay factor d...
SetVarBranch SET_VAR_MAX_MIN(BranchTbl tbl)
Select variable with smallest maximum unknown element.
Recording AFC information for set variables.
int n
Number of variables (size)
SetVarArgs(const VarArray< SetVar > &a)
Initialize from variable array a (copy elements)
With largest unknown set.
Iterator for the least upper bound ranges of a set variable.
void operator++(void)
Move iterator to next value (if possible)
SharedArray< int > IntSharedArray
Arrays of integers that can be shared among several element constraints.
Select s
Which value to select.
SetAFC & operator=(const SetAFC &a)
Assignment operator.
void notMax(Home home, SetVar s, IntVar x)
Post propagator that propagates that x is not the maximal element of s.
SetVarLubValues(void)
Default constructor.
SetValBranch SET_VAL_MIN_EXC(void)
Exclude smallest element.
Include median element (rounding downwards)
SetVarBranch SET_VAR_AFC_SIZE_MAX(double d, BranchTbl tbl)
Select variable with largest accumulated failure count divided by domain size with decay factor d...
SetVarArgs(void)
Allocate empty array.
LinIntExpr cardinality(const SetExpr &e)
Cardinality of set expression.
SetAssign SET_ASSIGN_MIN_INC(void)
Include smallest element.
union Gecode::@518::NNF::@57 u
Union depending on nodetype t.
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Set view for set variables
Exclude smallest element.
Random (uniform, for tie breaking)
void init(Home, const SetVarArgs &x, double d=1.0, SetBranchMerit bm=NULL)
Initialize for set variables x with decay factor d.
SetAssign SET_ASSIGN_MED_INC(void)
Include median element (rounding downwards)
bool operator()(void) const
Test whether iterator is still at a value or done.
Value branching information.
SetVarBranch SET_VAR_RND(Rnd r)
Select random variable (uniform distribution, for tie breaking)
void operator++(void)
Move iterator to next range (if possible)
Variable branching information.
BrancherHandle assign(Home home, const FloatVarArgs &x, FloatAssign fa, FloatBranchFilter bf, FloatVarValPrint vvp)
Assign all x with value selection vals.
Node * x
Pointer to corresponding Boolean expression node.
SetVarUnknownValues(void)
Default constructor.
SetVarArgs(int n)
Allocate array with n elements.
void operator++(void)
Move iterator to next range (if possible)
void convex(Home home, SetVar x)
Post propagator that propagates that x is convex.
SetVarBranch SET_VAR_DEGREE_SIZE_MAX(BranchTbl tbl)
Select variable with largest degree divided by domain size.
Select value according to user-defined functions.
void expand(Home home, const SetVarArgs &x)
Expand decay factor into AFC or activity.
SetAssign SET_ASSIGN_MED_EXC(void)
Exclude median element (rounding downwards)
Iterator for the values in the greatest lower bound of a set variable.
int lubMin(void) const
Return minimum element of least upper bound.
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
bool operator()(void) const
Test whether iterator is still at a range or done.
With smallest unknown set.
SetVarArgs(const SetVarArgs &a)
Initialize from variable argument array a (copy elements)
void weights(Home home, IntSharedArray elements, IntSharedArray weights, SetVar x, IntVar y)
Post propagator for .
SetValBranch SET_VAL_MED_EXC(void)
Exclude median element (rounding downwards)
void(* SetVarValPrint)(const Space &home, const BrancherHandle &bh, unsigned int a, SetVar x, int i, const int &n, std::ostream &o)
Function type for printing branching alternatives for set variables.
bool(* SetBranchFilter)(const Space &home, SetVar x, int i)
Branch filter function type for set variables.
With largest minimum unknown element.
bool operator()(void) const
Test whether iterator is still at a range or done.
unsigned int width(void) const
Return width of range (distance between minimum and maximum)
SetVarUnknownRanges(void)
Default constructor.
SymmetryHandle VariableSequenceSymmetry(const IntVarArgs &vars, int ss)
Variable sequences in x of size ss are interchangeable.
int min(void) const
Return smallest value of range.
Which value to select for assignment.
void operator++(void)
Move iterator to next range (if possible)
Gecode toplevel namespace
Argument array for variables.
Select
Which variable selection.
void wait(Home home, FloatVar x, void(*c)(Space &home))
Execute c when x becomes assigned.
SetVarBranch SET_VAR_ACTIVITY_SIZE_MAX(double d, BranchTbl tbl)
Select variable with largest activity divided by domain size with decay factor d. ...
SetAssign SET_ASSIGN_RND_INC(Rnd r)
Include random element.
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.
void operator++(void)
Move iterator to next value (if possible)
Which variable to select for branching.
bool operator()(void) const
Test whether iterator is still at a value or done.
SetVarGlbRanges(void)
Default constructor.
Select s
Which variable to select.
SetVarBranch SET_VAR_MIN_MIN(BranchTbl tbl)
Select variable with smallest minimum unknown element.
Class for activity management.
Select select(void) const
Return selection strategy.
SetVar(void)
Default constructor.
Select s
Which value to select.
SetValBranch SET_VAL_RND_INC(Rnd r)
Include random element.
Home class for posting propagators
double tbl(const Gecode::Space &, double w, double b)
Test function for tie-break limit function.
SetVarArgs(const std::vector< SetVar > &a)
Initialize from vector a.
void notMin(Home home, SetVar s, IntVar x)
Post propagator that propagates that x is not the minimal element of s.
SetVarBranch SET_VAR_AFC_MAX(double d, BranchTbl tbl)
Select variable with largest accumulated failure count with decay factor d.
SetVarGlbValues(void)
Default constructor.
int glbMin(void) const
Return minimum element of greatest lower bound.
SetVarBranch SET_VAR_MERIT_MIN(SetBranchMerit bm, BranchTbl tbl)
Select variable with least merit according to branch merit function bm.
int max(void) const
Return largest value of range.
struct Gecode::@518::NNF::@57::@59 a
For atomic nodes.
#define GECODE_SET_EXPORT
SetAssign(Select s=SEL_MIN_INC)
Initialize with selection strategy s.
Iterator for the values in the least upper bound of a set variable.
SetValBranch SET_VAL(SetBranchVal v, SetBranchCommit c)
Select value as defined by the value function v and commit function c.
SetActivity & operator=(const SetActivity &a)
Assignment operator.
With smallest accumulated failure count divided by domain size.
SetAFC(void)
Construct as not yet initialized.
Rnd r
Random number generator.
double(* BranchTbl)(const Space &home, double w, double b)
Tie-break limit function.