38 namespace Gecode {
namespace Set {
namespace LDSB {
40 template<
class View,
int n,
class Val,
unsigned int a>
48 :
LDSBBrancher<View,n,Val,
a>(home, x, vs, vsc, syms, nsyms, bf, vvp),
55 int dest = this->_nsyms - 1;
56 for (
int i = 0 ;
i < this->_nsyms - seen ;
i++) {
59 this->_syms[
i] = this->_syms[dest];
60 this->_syms[dest] =
t;
65 _nValueSymmetries = seen;
66 _nNonValueSymmetries = this->_nsyms - seen;
69 template<
class View,
int n,
class Val,
unsigned int a>
74 _nNonValueSymmetries(b._nNonValueSymmetries),
75 _nValueSymmetries(b._nValueSymmetries),
76 _nCopiedSyms(b._nCopiedSyms),
77 _leftBranchValues(b._leftBranchValues),
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>
134 if (_nValueSymmetries > 0) {
137 if (choicePos != _prevPos) {
138 if (_prevPos != -1) {
140 for (
int j = _nNonValueSymmetries ; j < this->_nsyms ; j++) {
141 this->_syms[j] = _copiedSyms[
i];
145 for (
int i = 0 ; i < _nCopiedSyms ; i++) {
152 this->_syms[this->_nsyms] = ns;
154 this->_nValueSymmetries++;
161 _prevPos = choicePos;
162 if (_nCopiedSyms > 0) home.
free(_copiedSyms, _nCopiedSyms);
163 _nCopiedSyms = _nValueSymmetries;
166 for (
int j = _nNonValueSymmetries ; j < this->_nsyms ; j++) {
178 template<
class View,
int n,
class Val,
unsigned int a>
187 int choicePos = pvc->
pos().pos;
191 updatePart1(home, choicePos);
196 template<
class View,
int n,
class Val,
unsigned int a>
202 int choicePos = pvc.
pos().pos;
203 int choiceVal = pvc.
val();
206 updatePart1(home, choicePos);
214 _leftBranchValues =
IntSet(ia);
219 for (
int i = 0 ;
i < this->_nsyms ;
i++)
220 this->_syms[
i]->update(
Literal(choicePos, choiceVal));
229 for (
int i = 0 ;
i < nliterals ;
i++) {
239 template<
class View,
int n,
class Val,
unsigned int a>
245 template<
class View,
int n,
class Val,
unsigned int a>
253 return *
new (home)
LDSBSetBrancher<View,n,Val,a>(home,x,vs,vsc,syms,nsyms,bf,vvp);
const Pos & pos(void) const
Return position in array.
Symmetry-breaking brancher with generic view and value selection.
const Val & val(void) const
Return value to branch with.
virtual ExecStatus commit(Space &home, const Choice &c, unsigned int b)
Perform commit for choice c and alternative b.
A Literal is a pair of variable index and value.
bool in(int n) const
Return whether n is included in the set.
int size(void) const
Return size of array (number of elements)
ValueSymmetryImp< View > * specialUpdate(Space &home, ValueSymmetryImp< View > *s, IntSet usedValues)
Bulk update of a value symmetry s, using usedValues.
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...
virtual ExecStatus commit(Space &home, const Choice &c, unsigned int b)
Perform commit for choice c and alternative b.
int ModEvent
Type for modification events.
virtual const Choice * choice(Space &home)
Return choice.
Support::BitSetOffset< Space > values
Symmetric values.
int _value
The value of the literal. For int and bool variables, this is the value itself; for set variables...
int _variable
Variable index. The ViewArray that the index is meant for is assumed to be known by context...
Base-class for both propagators and branchers.
int nliterals(void) const
Return number of literals.
ValueSymmetryImp< View > ** _copiedSyms
Copy of value symmetries from the first node where the current variable was branched on...
T * alloc(long unsigned int n)
Allocate block of n objects of type T from space heap.
#define GECODE_ES_CHECK(es)
Check whether execution status es is failed or subsumed, and forward failure or subsumption.
Gecode::FloatVal c(-8, 8)
void updatePart1(Space &home, int choicePos)
Part one of the update phase.
Choice storing position and value, and symmetric literals to be excluded on the right branch...
LDSBSetBrancher(Space &home, bool share, LDSBSetBrancher &b)
Constructor for cloning b.
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
Implementation of a value symmetry.
int _nCopiedSyms
Number of copied symmetries.
Symmetry-breaking brancher with generic view and value selection.
virtual const Choice * choice(Space &home)
Return choice.
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
Passing integer arguments.
static const IntSet empty
Empty set.
void free(T *b, long unsigned int n)
Delete n objects allocated from space heap starting at b.
Implementation of a single symmetry.
void update(Literal)
Left-branch update.
virtual const Choice * choice(Space &home)
Return choice.
Node * x
Pointer to corresponding Boolean expression node.
Choice for performing commit
static BrancherHandle post(Home home, ViewArray< View > &x, ViewSel< View > *vs[n], ValSelCommitBase< View, Val > *vsc, SymmetryImp< View > **_syms, int _nsyms, SetBranchFilter bf, VarValPrint vvp)
Brancher post function.
Value iterator for integer sets.
bool(* SetBranchFilter)(const Space &home, SetVar x, int i)
Branch filter function type for set variables.
virtual Actor * copy(Space &home, bool share)
Perform cloning.
SymmetryImp< View > * copy(Space &home, bool share) const
Copy function.
bool shared(const ConstView< ViewA > &, const ConstView< ViewB > &)
Test whether views share same variable.
struct Gecode::@518::NNF::@57::@58 b
For binary nodes (and, or, eqv)
Gecode toplevel namespace
const Literal * literals(void) const
Return literals.
Home class for posting propagators
Choice storing position and value
struct Gecode::@518::NNF::@57::@59 a
For atomic nodes.