36 template<
class View,
int n,
class Val,
unsigned int a,
37 class Filter,
class Print>
41 ValSelCommitBase<View,Val>* vsc,
46 (home,
x, vs, vsc, syms, nsyms, bf, vvp),
53 int dest = this->_nsyms - 1;
54 for (
int i = 0 ;
i < this->_nsyms - seen ;
i++) {
55 if (
dynamic_cast<ValueSymmetryImp<View>*
>(this->_syms[i])) {
56 SymmetryImp<View>* t = this->_syms[
i];
57 this->_syms[
i] = this->_syms[dest];
58 this->_syms[dest] = t;
63 _nValueSymmetries = seen;
64 _nNonValueSymmetries = this->_nsyms - seen;
67 template<
class View,
int n,
class Val,
unsigned int a,
68 class Filter,
class Print>
69 LDSBSetBrancher<View,n,Val,a,Filter,Print>::
70 LDSBSetBrancher(Space& home,
71 LDSBSetBrancher<View,n,Val,a,Filter,Print>& b)
72 : LDSBBrancher<View,n,Val,
a,Filter,Print>(home,
b),
74 _nNonValueSymmetries(
b._nNonValueSymmetries),
75 _nValueSymmetries(
b._nValueSymmetries),
76 _nCopiedSyms(
b._nCopiedSyms),
77 _leftBranchValues(
b._leftBranchValues),
79 if (_nCopiedSyms > 0) {
80 _copiedSyms = home.alloc<ValueSymmetryImp<View>*>(_nCopiedSyms);
81 for (
int i = 0 ;
i < _nCopiedSyms ;
i++)
82 _copiedSyms[i] =
static_cast<ValueSymmetryImp<View>*
>(
83 b._copiedSyms[i]->copy(home));
99 ValueSymmetryImp<View>*
108 if (usedValues.
in(i))
118 if (intersection.
size() < 2)
120 int *a =
new int[intersection.
size()];
121 for (
int i = 0 ; i < intersection.
size() ; i++) {
122 a[i] = intersection[i];
130 template<
class View,
int n,
class Val,
unsigned int a,
131 class Filter,
class Print>
153 this->_syms[this->_nsyms] = ns;
181 template<
class View,
int n,
class Val,
unsigned int a,
182 class Filter,
class Print>
191 int choicePos = pvc->
pos().
pos;
200 template<
class View,
int n,
class Val,
unsigned int a,
201 class Filter,
class Print>
207 int choicePos = pvc.
pos().
pos;
208 int choiceVal = pvc.
val();
225 for (
int i = 0 ; i < this->
_nsyms ; i++)
236 for (
int i = 0 ; i < nliterals ; i++) {
237 const Literal& l = literals[i];
246 template<
class View,
int n,
class Val,
unsigned int a,
247 class Filter,
class Print>
254 template<
class View,
int n,
class Val,
unsigned int a,
255 class Filter,
class Print>
264 (home,
x,
vs,
vsc,syms,nsyms,bf,vvp);
267 template<
class View,
int n,
class Val,
unsigned int a>
279 ::post(home,
x,vs,vsc,syms,nsyms,bf,vvp);
282 ::post(home,
x,vs,vsc,syms,nsyms,bf,vvp);
287 ::post(home,
x,vs,vsc,syms,nsyms,bf,vvp);
290 ::post(home,
x,vs,vsc,syms,nsyms,bf,vvp);
Base-class for both propagators and branchers.
int size(void) const
Return size of array (number of elements)
Class without print function.
Class storing a print function.
Choice for performing commit
Home class for posting propagators
Passing integer arguments.
Value iterator for integer sets.
bool in(int n) const
Return whether n is included in the set.
static const IntSet empty
Empty set.
Symmetry-breaking brancher with generic view and value selection.
int _nsyms
Number of symmetry implementations.
SymmetryImp< View > ** _syms
Array of symmetry implementations.
virtual const Choice * choice(Space &home)
Return choice.
Choice storing position and value, and symmetric literals to be excluded on the right branch.
int nliterals(void) const
Return number of literals.
const Literal * literals(void) const
Return literals.
A Literal is a pair of variable index and value.
int _variable
Variable index. The ViewArray that the index is meant for is assumed to be known by context.
int _value
The value of the literal. For int and bool variables, this is the value itself; for set variables,...
Implementation of a single symmetry.
Implementation of a value symmetry.
SymmetryImp< View > * copy(Space &home) const
Copy function.
Support::BitSetOffset< Space > values
Symmetric values.
void update(Literal)
Left-branch update.
const Pos & pos(void) const
Return position in array.
Choice storing position and value
const Val & val(void) const
const int pos
Position of view.
Symmetry-breaking brancher with generic view and value selection.
bool _stable
Is the state of the brancher "stable"?
int _nCopiedSyms
Number of copied symmetries.
int _prevPos
Position of previous variable that was branched on.
ValueSymmetryImp< View > ** _copiedSyms
Copy of value symmetries from the first node where the current variable was branched on.
virtual Actor * copy(Space &home)
Perform cloning.
IntSet _leftBranchValues
Set of values used on left branches for the current variable.
int _nNonValueSymmetries
Number of non-value symmetries.
LDSBSetBrancher(Space &home, LDSBSetBrancher &b)
Constructor for cloning b.
void updatePart1(Space &home, int choicePos)
Part one of the update phase.
int _nValueSymmetries
Number of value symmetries.
virtual const Choice * choice(Space &home)
Return choice.
T * realloc(T *b, long unsigned int n, long unsigned int m)
Reallocate block of n objects starting at b to m objects of type T from the space heap.
T * alloc(long unsigned int n)
Allocate block of n objects of type T from space heap.
void free(T *b, long unsigned int n)
Delete n objects allocated from space heap starting at b.
ViewArray< View > x
Views to branch on.
ViewSel< View > * vs[n]
View selection objects.
Abstract class for view selection.
virtual const Choice * choice(Space &home)
Return choice.
View::VarType Var
The corresponding variable.
ViewValBrancher(Space &home, ViewValBrancher &b)
Constructor for cloning b.
ValSelCommitBase< View, Val > * vsc
Value selection and commit object.
void update(const NoOffset &)
Integer-precision integer scale view.
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
#define GECODE_ES_CHECK(es)
Check whether execution status es is failed or subsumed, and forward failure or subsumption.
ModEvent prune(Space &home, View x, int v)
Exclude value \v from variable view \x.
Symmetry breaking for set variables.
void postldsbsetbrancher(Home home, ViewArray< View > &x, ViewSel< View > *vs[n], ValSelCommitBase< View, Val > *vsc, SymmetryImp< View > **syms, int nsyms, BranchFilter< typename View::VarType > bf, VarValPrint< typename View::VarType, Val > vvp)
ValueSymmetryImp< View > * specialUpdate(Space &home, ValueSymmetryImp< View > *s, IntSet usedValues)
Bulk update of a value symmetry s, using usedValues.
Gecode toplevel namespace
std::function< void(const Space &home, const Brancher &b, unsigned int a, Var x, int i, const Val &m, std::ostream &o)> VarValPrint
Function type for printing variable and value selection.
void values(Home home, const IntVarArgs &x, IntSet y, IntPropLevel ipl=IPL_DEF)
Post constraint .
TFE post(PropagatorGroup g)
Only post functions (but not propagators) from g are considered.
@ ES_OK
Execution is okay.
Post propagator for SetVar x
std::function< bool(const Space &home, Var x, int i)> BranchFilter
Function type for branch filter functions.
int ModEvent
Type for modification events.
Gecode::FloatVal b(9, 12)
Gecode::FloatVal a(-8, 5)
Gecode::IntArgs i({1, 2, 3, 4})