Go to the documentation of this file.
37 namespace Gecode {
namespace Int {
namespace LDSB {
41 : _variable(-1), _value(-1) {}
45 : _variable(idx), _value(val) {}
51 if (
d > 0)
return true;
60 const Val&
n,
const Literal* literals,
83 for (
int i = 0 ;
i < _nliterals ;
i++) {
84 e << _literals[
i]._variable;
85 e << _literals[
i]._value;
91 template<
class View,
int n,
class Val,
unsigned int a,
92 class Filter,
class Print>
100 :
ViewValBrancher<View,
n,Val,
a,Filter,Print>(home,
x, vs, vsc, bf, vvp),
108 template<
class View,
int n,
class Val,
unsigned int a,
109 class Filter,
class Print>
118 (home,
x,vs,vsc,syms,nsyms,bf,vvp);
121 template<
class View,
int n,
class Val,
unsigned int a,
122 class Filter,
class Print>
129 _prevPos(
b._prevPos) {
135 template<
class View,
int n,
class Val,
unsigned int a,
136 class Filter,
class Print>
145 template<
class View,
int n,
class Val,
unsigned int a,
146 class Filter,
class Print>
155 int choicePos = pvc->
pos().pos;
156 int choiceVal = pvc->
val();
159 _prevPos = choicePos;
163 std::deque<Literal> queue;
164 std::set<Literal> seen;
166 seen.insert(
Literal(choicePos, choiceVal));
167 queue.push_back(
Literal(choicePos, choiceVal));
173 for (
int i = 0 ;
i < _nsyms ;
i++) {
175 for (
int j = 0 ; j < toExclude.
size() ; ++j) {
176 if (seen.find(toExclude[j]) == seen.end())
177 queue.push_back(toExclude[j]);
178 seen.insert(toExclude[j]);
181 }
while (queue.size() > 0);
184 int nliterals = static_cast<int>(seen.size());
186 std::set<Literal>::iterator it = seen.begin();
187 for (
int i = 0 ;
i < nliterals ;
i++) {
192 return new LDSBChoice<Val>(*
this,
a,choicePos,choiceVal, literals, nliterals);
196 template<
class View,
int n,
class Val,
unsigned int a,
197 class Filter,
class Print>
204 int nliterals; e >> nliterals;
206 for (
int i = 0 ;
i < nliterals ;
i++) {
217 return x.nq(home,
v);
224 return x.nq(home,
v);
228 template<
class View,
int n,
class Val,
unsigned int a,
229 class Filter,
class Print>
235 int choicePos = pvc.
pos().pos;
236 int choiceVal = pvc.
val();
243 for (
int i = 0 ;
i < this->_nsyms ;
i++)
254 for (
int i = 0 ;
i < nliterals ;
i++) {
256 ModEvent me = prune<View>(home, this->x[
l._variable],
l._value);
264 template<
class View,
int n,
class Val,
unsigned int a,
265 class Filter,
class Print>
273 template<
class View,
int n,
class Val,
unsigned int a>
285 ::post(home,
x,vs,vsc,syms,nsyms,bf,vvp);
288 ::post(home,
x,vs,vsc,syms,nsyms,bf,vvp);
293 ::post(home,
x,vs,vsc,syms,nsyms,bf,vvp);
296 ::post(home,
x,vs,vsc,syms,nsyms,bf,vvp);
struct Gecode::@602::NNF::@65::@66 b
For binary nodes (and, or, eqv)
void notice(Actor &a, ActorProperty p, bool duplicate=false)
Notice actor property.
std::function< bool(const Space &home, Var x, int i)> BranchFilter
Function type for branch filter functions.
Post propagator for SetVar x
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.
void postldsbbrancher(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)
Post LDSB brancher.
virtual size_t dispose(Space &home)
Delete brancher and return its size.
int _variable
Variable index. The ViewArray that the index is meant for is assumed to be known by context.
Class without print function.
LDSBChoice(const Brancher &b, unsigned int a, const Pos &p, const Val &n, const Literal *literals, int nliterals)
Initialize choice for brancher b, position p, value n, and set of literals literals (of size nliteral...
Base-class for both propagators and branchers.
virtual void archive(Archive &e) const
Archive into e.
Generic brancher by view and value selection.
Class storing a print function.
Boolean view for Boolean variables.
Gecode toplevel namespace
bool operator<(const Literal &rhs) const
Less than. The ordering is the lexicographical order on the (variable,value) pair.
View::VarType Var
The corresponding variable.
#define GECODE_ES_CHECK(es)
Check whether execution status es is failed or subsumed, and forward failure or subsumption.
void update(IntSet &y, Space &home, IntSet &py)
struct Gecode::@602::NNF::@65::@67 a
For atomic nodes.
Argument array for non-primitive types.
virtual ExecStatus commit(Space &home, const Choice &c, unsigned int b)
Perform commit for choice c and alternative b.
virtual const Choice * choice(Space &home)
Return choice.
virtual const Choice * choice(Space &home)
Return choice.
Base-class for branchers.
Home class for posting propagators
int _nsyms
Number of symmetry implementations.
Actor must always be disposed.
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.
virtual Actor * copy(Space &home)
Perform cloning.
A Literal is a pair of variable index and value.
int nliterals(void) const
Return number of literals.
~LDSBChoice(void)
Destructor.
int ModEvent
Type for modification events.
const Val & val(void) const
int size(void) const
Return size of array (number of elements)
Choice storing position and value
Integer view for integer variables.
int _value
The value of the literal. For int and bool variables, this is the value itself; for set variables,...
Symmetry-breaking brancher with generic view and value selection.
virtual void archive(Archive &e) const
Archive into e.
void ignore(Actor &a, ActorProperty p, bool duplicate=false)
Ignore actor property.
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
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.
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
Gecode::IntArgs i({1, 2, 3, 4})
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.
int p
Number of positive literals for node type.
Literal(void)
Constructor for an empty literal.
LDSBBrancher(Space &home, LDSBBrancher &b)
Constructor for cloning b.
SymmetryImp< View > ** _syms
Array of symmetry implementations.
const Pos & pos(void) const
Return position in array.