Go to the documentation of this file.
40 #ifndef __GECODE_SET_HH__
41 #define __GECODE_SET_HH__
53 #if !defined(GECODE_STATIC_LIBS) && \
54 (defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER))
56 #ifdef GECODE_BUILD_SET
57 #define GECODE_SET_EXPORT __declspec( dllexport )
59 #define GECODE_SET_EXPORT __declspec( dllimport )
64 #ifdef GECODE_GCC_HAS_CLASS_VISIBILITY
65 #define GECODE_SET_EXPORT __attribute__ ((visibility("default")))
67 #define GECODE_SET_EXPORT
73 #ifndef GECODE_BUILD_SET
74 #define GECODE_LIBRARY_NAME "Set"
92 namespace Gecode {
namespace Set {
103 void check(
int n,
const char*
l);
105 void check(
unsigned int n,
const char*
l);
234 unsigned int glbSize(
void)
const;
237 unsigned int lubSize(
void)
const;
241 unsigned int cardMin(
void)
const;
243 unsigned int cardMax(
void)
const;
297 unsigned int width(
void)
const;
329 unsigned int width(
void)
const;
361 unsigned int width(
void)
const;
455 template<
class Char,
class Traits>
456 std::basic_ostream<Char,Traits>&
505 template<
class InputIterator>
506 SetVarArgs(InputIterator first, InputIterator last);
515 int lubMin,
int lubMax,
516 unsigned int minCard = 0,
526 int lubMin,
int lubMax,
527 unsigned int minCard = 0,
538 unsigned int minCard = 0,
549 unsigned int minCard = 0,
590 unsigned int minCard = 0,
600 unsigned int minCard = 0,
610 unsigned int minCard = 0,
621 unsigned int minCard = 0,
693 cardinality(Home home, SetVar
x,
unsigned int i,
unsigned int j);
696 cardinality(Home home,
const SetVarArgs&
x,
unsigned int i,
unsigned int j);
708 dom(Home home, SetVar
x, SetVar
d);
711 dom(Home home,
const SetVarArgs&
x,
const SetVarArgs&
d);
1082 typedef std::function<bool(
const Space& home, SetVar
x,
int i)>
1094 typedef std::function<double(
const Space& home,
SetVar x,
int i)>
1107 typedef std::function<int(
const Space& home,
SetVar x,
int i)>
1121 typedef std::function<void(
Space& home,
unsigned int a,
1281 typedef std::function<void(
const Space &home,
const Brancher&
b,
1283 SetVar
x,
int i,
const int&
n,
1587 branch(Home home,
const SetVarArgs&
x,
1588 SetVarBranch vars, SetValBranch vals,
1597 branch(Home home,
const SetVarArgs&
x,
1598 TieBreak<SetVarBranch> vars, SetValBranch vals,
1607 branch(Home home, SetVar
x, SetValBranch vals,
1616 assign(Home home,
const SetVarArgs&
x,
1617 SetVarBranch vars, SetAssign vals,
1626 assign(Home home,
const SetVarArgs&
x,
1627 TieBreak<SetVarBranch> vars, SetAssign vals,
1636 assign(Home home, SetVar
x, SetAssign vals,
1649 branch(Home home,
const SetVarArgs&
x,
1660 assign(Home home,
const SetVarArgs&
x,
1687 branch(Home home,
const SetVarArgs&
x,
1688 SetVarBranch vars, SetValBranch vals,
1689 const Symmetries& syms,
1699 branch(Home home,
const SetVarArgs&
x,
1700 TieBreak<SetVarBranch> vars, SetValBranch vals,
1701 const Symmetries& syms,
1730 relax(Home home,
const SetVarArgs&
x,
const SetVarArgs& sx,
1755 Iter::Ranges::RangeList> {
1772 Set::LubRanges<Set::SetView> > {
struct Gecode::@602::NNF::@65::@66 b
For binary nodes (and, or, eqv)
void operator++(void)
Move iterator to next range (if possible)
Include median element (rounding downwards)
Class for action management.
With smallest CHB Q-score divided by domain size.
Post propagator for SetVar x
SetVarBranch SET_VAR_ACTION_MIN(double d, BranchTbl tbl)
IntRelType
Relation types for integers.
Return selection strategy Select select(void) const
Post propagator for SetVar SetOpType SetVar y
Iterator for the values in the greatest lower bound of a set variable.
SetVarLubValues(void)
Default constructor.
Lub & lub(void)
Give access iterator for delta in leat bound (values that have been removed)
SymmetryHandle VariableSymmetry(const IntVarArgs &vars)
Variables in x are interchangeable.
SetVarBranch SET_VAR_MERIT_MIN(SetBranchMerit bm, BranchTbl tbl)
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
With smallest accumulated failure count.
int lubMax(void) const
Return maximum element of least upper bound.
Which values to select for branching first.
SetVarBranch SET_VAR_CHB_SIZE_MAX(BranchTbl tbl)
Iter::Ranges::RangeList o
Iterator over old lub.
Trace delta information for set variables.
With largest minimum unknown element.
SetAssign SET_ASSIGN_MIN_INC(void)
With largest degree divided by domain size.
Passing integer variables.
Which value to select Select s
ViewTraceRecorder< Set::SetView > SetTraceRecorder
Trace recorder for set variables.
void element(Home home, IntSharedArray c, IntVar x0, IntVar x1, IntPropLevel)
Post domain consistent propagator for .
SetAFC(void)
Construct as not yet initialized.
With largest unknown set.
With largest action divided by domain size.
const int min
Smallest allowed integer in integer set.
bool operator()(void) const
Test whether iterator is still at a range or done.
Class for CHB management.
SetVarBranch SET_VAR_CHB_MAX(BranchTbl tbl)
Exclude median element (rounding downwards)
void channelSorted(Home home, const IntVarArgs &x, SetVar y)
SetVarBranch SET_VAR_DEGREE_SIZE_MAX(BranchTbl tbl)
Post propagator for SetVar SetOpType SetVar SetRelType SetVar z
Include median element (rounding downwards)
SetVarArgs(void)
Allocate empty array.
With largest CHB Q-score divided by domain size.
unsigned int cardMin(void) const
Return cardinality minimum.
SetValBranch SET_VAL_MIN_EXC(void)
int max(void) const
Return largest value of range.
With largest maximum unknown element.
int lubMin(void) const
Return minimum element of least upper bound.
int min(void) const
Return smallest value of range.
void relax(Home home, const FloatVarArgs &x, const FloatVarArgs &sx, Rnd r, double p)
void notMin(Home home, SetVar s, IntVar x)
SetVarArray(void)
Default constructor (array of size 0)
Range iterator for the unknown set.
SetVarBranch SET_VAR_MIN_MIN(BranchTbl tbl)
SetAssign SET_ASSIGN_MED_INC(void)
SetOpType
Common operations for sets.
void 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.
int val(void) const
Return current value.
Iterator for the values in the least upper bound of a set variable.
SetVarBranch SET_VAR_NONE(void)
SetVarBranch SET_VAR_AFC_SIZE_MAX(double d, BranchTbl tbl)
SetVarBranch SET_VAR_CHB_MIN(BranchTbl tbl)
Which value to select for assignment.
SetVarBranch SET_VAR_AFC_SIZE_MIN(double d, BranchTbl tbl)
SetVarBranch SET_VAR_AFC_MIN(double d, BranchTbl tbl)
SetVarBranch SET_VAR_AFC_MAX(double d, BranchTbl tbl)
int val(void) const
Return current value.
std::function< int(const Space &home, SetVar x, int i)> SetBranchVal
Branch value function type for set variables.
SetVarBranch SET_VAR_DEGREE_MIN(BranchTbl tbl)
Recording CHB for set variables.
Return selection strategy Select select(void) const
SetCHB(void)
Construct as not yet initialized.
Standard set variable tracer.
SetTraceDelta(Set::SetTraceView o, Set::SetView n, const Delta &d)
Initialize with old trace view o, new view n, and delta d.
SetAssign SET_ASSIGN_MAX_EXC(void)
Include smallest element.
SetVar(void)
Default constructor.
Recording AFC information for set variables.
Variable branching information.
union Gecode::@602::NNF::@65 u
Union depending on nodetype t.
Gecode toplevel namespace
SetValBranch SET_VAL_MAX_INC(void)
int val(void) const
Return current value.
void atmostOne(Home home, const SetVarArgs &xa, unsigned int c)
Action & operator=(const Action &a)
Assignment operator.
double tbl(const Gecode::Space &, double w, double b)
Test function for tie-break limit function.
SetVarBranch SET_VAR_MIN_MAX(BranchTbl tbl)
std::function< bool(const Space &home, SetVar x, int i)> SetBranchFilter
Branch filter function type for set variables.
const int max
Largest allowed integer in integer set.
const unsigned int card
Maximum cardinality of an integer set.
std::function< double(const Space &home, SetVar x, int i)> SetBranchMerit
Branch merit function type for set variables.
SetVarLubRanges(void)
Default constructor.
With smallest minimum unknown element.
With largest accumulated failure count divided by domain size.
unsigned int lubSize(void) const
Return number of elements in the least upper bound.
int n
Number of variables (size)
std::ostream & os
Output stream to use.
struct Gecode::@602::NNF::@65::@67 a
For atomic nodes.
Argument array for non-primitive types.
Generic domain change information to be supplied to advisors.
Reification specification.
Passing Boolean variables.
Which variable to select Select s
Home class for posting propagators
bool operator()(void) const
Test whether iterator is still at a value or done.
void init(Home home, const SetVarArgs &x, double d=1.0, SetBranchMerit bm=nullptr)
Initialize for set variables x with decay factor d.
Initialize with strategy SEL_NONE SetVarBranch(void)
SetAssign SET_ASSIGN_RND_INC(Rnd r)
bool operator()(void) const
Test whether iterator is still at a value or done.
unsigned int width(void) const
Return width of range (distance between minimum and maximum)
Value iterator from range iterator.
SetAssign SET_ASSIGN_MED_EXC(void)
ViewTracer< Set::SetView > SetTracer
Tracer for set variables.
void init(Home home, const SetVarArgs &x, double d=1.0, bool share=true)
Initialize for set variables x with decay factor d.
Function type for printing branching alternatives for set variables typedef std::function< void(const Space &home, const Brancher &b, unsigned int a, SetVar x, int i, const int &n, std::ostream &o)> SetVarValPrint
Set::LubRanges< Set::SetView > n
Iterator over new lub.
#define GECODE_SET_EXPORT
Tracer that process view trace information.
void dom(Home home, FloatVar x, FloatVal n)
Propagates .
Set::GlbRanges< Set::SetView > n
Iterator over new glb.
Iter::Ranges::RangeList o
Iterator over old glb.
Post propagator for SetVar SetOpType SetVar SetRelType r
Range iterator for computing set difference.
Boolean integer variables.
Select value according to user-defined functions.
Exclude smallest element.
SetValBranch SET_VAL_MIN_INC(void)
unsigned int width(void) const
Return width of range (distance between minimum and maximum)
SetAssign SET_ASSIGN_RND_EXC(Rnd r)
void operator++(void)
Move iterator to next value (if possible)
unsigned int cardMax(void) const
Return cardinality maximum.
Value branching information.
bool operator()(void) const
Test whether iterator is still at a range or done.
Exclude median element (rounding downwards)
SetAssign SET_ASSIGN_MAX_INC(void)
LinIntExpr cardinality(const SetExpr &e)
Cardinality of set expression.
SetAssign SET_ASSIGN_MIN_EXC(void)
void assign(Home home, const FloatVarArgs &x, FloatVarBranch vars, FloatAssign vals, FloatBranchFilter bf, FloatVarValPrint vvp)
Assign all x with variable selection vars and value selection vals.
Range iterator for the greatest lower bound.
const int max
Largest allowed integer value.
unsigned int unknownSize(void) const
Return number of unknown elements (elements in lub but not in glb)
Include smallest element.
SetRelType
Common relation types for sets.
Propagator for recording view trace information.
SetVarBranch SET_VAR_ACTION_MAX(double d, BranchTbl tbl)
With highest CHB Q-score.
void weights(Home home, IntSharedArray elements, IntSharedArray weights, SetVar x, IntVar y)
Lub(RangeList *o, Set::SetView n)
Initialize with old lub o and new lub n.
void notMax(Home home, SetVar s, IntVar x)
Initialize with selection strategy a afc a a
std::function< void(Space &home, unsigned int a, SetVar x, int i, int n)> SetBranchCommit
Branch commit function type for set variables.
void operator++(void)
Move iterator to next range (if possible)
ExecStatus prune(Space &home, ViewArray< VX > &x, ConstIntView)
void operator++(void)
Move iterator to next value (if possible)
void wait(Home home, FloatVar x, std::function< void(Space &home)> c)
Execute c when x becomes assigned.
bool contains(int i) const
Test whether i is in greatest lower bound.
SetValBranch SET_VAL_RND_EXC(Rnd r)
SetAssign SET_ASSIGN(SetBranchVal v, SetBranchCommit c)
Select value as defined by the value function v and commit function c.
Initialize with selection strategy a s SetAssign(Select s=SEL_MIN_INC)
int max(void) const
Return largest value of range.
With smallest unknown set.
int min(void) const
Return smallest value of range.
SetVarBranch SET_VAR_SIZE_MAX(BranchTbl tbl)
SetVarBranch SET_VAR_DEGREE_MAX(BranchTbl tbl)
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
SetValBranch SET_VAL_MED_INC(void)
Class for AFC (accumulated failure count) management.
bool operator()(void) const
Test whether iterator is still at a range or done.
void operator++(void)
Move iterator to next value (if possible)
Which value to select Select s
SetVarBranch SET_VAR_RND(Rnd r)
Set view for set variables
int min(void) const
Return smallest value of range.
SetVarBranch SET_VAR_ACTION_SIZE_MAX(double d, BranchTbl tbl)
unsigned int width(void) const
Return width of range (distance between minimum and maximum)
Recording actions for set variables.
Variables as interfaces to variable implementations.
static StdSetTracer def
Default tracer (printing to std::cerr)
void channel(Home home, FloatVar x0, IntVar x1)
Post propagator for channeling a float and an integer variable .
With smallest maximum unknown element.
void check(int n, const char *l)
Check whether integer n is in range, otherwise throw overflow exception with information l.
void precede(Home home, const IntVarArgs &x, int s, int t, IntPropLevel)
Post propagator that s precedes t in x.
SetVarUnknownValues(void)
Default constructor.
SymmetryHandle VariableSequenceSymmetry(const IntVarArgs &vars, int ss)
Variable sequences in x of size ss are interchangeable.
unsigned int glbSize(void) const
Return number of elements in the greatest lower bound.
Delta for the least upper bound.
Range iterator for the least upper bound.
Initialize with selection strategy a decay factor a d
SetVarBranch SET_VAR_MAX_MIN(BranchTbl tbl)
SetValBranch SET_VAL(SetBranchVal v, SetBranchCommit c)
Select value as defined by the value function v and commit function c.
With smallest accumulated failure count divided by domain size.
int glbMin(void) const
Return minimum element of greatest lower bound.
AFC & operator=(const AFC &a)
Assignment operator.
Glb(RangeList *o, Set::SetView n)
Initialize with old glb and new glb.
void operator++(void)
Move iterator to next range (if possible)
void trace(Home home, const FloatVarArgs &x, TraceFilter tf, int te, FloatTracer &t)
Create a tracer for float variables.
Post propagator for SetVar SetOpType op
Initialize with selection strategy a CHB a c
SetVarBranch SET_VAR_MAX_MAX(BranchTbl tbl)
SetValBranch SET_VAL_MAX_EXC(void)
CHB & operator=(const CHB &a)
Assignment operator.
SetVarBranch SET_VAR_CHB_SIZE_MIN(BranchTbl tbl)
Iterator for the greatest lower bound ranges of a set variable.
void sequence(Home home, const IntVarArgs &x, const IntSet &s, int q, int l, int u, IntPropLevel)
Post propagator for .
void ite(Home home, BoolVar b, FloatVar x, FloatVar y, FloatVar z)
Post propagator for if-then-else constraint.
Iterator for the unknown ranges of a set variable.
void init(Home home, const SetVarArgs &x, SetBranchMerit bm=nullptr)
Initialize for set variables x.
Rnd r
Random number generator.
bool operator()(void) const
Test whether iterator is still at a value or done.
SetVarBranch SET_VAR_DEGREE_SIZE_MIN(BranchTbl tbl)
int max(void) const
Return largest value of range.
Iterator for the values in the unknown set of a set variable.
int glbMax(void) const
Return maximum of greatest lower bound.
Initialize with selection strategy a branch merit function a mf
SetVarBranch SET_VAR_SIZE_MIN(BranchTbl tbl)
std::function< double(const Space &home, double w, double b)> BranchTbl
Tie-break limit function.
Expand and CHB void expand(Home home, const SetVarArgs &x)
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
SetVarUnknownRanges(void)
Default constructor.
Gecode::FloatVal c(-8, 8)
Select value according to user-defined functions.
Return selection strategy Select select(void) const
Range iterator for range lists
void convex(Home home, SetVar x)
Shared array with arbitrary number of elements.
SetAction(void)
Construct as not yet initialized.
Iterator for the least upper bound ranges of a set variable.
int n
Number of negative literals for node type.
With smallest degree divided by domain size.
Lists of ranges (intervals)
Argument array for variables.
SetVarGlbRanges(void)
Default constructor.
SetVarGlbValues(void)
Default constructor.
Passing integer arguments.
Delta for the greatest lower bound.
SetVarBranch SET_VAR_ACTION_SIZE_MIN(double d, BranchTbl tbl)
Gecode::IntArgs i({1, 2, 3, 4})
Exclude smallest element.
SetVarBranch SET_VAR_MERIT_MAX(SetBranchMerit bm, BranchTbl tbl)
With largest accumulated failure count.
SetValBranch SET_VAL_MED_EXC(void)
int p
Number of positive literals for node type.
Initialize with selection strategy a s SetValBranch(Select s=SEL_MIN_INC)
With smallest action divided by domain size.
Archive & operator<<(Archive &e, FloatNumBranch nl)
SetValBranch SET_VAL_RND_INC(Rnd r)
Random (uniform, for tie breaking)
bool notContains(int i) const
Test whether i is not in the least upper bound.
Glb & glb(void)
Give access to iterator for delta in greatest lower bound (values that have been included)
Which variable to select for branching.