43 namespace Gecode {
namespace Int {
namespace LDSB {
46 findVar(
int *indices,
unsigned int n_values,
unsigned int seq_size,
int index) {
49 for (
unsigned int i = 0 ;
i < n_values ;
i++) {
50 if (indices[
i] == index)
51 return std::pair<int,int>(seq,
pos);
53 if (
pos == seq_size) {
58 return std::pair<int,int>(-1,-1);
64 using namespace Int::LDSB;
68 for (
int i = 0 ;
i < vars.
size() ;
i++)
69 a[
i] = vars[
i].varimp();
74 for (
int i = 0 ;
i < vars.
size() ;
i++)
75 a[
i] = vars[
i].varimp();
81 for (
int i = 0 ;
i < indices.
size() ;
i++)
82 xs[
i] =
x[indices[
i]];
96 for (
int i = 0 ;
i < vars.
size() ;
i++)
97 a[
i] = vars[
i].varimp();
102 for (
int i = 0 ;
i < vars.
size() ;
i++)
103 a[
i] = vars[
i].varimp();
111 int n = (upper-lower+1)/2;
131 namespace Gecode {
namespace Int {
namespace LDSB {
147 dynamic_cast<VariableSymmetryObject*>(s.
ref);
149 dynamic_cast<ValueSymmetryObject*>(s.
ref);
151 dynamic_cast<VariableSequenceSymmetryObject*>(s.
ref);
153 dynamic_cast<ValueSequenceSymmetryObject*>(s.
ref);
156 int* indices = home.
alloc<
int>(
n);
157 for (
int i = 0 ;
i <
n ;
i++) {
158 VariableMap::const_iterator index = variableMap.find(varref->
xs[
i]);
159 if (index == variableMap.end())
161 indices[
i] = index->second;
167 int *vs = home.
alloc<
int>(
n);
176 int n = varseqref->
nxs;
177 int* indices = home.
alloc<
int>(
n);
178 for (
int i = 0 ;
i <
n ;
i++) {
179 VariableMap::const_iterator index =
180 variableMap.find(varseqref->
xs[
i]);
181 if (index == variableMap.end())
183 indices[
i] = index->second;
190 int *vs = home.
alloc<
int>(
n);
191 for (
unsigned int i = 0 ;
i <
n ;
i++)
204 dynamic_cast<VariableSymmetryObject*>(s.
ref);
206 dynamic_cast<ValueSymmetryObject*>(s.
ref);
208 dynamic_cast<VariableSequenceSymmetryObject*>(s.
ref);
210 dynamic_cast<ValueSequenceSymmetryObject*>(s.
ref);
213 int* indices = home.
alloc<
int>(
n);
214 for (
int i = 0 ;
i <
n ;
i++) {
215 VariableMap::const_iterator index = variableMap.find(varref->
xs[
i]);
216 if (index == variableMap.end())
218 indices[
i] = index->second;
224 int *vs = home.
alloc<
int>(
n);
233 int n = varseqref->
nxs;
234 int* indices = home.
alloc<
int>(
n);
235 for (
int i = 0 ;
i <
n ;
i++) {
236 VariableMap::const_iterator index =
237 variableMap.find(varseqref->
xs[
i]);
238 if (index == variableMap.end())
240 indices[
i] = index->second;
247 int *vs = home.
alloc<
int>(
n);
248 for (
unsigned int i = 0 ;
i <
n ;
i++)
260 using namespace Int::LDSB;
284 if (vals.
commit() != NULL)
292 for (
int i = 0 ;
i <
x.size() ;
i++)
293 variableMap[
x[
i].varimp()] =
i;
300 for (
int i = 0 ;
i <
n ;
i++) {
317 vars.
a.expand(home,
x);
321 vars.
b.expand(home,
x);
325 vars.
c.expand(home,
x);
329 vars.
d.expand(home,
x);
331 return branch(home,
x,vars.
a,vals,syms,bf,vvp);
336 for (
int i = 0 ;
i <
x.size() ;
i++)
337 variableMap[
x[
i].varimp()] =
i;
344 for (
int i = 0 ;
i <
n ;
i++) {
363 if (vals.
commit() != NULL)
387 if (vals.
commit() != NULL)
411 if (vals.
commit() != NULL)
442 for (
int i = 0 ;
i <
x.size() ;
i++)
443 variableMap[
x[
i].varimp()] =
i;
450 for (
int i = 0 ;
i <
n ;
i++) {
468 if (vals.
commit() != NULL)
488 vars.
a.expand(home,
x);
492 vars.
b.expand(home,
x);
496 vars.
c.expand(home,
x);
500 vars.
d.expand(home,
x);
502 return branch(home,
x,vars.
a,vals,syms,bf,vvp);
507 for (
int i = 0 ;
i <
x.size() ;
i++)
508 variableMap[
x[
i].varimp()] =
i;
515 for (
int i = 0 ;
i <
n ;
i++) {
533 if (vals.
commit() != NULL)
550 LDSBBrancher<BoolView,2,int,2>::post(home,xv,vs,vsc,array,
n,bf,vvp);
557 LDSBBrancher<BoolView,3,int,2>::post(home,xv,vs,vsc,array,
n,bf,vvp);
564 LDSBBrancher<BoolView,4,int,2>::post(home,xv,vs,vsc,array,
n,bf,vvp);
VarImpBase ** xs
Array of variables in symmetry.
IntVarBranch INT_VAR_NONE(void)
Select first unassigned variable.
bool(* BoolBranchFilter)(const Space &home, BoolVar x, int i)
Branch filter function type for Boolean variables.
Combine variable selection criteria for tie-breaking.
int size(void) const
Return size of array (number of elements)
IntSet values
Set of symmetric values.
IntArgs values
Array of values in symmetry.
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.
Which values to select for branching first.
Which variable to select for branching.
Implementation of a value symmetry at the modelling level.
SymmetryImp< IntView > * createIntSym(Space &home, const SymmetryHandle &s, VariableMap variableMap)
Create an integer symmetry implementation from a symmetry handle.
Implementation of a value sequence symmetry at the modelling level.
VoidFunction commit(void) const
Return commit function.
bool pos(const View &x)
Test whether x is postive.
Collection of symmetries.
Implementation of a variable sequence symmetry.
Select the smallest range of the variable domain if it has several ranges, otherwise select values no...
void(* BoolVarValPrint)(const Space &home, const BrancherHandle &bh, unsigned int a, BoolVar x, int i, const int &n, std::ostream &o)
Function type for printing branching alternatives for Boolean variables.
ViewSel< IntView > * viewselint(Space &home, const IntVarBranch &ivb)
Return view selectors for integer views.
bool(* IntBranchFilter)(const Space &home, IntVar x, int i)
Branch filter function type for integer variables.
Base class for value selection and commit.
int nxs
Number of variables in symmetry.
T * alloc(long unsigned int n)
Allocate block of n objects of type T from space heap.
SymmetryHandle VariableSymmetry(const IntVarArgs &vars)
Variables in x are interchangeable.
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
Argument array for non-primitive types.
Select all values starting from largest.
A reference-counted pointer to a SymmetryObject.
SymmetryHandle ValueSequenceSymmetry(const IntArgs &vs, int ss)
Value sequences in v of size ss are interchangeable.
Implementation of a variable symmetry at the modelling level.
Implementation of a value symmetry.
Select select(void) const
Return selection strategy.
unsigned int size(void) const
Return size (cardinality) of set.
bool failed(void) const
Check whether corresponding space is failed.
SymmetryHandle ValueSymmetry(const IntArgs &vs)
Values in v are interchangeable.
int nxs
Number of variables in symmetry.
int seq_size
Size of each sequence in symmetry.
ViewSel< BoolView > * viewselbool(Space &home, const IntVarBranch &ivb)
Return view selectors for Boolean views.
SymmetryImp< BoolView > * createBoolSym(Space &home, const SymmetryHandle &s, VariableMap variableMap)
Create a boolean symmetry implementation from a symmetry handle.
Implementation of a variable sequence symmetry at the modelling level.
VarImpBase ** xs
Array of variables in symmetry.
int seq_size
Size of each sequence in symmetry.
Exception: Variable in symmetry not branched on
Passing integer variables.
Passing integer arguments.
Passing Boolean variables.
Select values greater than mean of smallest and largest value.
struct Gecode::@511::NNF::@54::@56 a
For atomic nodes.
Exception: Value selection incompatible with LDSB
Select the largest range of the variable domain if it has several ranges, otherwise select values gre...
Implementation of a single symmetry.
void expand(Home home, const IntVarArgs &x)
Expand decay factor into AFC or activity.
Select values not greater than mean of smallest and largest value.
Node * x
Pointer to corresponding Boolean expression node.
ValSelCommitBase< IntView, int > * valselcommitint(Space &home, int n, const IntValBranch &ivb)
Return value and commit for integer views.
void(* IntVarValPrint)(const Space &home, const BrancherHandle &bh, unsigned int a, IntVar x, int i, const int &n, std::ostream &o)
Function type for printing branching alternatives for integer variables.
SymmetryHandle values_reflect(int lower, int upper)
The values from lower to upper (inclusive) can be reflected.
ValSelCommitBase< BoolView, int > * valselcommitbool(Space &home, int n, const IntValBranch &ivb)
Return value and commit for Boolean views.
Implementation of a variable symmetry.
Value iterator for integer sets.
Int::LDSB::SymmetryObject * ref
Symmetry object that this handle refers to.
Random (uniform, for tie breaking)
static BrancherHandle post(Home home, ViewArray< View > &x, ViewSel< View > *vs[n], ValSelCommitBase< View, Val > *vsc, SymmetryImp< View > **syms, int nsyms, BranchFilter bf, VarValPrint vvp)
Brancher post function.
VarBranch a
Branching criteria to try in order.
Implementation of a value sequence symmetry.
SymmetryHandle VariableSequenceSymmetry(const IntVarArgs &vars, int ss)
Variable sequences in x of size ss are interchangeable.
Gecode toplevel namespace
Map from variable implementation to index.
BrancherHandle branch(Home home, const FloatVarArgs &x, FloatVarBranch vars, FloatValBranch vals, FloatBranchFilter bf, FloatVarValPrint vvp)
Branch over x with variable selection vars and value selection vals.
Home class for posting propagators
Select value according to user-defined functions.
#define GECODE_NEVER
Assert that this command is never executed.
Select all values starting from smallest.