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));
85 _copiedSyms =
nullptr;
99 ValueSymmetryImp<View>*
106 if (usedValues.
in(i))
116 if (intersection.
size() < 2)
118 int *a =
new int[intersection.
size()];
119 for (
int i = 0 ; i < intersection.
size() ; i++) {
120 a[i] = intersection[i];
128 template<
class View,
int n,
class Val,
unsigned int a,
129 class Filter,
class Print>
151 this->_syms[this->_nsyms] = ns;
179 template<
class View,
int n,
class Val,
unsigned int a,
180 class Filter,
class Print>
189 int choicePos = pvc->
pos().
pos;
198 template<
class View,
int n,
class Val,
unsigned int a,
199 class Filter,
class Print>
205 int choicePos = pvc.
pos().
pos;
206 int choiceVal = pvc.
val();
223 for (
int i = 0 ; i < this->
_nsyms ; i++)
234 for (
int i = 0 ; i < nliterals ; i++) {
235 const Literal& l = literals[i];
244 template<
class View,
int n,
class Val,
unsigned int a,
245 class Filter,
class Print>
252 template<
class View,
int n,
class Val,
unsigned int a,
253 class Filter,
class Print>
262 (home,
x,
vs,
vsc,syms,nsyms,bf,vvp);
265 template<
class View,
int n,
class Val,
unsigned int a>
277 ::post(home,x,vs,vsc,syms,nsyms,bf,vvp);
280 ::post(home,x,vs,vsc,syms,nsyms,bf,vvp);
285 ::post(home,x,vs,vsc,syms,nsyms,bf,vvp);
288 ::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.
#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< bool(const Space &home, Var x, int i)> BranchFilter
Function type for branch filter functions.
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.
int ModEvent
Type for modification events.