34namespace Gecode {
namespace Set {
namespace LDSB {
36 template<
class View,
int n,
class Val,
unsigned int a,
37 class Filter,
class Print>
38 LDSBSetBrancher<View,n,Val,a,Filter,Print>
39 ::LDSBSetBrancher(Home home, ViewArray<View>&
x,
41 ValSelCommitBase<View,Val>* vsc,
42 SymmetryImp<View>** syms,
int nsyms,
43 BranchFilter<LDSBSetBrancher<View,n,Val,a,Filter,Print>::Var> bf,
44 VarValPrint<LDSBSetBrancher<View,n,Val,a,Filter,Print>::Var,Val> vvp)
45 : LDSBBrancher<View,
n,Val,
a,Filter,Print>
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>
74 _nNonValueSymmetries(
b._nNonValueSymmetries),
75 _nValueSymmetries(
b._nValueSymmetries),
76 _nCopiedSyms(
b._nCopiedSyms),
77 _leftBranchValues(
b._leftBranchValues),
83 b._copiedSyms[i]->copy(home));
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>
135 if (_nValueSymmetries > 0) {
138 if (choicePos != _prevPos) {
139 if (_prevPos != -1) {
141 for (
int j = _nNonValueSymmetries ; j < this->_nsyms ; j++) {
142 this->_syms[j] = _copiedSyms[i];
146 for (
int i = 0 ; i < _nCopiedSyms ; i++) {
153 this->_syms[this->_nsyms] = ns;
155 this->_nValueSymmetries++;
162 _prevPos = choicePos;
163 if (_nCopiedSyms > 0) home.
free(_copiedSyms, _nCopiedSyms);
164 _nCopiedSyms = _nValueSymmetries;
168 for (
int j = _nNonValueSymmetries ; j < this->_nsyms ; j++) {
181 template<
class View,
int n,
class Val,
unsigned int a,
182 class Filter,
class Print>
191 int choicePos = pvc->
pos().
pos;
195 updatePart1(home, choicePos);
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();
211 updatePart1(home, choicePos);
219 _leftBranchValues =
IntSet(ia);
225 for (
int i = 0 ; i < this->_nsyms ; i++)
236 for (
int i = 0 ; i < nliterals ; 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);
struct Gecode::@603::NNF::@65::@66 b
For binary nodes (and, or, eqv)
int n
Number of negative literals for node type.
struct Gecode::@603::NNF::@65::@67 a
For atomic nodes.
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.
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.
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.
int _nCopiedSyms
Number of copied symmetries.
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.
void updatePart1(Space &home, int choicePos)
Part one of the update phase.
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.
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.
Base class for value selection and commit.
Abstract class for view selection.
Generic brancher by view and value selection.
View::VarType Var
The corresponding variable.
virtual const Choice * choice(Space &home)
Return choice.
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.
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::IntArgs i({1, 2, 3, 4})