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 {
101 const unsigned int card = max-min+1;
103 void check(
int n,
const char*
l);
105 void check(
unsigned int n,
const char*
l);
162 SetVar(
Space& home,
int glbMin,
int glbMax,
int lubMin,
int lubMax,
163 unsigned int cardMin = 0,
184 unsigned int cardMin = 0,
206 unsigned int cardMin = 0,
228 unsigned int cardMin = 0,
234 unsigned int glbSize(
void)
const;
237 unsigned int lubSize(
void)
const;
239 unsigned int unknownSize(
void)
const;
241 unsigned int cardMin(
void)
const;
243 unsigned int cardMax(
void)
const;
245 int lubMin(
void)
const;
247 int lubMax(
void)
const;
249 int glbMin(
void)
const;
251 int glbMax(
void)
const;
256 bool contains(
int i)
const;
259 bool notContains(
int i)
const;
284 bool operator ()(
void)
const;
287 void operator ++(
void);
297 unsigned int width(
void)
const;
316 bool operator ()(
void)
const;
319 void operator ++(
void);
329 unsigned int width(
void)
const;
348 bool operator ()(
void)
const;
351 void operator ++(
void);
361 unsigned int width(
void)
const;
380 bool operator ()(
void)
const;
383 void operator ++(
void);
408 bool operator ()(
void)
const;
411 void operator ++(
void);
436 bool operator ()(
void)
const;
439 void operator ++(
void);
455 template<
class Char,
class Traits>
456 std::basic_ostream<Char,Traits>&
457 operator <<(std::basic_ostream<Char,Traits>& os,
const SetVar&
x);
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,
536 SetVarArgs(
Space& home,
int n,
int glbMin,
int glbMax,
538 unsigned int minCard = 0,
547 SetVarArgs(
Space& home,
int n,
549 unsigned int minCard = 0,
589 SetVarArray(
Space& home,
int n,
int glbMin,
int glbMax,
int lubMin,
int lubMax,
590 unsigned int minCard = 0,
599 SetVarArray(
Space& home,
int n,
const IntSet& glb,
int lubMin,
int lubMax,
600 unsigned int minCard = 0,
609 SetVarArray(
Space& home,
int n,
int glbMin,
int glbMax,
const IntSet& lub,
610 unsigned int minCard = 0,
619 SetVarArray(
Space& home,
int n,
621 unsigned int minCard = 0,
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,
1168 void init(
Home home,
const SetVarArgs& x,
double d=1.0,
bool share=
true);
1348 Select select(
void)
const;
1472 Select select(
void)
const;
1542 Select select(
void)
const;
1715 Iter::Ranges::RangeList> {
1732 Set::LubRanges<Set::SetView> > {
1791 virtual void init(
const Space& home,
const SetTraceRecorder&
t);
1793 virtual void prune(
const Space& home,
const SetTraceRecorder&
t,
1796 virtual void fix(
const Space& home,
const SetTraceRecorder&
t);
1798 virtual void fail(
const Space& home,
const SetTraceRecorder&
t);
1800 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.
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.
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.
Base-class for branchers.
Class for AFC (accumulated failure count) management.
int n
Number of negative literals for node type.
Argument array for non-primitive types.
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.
Gecode::IntArgs i({1, 2, 3, 4})
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)
struct Gecode::@593::NNF::@62::@63 b
For binary nodes (and, or, eqv)
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.
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.
union Gecode::@593::NNF::@62 u
Union depending on nodetype t.
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.
struct Gecode::@593::NNF::@62::@64 a
For atomic nodes.
#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)