44 #ifndef __GECODE_SET_HH__ 45 #define __GECODE_SET_HH__ 57 #if !defined(GECODE_STATIC_LIBS) && \ 58 (defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER)) 60 #ifdef GECODE_BUILD_SET 61 #define GECODE_SET_EXPORT __declspec( dllexport ) 63 #define GECODE_SET_EXPORT __declspec( dllimport ) 68 #ifdef GECODE_GCC_HAS_CLASS_VISIBILITY 69 #define GECODE_SET_EXPORT __attribute__ ((visibility("default"))) 71 #define GECODE_SET_EXPORT 77 #ifndef GECODE_BUILD_SET 78 #define GECODE_LIBRARY_NAME "Set" 96 namespace Gecode {
namespace Set {
107 void check(
int n,
const char*
l);
109 void check(
unsigned int n,
const char*
l);
238 unsigned int glbSize(
void)
const;
241 unsigned int lubSize(
void)
const;
245 unsigned int cardMin(
void)
const;
247 unsigned int cardMax(
void)
const;
301 unsigned int width(
void)
const;
333 unsigned int width(
void)
const;
365 unsigned int width(
void)
const;
459 template<
class Char,
class Traits>
460 std::basic_ostream<Char,Traits>&
461 operator <<(std::basic_ostream<Char,Traits>& os,
const SetVar&
x);
507 template<
class InputIterator>
508 SetVarArgs(InputIterator first, InputIterator last);
517 int lubMin,
int lubMax,
518 unsigned int minCard = 0,
528 int lubMin,
int lubMax,
529 unsigned int minCard = 0,
540 unsigned int minCard = 0,
551 unsigned int minCard = 0,
592 unsigned int minCard = 0,
602 unsigned int minCard = 0,
612 unsigned int minCard = 0,
623 unsigned int minCard = 0,
697 cardinality(Home home, SetVar
x,
unsigned int i,
unsigned int j);
700 cardinality(Home home,
const SetVarArgs&
x,
unsigned int i,
unsigned int j);
712 dom(Home home, SetVar
x, SetVar
d);
715 dom(Home home,
const SetVarArgs&
x,
const SetVarArgs&
d);
1108 std::function<
void(
Space& home)>
c);
1128 typedef std::function<bool(const Space& home, SetVar x, int i)>
1140 typedef std::function<double(const Space& home, SetVar x, int i)>
1153 typedef std::function<int(const Space& home, SetVar x, int i)>
1167 typedef std::function<void(
Space& home,
unsigned int a,
1318 typedef std::function<void(
const Space &home,
const Brancher&
b,
1320 SetVar
x,
int i,
const int&
n,
1624 branch(Home home,
const SetVarArgs&
x,
1625 SetVarBranch vars, SetValBranch vals,
1634 branch(Home home,
const SetVarArgs&
x,
1635 TieBreak<SetVarBranch> vars, SetValBranch vals,
1644 branch(Home home, SetVar
x, SetValBranch vals,
1652 assign(Home home,
const SetVarArgs&
x, SetAssign vals,
1661 assign(Home home, SetVar
x, SetAssign vals,
1684 branch(Home home,
const SetVarArgs&
x,
1685 SetVarBranch vars, SetValBranch vals,
1686 const Symmetries& syms,
1696 branch(Home home,
const SetVarArgs&
x,
1697 TieBreak<SetVarBranch> vars, SetValBranch vals,
1698 const Symmetries& syms,
1727 relax(Home home,
const SetVarArgs&
x,
const SetVarArgs& sx,
1752 Iter::Ranges::RangeList> {
1769 Set::LubRanges<Set::SetView> > {
Initialize with strategy SEL_NONE SetVarBranch(void)
void operator++(void)
Move iterator to next value (if possible)
Which values to select for branching first.
Exclude median element (rounding downwards)
void channelSorted(Home home, const IntVarArgs &x, SetVar y)
Glb(RangeList *o, Set::SetView n)
Initialize with old glb and new glb.
CHB & operator=(const CHB &a)
Assignment operator.
ViewTracer< Set::SetView > SetTracer
Tracer for set variables.
SetVarArray(void)
Default constructor (array of size 0)
Recording actions for set variables.
Post propagator for SetVar SetOpType op
SetVarBranch SET_VAR_CHB_SIZE_MIN(BranchTbl tbl)
bool operator()(void) const
Test whether iterator is still at a value or done.
Which value to select Select s
SetVarBranch SET_VAR_SIZE_MIN(BranchTbl tbl)
Variables as interfaces to variable implementations.
int lubMin(void) const
Return minimum element of least upper bound.
Tracer that process view trace information.
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.
Glb & glb(void)
Give access to iterator for delta in greatest lower bound (values that have been included) ...
unsigned int width(void) const
Return width of range (distance between minimum and maximum)
void notMin(Home home, SetVar s, IntVar x)
Initialize with selection strategy a CHB a c
Range iterator for the unknown set.
int max(void) const
Return largest value of range.
union Gecode::@579::NNF::@61 u
Union depending on nodetype t.
Return selection strategy Select select(void) const
const int min
Smallest allowed integer in integer set.
void sequence(Home home, const IntVarArgs &x, const IntSet &s, int q, int l, int u, IntPropLevel)
Post propagator for .
bool operator()(void) const
Test whether iterator is still at a range or done.
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.
Set::LubRanges< Set::SetView > n
Iterator over new lub.
void channel(Home home, FloatVar x0, IntVar x1)
Post propagator for channeling a float and an integer variable .
int min(void) const
Return smallest value of range.
Initialize with selection strategy a s SetAssign(Select s=SEL_MIN_INC)
With largest maximum unknown element.
With largest minimum unknown element.
Include median element (rounding downwards)
With largest action divided by domain size.
SetVarBranch SET_VAR_MERIT_MAX(SetBranchMerit bm, BranchTbl tbl)
With smallest accumulated failure count divided by domain size.
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Set::GlbRanges< Set::SetView > n
Iterator over new glb.
Standard set variable tracer.
Range iterator for range lists
Select value according to user-defined functions.
std::function< double(const Space &home, SetVar x, int i)> SetBranchMerit
Branch merit function type for set variables.
void dom(Home home, FloatVar x, FloatVal n)
Propagates .
With largest accumulated failure count divided by domain size.
Expand and CHB void expand(Home home, const SetVarArgs &x)
SetVarBranch SET_VAR_DEGREE_SIZE_MAX(BranchTbl tbl)
SetCHB(void)
Construct as not yet initialized.
bool operator()(void) const
Test whether iterator is still at a range or done.
Exclude smallest element.
bool notContains(int i) const
Test whether i is not in the least upper bound.
With smallest CHB Q-score divided by domain size.
Range iterator for the greatest lower bound.
With highest CHB Q-score.
With smallest accumulated failure count.
SetValBranch SET_VAL_MED_INC(void)
SetVarBranch SET_VAR_MAX_MAX(BranchTbl tbl)
SetValBranch SET_VAL_RND_INC(Rnd r)
SetOpType
Common operations for sets.
int min(void) const
Return smallest value of range.
const unsigned int card
Maximum cardinality of an integer set.
Iter::Ranges::RangeList o
Iterator over old glb.
With largest degree divided by domain size.
const int max
Largest allowed integer in integer set.
SetVarBranch SET_VAR_NONE(void)
int min(void) const
Return smallest value of range.
const int max
Largest allowed integer value.
With smallest action divided by domain size.
SetVarBranch SET_VAR_DEGREE_SIZE_MIN(BranchTbl tbl)
Which variable to select Select s
ExecStatus prune(Space &home, ViewArray< VX > &x, ConstIntView)
Lub & lub(void)
Give access iterator for delta in leat bound (values that have been removed)
SetAssign SET_ASSIGN_RND_INC(Rnd r)
Range iterator for the least upper bound.
int glbMin(void) const
Return minimum element of greatest lower bound.
SetTraceDelta(Set::SetTraceView o, Set::SetView n, const Delta &d)
Initialize with old trace view o, new view n, and delta d.
Iterator for the unknown ranges of a set variable.
Iterator for the values in the unknown set of a set variable.
With largest unknown set.
int lubMax(void) const
Return maximum element of least upper bound.
struct Gecode::@579::NNF::@61::@63 a
For atomic nodes.
Gecode::FloatVal c(-8, 8)
Exclude smallest element.
SetVarBranch SET_VAR_AFC_MAX(double d, BranchTbl tbl)
SymmetryHandle VariableSymmetry(const IntVarArgs &vars)
Variables in x are interchangeable.
Which value to select Select s
int p
Number of positive literals for node type.
SetVarLubRanges(void)
Default constructor.
Gecode::IntArgs i(4, 1, 2, 3, 4)
Class for AFC (accumulated failure count) management.
int n
Number of negative literals for node type.
unsigned int unknownSize(void) const
Return number of unknown elements (elements in lub but not in glb)
unsigned int glbSize(void) const
Return number of elements in the greatest lower bound.
SetVarBranch SET_VAR_CHB_SIZE_MAX(BranchTbl tbl)
std::function< void(Space &home, unsigned int a, SetVar x, int i, int n)> SetBranchCommit
Branch commit function type for set variables.
SetAssign SET_ASSIGN_MAX_INC(void)
int val(void) const
Return current value.
SetVarBranch SET_VAR_DEGREE_MIN(BranchTbl tbl)
IntRelType
Relation types for integers.
SetVarBranch SET_VAR_DEGREE_MAX(BranchTbl tbl)
With largest CHB Q-score divided by domain size.
SetVarBranch SET_VAR_CHB_MAX(BranchTbl tbl)
void init(Home home, const SetVarArgs &x, double d=1.0, SetBranchMerit bm=nullptr)
Initialize for set variables x with decay factor d.
Lub(RangeList *o, Set::SetView n)
Initialize with old lub o and new lub n.
unsigned int cardMin(void) const
Return cardinality minimum.
std::function< double(const Space &home, double w, double b)> BranchTbl
Tie-break limit function.
std::ostream & os
Output stream to use.
Value iterator from range iterator.
void wait(Home home, FloatVar x, std::function< void(Space &home)> c)
Execute c when x becomes assigned.
Class for CHB management.
Reification specification.
Iter::Ranges::RangeList o
Iterator over old lub.
struct Gecode::@579::NNF::@61::@62 b
For binary nodes (and, or, eqv)
Iterator for the greatest lower bound ranges of a set variable.
SetAction(void)
Construct as not yet initialized.
Recording CHB for set variables.
Post propagator for SetVar SetOpType SetVar SetRelType SetVar z
SetVarBranch SET_VAR_AFC_MIN(double d, BranchTbl tbl)
With smallest degree divided by domain size.
SetVarBranch SET_VAR_RND(Rnd r)
Recording AFC information for set variables.
Initialize with selection strategy a branch merit function a mf
int n
Number of variables (size)
Exclude median element (rounding downwards)
SetVarBranch SET_VAR_MERIT_MIN(SetBranchMerit bm, BranchTbl tbl)
void convex(Home home, SetVar x)
Iterator for the least upper bound ranges of a set variable.
unsigned int width(void) const
Return width of range (distance between minimum and maximum)
int glbMax(void) const
Return maximum of greatest lower bound.
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
SetAssign SET_ASSIGN_MED_INC(void)
Passing integer variables.
void operator++(void)
Move iterator to next value (if possible)
SetVarBranch SET_VAR_MIN_MAX(BranchTbl tbl)
SetValBranch SET_VAL_MIN_EXC(void)
Passing integer arguments.
Passing Boolean variables.
SetValBranch SET_VAL_MIN_INC(void)
bool operator()(void) const
Test whether iterator is still at a range or done.
void init(Home home, const SetVarArgs &x, SetBranchMerit bm=nullptr)
Initialize for set variables x.
int max(void) const
Return largest value of range.
SetVarLubValues(void)
Default constructor.
Trace delta information for set variables.
Boolean integer variables.
SetVarArgs(void)
Allocate empty array.
LinIntExpr cardinality(const SetExpr &e)
Cardinality of set expression.
SetValBranch SET_VAL_MAX_EXC(void)
Post propagator for SetVar SetOpType SetVar SetRelType r
With smallest maximum unknown element.
Propagator for recording view trace information.
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Set view for set variables
void atmostOne(Home home, const SetVarArgs &xa, unsigned int c)
SetValBranch SET_VAL_MAX_INC(void)
SetVarBranch SET_VAR_MAX_MIN(BranchTbl tbl)
SetVarBranch SET_VAR_SIZE_MAX(BranchTbl tbl)
Post propagator for SetVar SetOpType SetVar y
int max(void) const
Return largest value of range.
Value branching information.
SetAssign SET_ASSIGN_RND_EXC(Rnd r)
void relax(Home home, const FloatVarArgs &x, const FloatVarArgs &sx, Rnd r, double p)
void operator++(void)
Move iterator to next range (if possible)
Variable branching information.
SetValBranch SET_VAL_MED_EXC(void)
Generic domain change information to be supplied to advisors.
SetValBranch SET_VAL_RND_EXC(Rnd r)
Delta for the least upper bound.
SetAssign SET_ASSIGN_MIN_INC(void)
SetVarUnknownValues(void)
Default constructor.
void operator++(void)
Move iterator to next range (if possible)
Rnd r
Random number generator.
SetAssign SET_ASSIGN(SetBranchVal v, SetBranchCommit c)
Select value as defined by the value function v and commit function c.
void precede(Home home, const IntVarArgs &x, int s, int t, IntPropLevel)
Post propagator that s precedes t in x.
SetVarBranch SET_VAR_AFC_SIZE_MIN(double d, BranchTbl tbl)
Iterator for the values in the greatest lower bound of a set variable.
Action & operator=(const Action &a)
Assignment operator.
SetAssign SET_ASSIGN_MED_EXC(void)
Include smallest element.
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
unsigned int width(void) const
Return width of range (distance between minimum and maximum)
Initialize with selection strategy a s SetValBranch(Select s=SEL_MIN_INC)
std::function< bool(const Space &home, SetVar x, int i)> SetBranchFilter
Branch filter function type for set variables.
SetAssign SET_ASSIGN_MAX_EXC(void)
void notMax(Home home, SetVar s, IntVar x)
bool operator()(void) const
Test whether iterator is still at a value or done.
Return selection strategy Select select(void) const
Post propagator for SetVar x
Include smallest element.
Initialize with selection strategy a decay factor a d
unsigned int cardMax(void) const
Return cardinality maximum.
SetVarUnknownRanges(void)
Default constructor.
void trace(Home home, const FloatVarArgs &x, TraceFilter tf, int te, FloatTracer &t)
Create a tracer for float variables.
SymmetryHandle VariableSequenceSymmetry(const IntVarArgs &vars, int ss)
Variable sequences in x of size ss are interchangeable.
SetValBranch SET_VAL(SetBranchVal v, SetBranchCommit c)
Select value as defined by the value function v and commit function c.
bool contains(int i) const
Test whether i is in greatest lower bound.
Lists of ranges (intervals)
Random (uniform, for tie breaking)
Which value to select for assignment.
Delta for the greatest lower bound.
SetAssign SET_ASSIGN_MIN_EXC(void)
void operator++(void)
Move iterator to next range (if possible)
Gecode toplevel namespace
Argument array for variables.
void weights(Home home, IntSharedArray elements, IntSharedArray weights, SetVar x, IntVar y)
int val(void) const
Return current value.
Class for action management.
Range iterator for computing set difference.
SetVarBranch SET_VAR_ACTION_MAX(double d, BranchTbl tbl)
AFC & operator=(const AFC &a)
Assignment operator.
SetVarBranch SET_VAR_MIN_MIN(BranchTbl tbl)
SetVarBranch SET_VAR_CHB_MIN(BranchTbl tbl)
void operator++(void)
Move iterator to next value (if possible)
Which variable to select for branching.
SetVarGlbRanges(void)
Default constructor.
SetVarBranch SET_VAR_AFC_SIZE_MAX(double d, BranchTbl tbl)
ViewTraceRecorder< Set::SetView > SetTraceRecorder
Trace recorder for set variables.
void assign(Home home, const FloatVarArgs &x, FloatAssign fa, FloatBranchFilter bf, FloatVarValPrint vvp)
Assign all x with value selection vals.
Return selection strategy Select select(void) const
SetVar(void)
Default constructor.
void init(Home home, const SetVarArgs &x, double d=1.0)
Initialize for set variables x with decay factor d.
Home class for posting propagators
double tbl(const Gecode::Space &, double w, double b)
Test function for tie-break limit function.
bool operator()(void) const
Test whether iterator is still at a value or done.
Include median element (rounding downwards)
With largest accumulated failure count.
SetVarBranch SET_VAR_ACTION_SIZE_MAX(double d, BranchTbl tbl)
int val(void) const
Return current value.
SetVarGlbValues(void)
Default constructor.
std::function< int(const Space &home, SetVar x, int i)> SetBranchVal
Branch value function type for set variables.
Shared array with arbitrary number of elements.
Select value according to user-defined functions.
SetAFC(void)
Construct as not yet initialized.
#define GECODE_SET_EXPORT
void ite(Home home, BoolVar b, FloatVar x, FloatVar y, FloatVar z)
Post propagator for if-then-else constraint.
SetVarBranch SET_VAR_ACTION_SIZE_MIN(double d, BranchTbl tbl)
Iterator for the values in the least upper bound of a set variable.
static StdSetTracer def
Default tracer (printing to std::cerr)
Initialize with selection strategy a afc a a
With smallest unknown set.
void element(Home home, IntSharedArray c, IntVar x0, IntVar x1, IntPropLevel)
Post domain consistent propagator for .
unsigned int lubSize(void) const
Return number of elements in the least upper bound.
With smallest minimum unknown element.
SetVarBranch SET_VAR_ACTION_MIN(double d, BranchTbl tbl)