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 {
105 const unsigned int card = max-min+1;
107 void check(
int n,
const char*
l);
109 void check(
unsigned int n,
const char*
l);
166 SetVar(
Space& home,
int glbMin,
int glbMax,
int lubMin,
int lubMax,
167 unsigned int cardMin = 0,
188 unsigned int cardMin = 0,
210 unsigned int cardMin = 0,
232 unsigned int cardMin = 0,
238 unsigned int glbSize(
void)
const;
241 unsigned int lubSize(
void)
const;
243 unsigned int unknownSize(
void)
const;
245 unsigned int cardMin(
void)
const;
247 unsigned int cardMax(
void)
const;
249 int lubMin(
void)
const;
251 int lubMax(
void)
const;
253 int glbMin(
void)
const;
255 int glbMax(
void)
const;
260 bool contains(
int i)
const;
263 bool notContains(
int i)
const;
288 bool operator ()(
void)
const;
291 void operator ++(
void);
301 unsigned int width(
void)
const;
320 bool operator ()(
void)
const;
323 void operator ++(
void);
333 unsigned int width(
void)
const;
352 bool operator ()(
void)
const;
355 void operator ++(
void);
365 unsigned int width(
void)
const;
384 bool operator ()(
void)
const;
387 void operator ++(
void);
412 bool operator ()(
void)
const;
415 void operator ++(
void);
440 bool operator ()(
void)
const;
443 void operator ++(
void);
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,
538 SetVarArgs(
Space& home,
int n,
int glbMin,
int glbMax,
540 unsigned int minCard = 0,
549 SetVarArgs(
Space& home,
int n,
551 unsigned int minCard = 0,
591 SetVarArray(
Space& home,
int n,
int glbMin,
int glbMax,
int lubMin,
int lubMax,
592 unsigned int minCard = 0,
601 SetVarArray(
Space& home,
int n,
const IntSet& glb,
int lubMin,
int lubMax,
602 unsigned int minCard = 0,
611 SetVarArray(
Space& home,
int n,
int glbMin,
int glbMax,
const IntSet& lub,
612 unsigned int minCard = 0,
621 SetVarArray(
Space& home,
int n,
623 unsigned int minCard = 0,
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,
1385 Select select(
void)
const;
1509 Select select(
void)
const;
1579 Select select(
void)
const;
1752 Iter::Ranges::RangeList> {
1769 Set::LubRanges<Set::SetView> > {
1828 virtual void init(
const Space& home,
const SetTraceRecorder&
t);
1830 virtual void prune(
const Space& home,
const SetTraceRecorder&
t,
1833 virtual void fix(
const Space& home,
const SetTraceRecorder&
t);
1835 virtual void fail(
const Space& home,
const SetTraceRecorder&
t);
1837 virtual void done(
const Space& home,
const SetTraceRecorder&
t);
Which values to select for branching first.
Exclude median element (rounding downwards)
void channelSorted(Home home, const IntVarArgs &x, SetVar y)
ViewTracer< Set::SetView > SetTracer
Tracer for set variables.
Recording actions for set variables.
Post propagator for SetVar SetOpType op
SetVarBranch SET_VAR_CHB_SIZE_MIN(BranchTbl tbl)
Which value to select Select s
SetVarBranch SET_VAR_SIZE_MIN(BranchTbl tbl)
Variables as interfaces to variable implementations.
Tracer that process view trace information.
Combine variable selection criteria for tie-breaking.
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.
void notMin(Home home, SetVar s, IntVar x)
Range iterator for the unknown set.
union Gecode::@579::NNF::@61 u
Union depending on nodetype t.
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 .
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 .
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.
Set::GlbRanges< Set::SetView > n
Iterator over new glb.
Standard set variable tracer.
Range iterator for range lists
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.
Collection of symmetries.
SetVarBranch SET_VAR_DEGREE_SIZE_MAX(BranchTbl tbl)
Exclude smallest element.
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.
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)
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)
SetAssign SET_ASSIGN_RND_INC(Rnd r)
Range iterator for the least upper bound.
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.
std::string expand(Gecode::IntRelType irt)
Expand relation to abbreviation.
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.
Gecode::IntArgs i(4, 1, 2, 3, 4)
Base-class for branchers.
Class for AFC (accumulated failure count) management.
int n
Number of negative literals for node type.
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.
A reference-counted pointer to a SymmetryObject.
SetAssign SET_ASSIGN_MAX_INC(void)
SetVarBranch SET_VAR_DEGREE_MIN(BranchTbl tbl)
IntRelType
Relation types for integers.
SetVarBranch SET_VAR_DEGREE_MAX(BranchTbl tbl)
SetVarBranch SET_VAR_CHB_MAX(BranchTbl tbl)
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.
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.
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.
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.
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)
Trace delta information for set variables.
Boolean integer variables.
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.
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
Value branching information.
SetAssign SET_ASSIGN_RND_EXC(Rnd r)
void relax(Home home, const FloatVarArgs &x, const FloatVarArgs &sx, Rnd r, double p)
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)
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.
SetAssign SET_ASSIGN_MED_EXC(void)
Include smallest element.
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
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)
Post propagator for SetVar x
Include smallest element.
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.
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)
Gecode toplevel namespace
Argument array for variables.
void weights(Home home, IntSharedArray elements, IntSharedArray weights, SetVar x, IntVar y)
Class for action management.
Range iterator for computing set difference.
SetVarBranch SET_VAR_ACTION_MAX(double d, BranchTbl tbl)
SetVarBranch SET_VAR_MIN_MIN(BranchTbl tbl)
SetVarBranch SET_VAR_CHB_MIN(BranchTbl tbl)
Which variable to select for branching.
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.
Home class for posting propagators
double tbl(const Gecode::Space &, double w, double b)
Test function for tie-break limit function.
Include median element (rounding downwards)
With largest accumulated failure count.
SetVarBranch SET_VAR_ACTION_SIZE_MAX(double d, BranchTbl tbl)
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.
#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)
With smallest unknown set.
void element(Home home, IntSharedArray c, IntVar x0, IntVar x1, IntPropLevel)
Post domain consistent propagator for .
With smallest minimum unknown element.
SetVarBranch SET_VAR_ACTION_MIN(double d, BranchTbl tbl)