Go to the documentation of this file.
38 namespace Gecode {
namespace Set {
namespace LDSB {
40 template<
class View,
int n,
class Val,
unsigned int a,
41 class Filter,
class Print>
50 (home,
x, vs, vsc, syms, nsyms, bf, vvp),
57 int dest = this->_nsyms - 1;
58 for (
int i = 0 ;
i < this->_nsyms - seen ;
i++) {
61 this->_syms[
i] = this->_syms[dest];
62 this->_syms[dest] =
t;
67 _nValueSymmetries = seen;
68 _nNonValueSymmetries = this->_nsyms - seen;
71 template<
class View,
int n,
class Val,
unsigned int a,
72 class Filter,
class Print>
78 _nNonValueSymmetries(
b._nNonValueSymmetries),
79 _nValueSymmetries(
b._nValueSymmetries),
80 _nCopiedSyms(
b._nCopiedSyms),
81 _leftBranchValues(
b._leftBranchValues),
87 b._copiedSyms[
i]->copy(home,
shared));
102 template <
class View>
112 if (usedValues.
in(
i))
122 if (intersection.size() < 2)
124 int *
a =
new int[intersection.size()];
125 for (
int i = 0 ;
i < intersection.size() ;
i++) {
126 a[
i] = intersection[
i];
134 template<
class View,
int n,
class Val,
unsigned int a,
135 class Filter,
class Print>
139 if (_nValueSymmetries > 0) {
142 if (choicePos != _prevPos) {
143 if (_prevPos != -1) {
145 for (
int j = _nNonValueSymmetries ; j < this->_nsyms ; j++) {
146 this->_syms[j] = _copiedSyms[
i];
150 for (
int i = 0 ;
i < _nCopiedSyms ;
i++) {
157 this->_syms[this->_nsyms] = ns;
159 this->_nValueSymmetries++;
166 _prevPos = choicePos;
167 if (_nCopiedSyms > 0) home.
free(_copiedSyms, _nCopiedSyms);
168 _nCopiedSyms = _nValueSymmetries;
171 for (
int j = _nNonValueSymmetries ; j < this->_nsyms ; j++) {
183 template<
class View,
int n,
class Val,
unsigned int a,
184 class Filter,
class Print>
193 int choicePos = pvc->
pos().pos;
197 updatePart1(home, choicePos);
202 template<
class View,
int n,
class Val,
unsigned int a,
203 class Filter,
class Print>
209 int choicePos = pvc.
pos().pos;
210 int choiceVal = pvc.
val();
213 updatePart1(home, choicePos);
221 _leftBranchValues =
IntSet(ia);
227 for (
int i = 0 ;
i < this->_nsyms ;
i++)
228 this->_syms[
i]->update(
Literal(choicePos, choiceVal));
238 for (
int i = 0 ;
i < nliterals ;
i++) {
248 template<
class View,
int n,
class Val,
unsigned int a,
249 class Filter,
class Print>
256 template<
class View,
int n,
class Val,
unsigned int a,
257 class Filter,
class Print>
266 (home,
x,vs,vsc,syms,nsyms,bf,vvp);
269 template<
class View,
int n,
class Val,
unsigned int a>
281 ::post(home,
x,vs,vsc,syms,nsyms,bf,vvp);
284 ::post(home,
x,vs,vsc,syms,nsyms,bf,vvp);
289 ::post(home,
x,vs,vsc,syms,nsyms,bf,vvp);
292 ::post(home,
x,vs,vsc,syms,nsyms,bf,vvp);
void values(Home home, const IntVarArgs &x, IntSet y, IntPropLevel ipl=IPL_DEF)
Post constraint .
std::function< bool(const Space &home, Var x, int i)> BranchFilter
Function type for branch filter functions.
Post propagator for SetVar x
bool in(int n) const
Return whether n is included in the set.
virtual ExecStatus commit(Space &home, const Choice &c, unsigned int b)
Perform commit for choice c and alternative b.
Choice storing position and value, and symmetric literals to be excluded on the right branch.
ValueSymmetryImp< View > * specialUpdate(Space &home, ValueSymmetryImp< View > *s, IntSet usedValues)
Bulk update of a value symmetry s, using usedValues.
static void post(Home home, ViewArray< View > &x, ViewSel< View > *vs[n], ValSelCommitBase< View, Val > *vsc, SymmetryImp< View > **_syms, int _nsyms, BranchFilter< Var > bf, VarValPrint< Var, Val > vvp)
Brancher post function.
void free(T *b, long unsigned int n)
Delete n objects allocated from space heap starting at b.
virtual Actor * copy(Space &home, bool share)
Perform cloning.
Implementation of a value symmetry.
static const IntSet empty
Empty set.
int _variable
Variable index. The ViewArray that the index is meant for is assumed to be known by context.
Class without print function.
Gecode::IntArgs i(4, 1, 2, 3, 4)
Support::BitSetOffset< Space > values
Symmetric values.
Symmetry-breaking brancher with generic view and value selection.
LDSBSetBrancher(Space &home, bool share, LDSBSetBrancher &b)
Constructor for cloning b.
Base-class for both propagators and branchers.
ValueSymmetryImp< View > ** _copiedSyms
Copy of value symmetries from the first node where the current variable was branched on.
Class storing a print function.
Gecode toplevel namespace
#define GECODE_ES_CHECK(es)
Check whether execution status es is failed or subsumed, and forward failure or subsumption.
virtual const Choice * choice(Space &home)
Return choice.
virtual const Choice * choice(Space &home)
Return choice.
SymmetryImp< View > * copy(Space &home, bool share) const
Copy function.
Home class for posting propagators
struct Gecode::@579::NNF::@61::@63 a
For atomic nodes.
virtual const Choice * choice(Space &home)
Return choice.
struct Gecode::@579::NNF::@61::@62 b
For binary nodes (and, or, eqv)
T * alloc(long unsigned int n)
Allocate block of n objects of type T from space heap.
TFE post(PropagatorGroup g)
Only post functions (but not propagators) from g are considered.
A Literal is a pair of variable index and value.
void updatePart1(Space &home, int choicePos)
Part one of the update phase.
int nliterals(void) const
Return number of literals.
int ModEvent
Type for modification events.
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)
const Val & val(void) const
Return value to branch with.
void update(Literal)
Left-branch update.
virtual ExecStatus commit(Space &home, const Choice &c, unsigned int b)
Perform commit for choice c and alternative b.
bool shared(const IntSet &, VX)
Choice storing position and value
Symmetry-breaking brancher with generic view and value selection.
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
int _nCopiedSyms
Number of copied symmetries.
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.
Gecode::FloatVal c(-8, 8)
Implementation of a single symmetry.
const Literal * literals(void) const
Return literals.
int n
Number of negative literals for node type.
Choice for performing commit
Passing integer arguments.
Value iterator for integer sets.
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.
@ ES_OK
Execution is okay.
const Pos & pos(void) const
Return position in array.