34#ifndef __GECODE_INT_LDSB_HH__
35#define __GECODE_INT_LDSB_HH__
79 findVar(
int *indices,
unsigned int n_values,
unsigned int seq_size,
int index);
104namespace Gecode {
namespace Int {
namespace LDSB {
175 static void*
operator new(
size_t s,
Space& home);
177 static void operator delete(
void*,
Space&);
179 static void operator delete(
void*);
182 template <
class View>
202 template <
class View>
222 template <
class View>
264 template <
class View>
282 ValueSequenceSymmetryImp<View>(
const ValueSequenceSymmetryImp<View>&);
285 ValueSequenceSymmetryImp<View>(
Space& home,
int* _values,
unsigned int n,
unsigned int seqsize);
287 ValueSequenceSymmetryImp<View>(
Space& home,
const ValueSequenceSymmetryImp<View>& vss);
304 const Literal *
const _literals;
306 const int _nliterals;
330 template<
class View,
int n,
class Val,
unsigned int a,
331 class Filter,
class Print>
375 template<
class View,
int n,
class Val,
unsigned int a>
Argument array for non-primitive types.
ArgArray< VarImpBase * > StorageType
ArgArray< VarImpBase * > ArgsType
Int::LDSB::Literal ValueType
Traits of arrays in Gecode.
Base-class for branchers.
Home class for posting propagators
Passing integer arguments.
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 ExecStatus commit(Space &home, const Choice &c, unsigned int b)
Perform commit for choice c and alternative b.
int _nsyms
Number of symmetry implementations.
SymmetryImp< View > ** _syms
Array of symmetry implementations.
virtual const Choice * choice(Space &home)
Return choice.
virtual Actor * copy(Space &home)
Perform cloning.
LDSBBrancher(Space &home, LDSBBrancher &b)
Constructor for cloning b.
virtual size_t dispose(Space &home)
Delete brancher and return its size.
LDSBBrancher(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)
Constructor for creation.
int nliterals(void) const
Return number of literals.
const Literal * literals(void) const
Return literals.
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...
virtual void archive(Archive &e) const
Archive into e.
A Literal is a pair of variable index and value.
bool operator<(const Literal &rhs) const
Less than. The ordering is the lexicographical order on the (variable,value) pair.
Literal(void)
Constructor for an empty literal.
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.
virtual ArgArray< Literal > symmetric(Literal, const ViewArray< View > &) const =0
Compute symmetric literals.
virtual size_t dispose(Space &home)=0
Disposal.
virtual void update(Literal)=0
Left-branch update.
virtual ~SymmetryImp(void)
Unused destructor.
virtual SymmetryImp< View > * copy(Space &home) const =0
Copy function.
int nrefs
Number of references that point to this symmetry object.
SymmetryObject(void)
Default constructor.
virtual ArgArray< Literal > symmetric(Literal, const ViewArray< View > &) const
Compute symmetric literals.
unsigned int n_seqs
Number of sequences in symmetry.
int getVal(unsigned int sequence, unsigned int position) const
Get the value in the specified sequence at the specified position. (Both are zero-based....
int * values
Set of sequences.
SymmetryImp< View > * copy(Space &home) const
Copy function.
unsigned int seq_size
Size of each sequence in symmetry.
void update(Literal)
Left-branch update.
virtual size_t dispose(Space &home)
Disposal.
Support::BitSet< Space > dead_sequences
Which sequences are dead.
unsigned int n_values
Total number of values (n_seqs * seq_size)
IntArgs values
Array of values in symmetry.
int seq_size
Size of each sequence in symmetry.
ValueSequenceSymmetryObject(IntArgs vs, int ss)
Constructor for creation.
virtual size_t dispose(Space &home)
Disposal.
SymmetryImp< View > * copy(Space &home) const
Copy function.
ValueSymmetryImp(Space &home, int *vs, unsigned int n)
Constructor for creation.
Support::BitSetOffset< Space > values
Symmetric values.
void update(Literal)
Left-branch update.
virtual ArgArray< Literal > symmetric(Literal, const ViewArray< View > &) const
Compute symmetric literals.
IntSet values
Set of symmetric values.
ValueSymmetryObject(IntSet vs)
Constructor for creation.
VariableSequenceSymmetryImp(Space &home, int *_indices, unsigned int n, unsigned int seqsize)
Constructor for creation.
unsigned int * indices
Array of variable indices.
int getVal(unsigned int sequence, unsigned int position) const
Get the value in the specified sequence at the specified position. (Both are zero-based....
virtual size_t dispose(Space &home)
Disposal.
SymmetryImp< View > * copy(Space &home) const
Copy function.
unsigned int seq_size
Size of each sequence in symmetry.
int * lookup
Map from variable's index to its sequence and position.
void update(Literal)
Search left-branch update.
unsigned int lookup_size
Size of lookup.
unsigned int n_indices
Total number of indices (n_seqs * seq_size)
virtual ArgArray< Literal > symmetric(Literal, const ViewArray< View > &) const
Compute symmetric literals.
unsigned int n_seqs
Number of sequences in symmetry.
int seq_size
Size of each sequence in symmetry.
int nxs
Number of variables in symmetry.
VarImpBase ** xs
Array of variables in symmetry.
VariableSequenceSymmetryObject(ArgArray< VarImpBase * > vars, int ss)
Constructor for creation.
VariableSymmetryImp(Space &home, int *vs, unsigned int n)
Constructor for creation.
void update(Literal)
Left-branch update.
SymmetryImp< View > * copy(Space &home) const
Copy function.
Support::BitSetOffset< Space > indices
Symmetric variable indices.
virtual size_t dispose(Space &home)
Disposal.
virtual ArgArray< Literal > symmetric(Literal, const ViewArray< View > &) const
Compute symmetric literals.
int nxs
Number of variables in symmetry.
VariableSymmetryObject(ArgArray< VarImpBase * > vars)
Constructor for creation.
VarImpBase ** xs
Array of variables in symmetry.
PosValChoice(const Brancher &b, unsigned int a, const Pos &p, const Val &n)
Initialize choice for brancher b, number of alternatives a, position p, and value n.
Bitsets with index offset.
Base-class for variable implementations.
ViewArray< View > x
Views to branch on.
ViewSel< View > * vs[n]
View selection objects.
Abstract class for view selection.
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_INT_EXPORT
Symmetry breaking for integer variables.
std::pair< int, int > findVar(int *indices, unsigned int n_values, unsigned int seq_size, int index)
Find the location of an integer in a collection of sequences.
ModEvent prune(Space &home, View x, int v)
Exclude value \v from variable view \x.
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.
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 sequence(Home home, const IntVarArgs &x, const IntSet &s, int q, int l, int u, IntPropLevel ipl=IPL_DEF)
Post propagator for .
ArgArray< Int::LDSB::Literal > LiteralArgs
An array of literals.
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.
#define GECODE_VTABLE_EXPORT