Go to the documentation of this file.
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 {
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;
189 unsigned int n = valseqref->
values.size();
190 int *vs = home.
alloc<
int>(
n);
191 for (
unsigned int i = 0 ;
i <
n ;
i++)
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;
246 unsigned int n = valseqref->
values.size();
247 int *vs = home.
alloc<
int>(
n);
248 for (
unsigned int i = 0 ;
i <
n ;
i++)
260 using namespace Int::LDSB;
269 if (home.
failed())
return;
293 for (
int i = 0 ;
i <
x.size() ;
i++)
294 variableMap[
x[
i].varimp()] =
i;
301 for (
int i = 0 ;
i <
n ;
i++) {
305 postldsbbrancher<IntView,1,int,2>
318 if (home.
failed())
return;
319 vars.
a.expand(home,
x);
323 vars.
b.expand(home,
x);
327 vars.
c.expand(home,
x);
331 vars.
d.expand(home,
x);
333 branch(home,
x,vars.
a,vals,syms,bf,vvp);
338 for (
int i = 0 ;
i <
x.size() ;
i++)
339 variableMap[
x[
i].varimp()] =
i;
346 for (
int i = 0 ;
i <
n ;
i++) {
370 postldsbbrancher<IntView,2,int,2>
394 postldsbbrancher<IntView,3,int,2>
418 postldsbbrancher<IntView,4,int,2>
433 if (home.
failed())
return;
443 for (
int i = 0 ;
i <
x.size() ;
i++)
444 variableMap[
x[
i].varimp()] =
i;
451 for (
int i = 0 ;
i <
n ;
i++) {
466 postldsbbrancher<BoolView,1,int,2>
479 if (home.
failed())
return;
480 vars.
a.expand(home,
x);
484 vars.
b.expand(home,
x);
488 vars.
c.expand(home,
x);
492 vars.
d.expand(home,
x);
494 branch(home,
x,vars.
a,vals,syms,bf,vvp);
499 for (
int i = 0 ;
i <
x.size() ;
i++)
500 variableMap[
x[
i].varimp()] =
i;
507 for (
int i = 0 ;
i <
n ;
i++) {
533 postldsbbrancher<BoolView,2,int,2>(home,xv,vs,vsc,array,
n,bf,vvp);
539 postldsbbrancher<BoolView,3,int,2>(home,xv,vs,vsc,array,
n,bf,vvp);
545 postldsbbrancher<BoolView,4,int,2>(home,xv,vs,vsc,array,
n,bf,vvp);
int seq_size
Size of each sequence in symmetry.
Post propagator for SetVar x
VarImpBase ** xs
Array of variables in symmetry.
@ SEL_RANGE_MAX
Select the largest range of the variable domain if it has several ranges, otherwise select values gre...
Combine variable selection criteria for tie-breaking.
SymmetryHandle VariableSymmetry(const IntVarArgs &vars)
Variables in x are interchangeable.
@ SEL_RND
Random (uniform, for tie breaking)
@ SEL_SPLIT_MIN
Select values not greater than mean of smallest and largest value.
IntVarBranch INT_VAR_NONE(void)
Select first unassigned variable.
IntSet values
Set of symmetric values.
VarImpBase ** xs
Array of variables in symmetry.
Passing integer variables.
SymmetryHandle ValueSequenceSymmetry(const IntArgs &vs, int ss)
Value sequences in v of size ss are interchangeable.
ViewSel< IntView > * viewsel(Space &home, const IntVarBranch &ivb)
Return view selectors for integer views.
Implementation of a value symmetry.
std::function< void(const Space &home, const Brancher &b, unsigned int a, BoolVar x, int i, const int &n, std::ostream &o)> BoolVarValPrint
Function type for printing branching alternatives for Boolean variables.
Gecode::IntArgs i(4, 1, 2, 3, 4)
@ SEL_RND
Random (uniform, for tie breaking)
Which values to select for branching first.
void 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.
Which integer variable to select for branching.
@ SEL_VAL_COMMIT
Select value according to user-defined functions.
Exception: Value selection incompatible with LDSB
BranchCommit commit(void) const
Return commit function.
Implementation of a variable symmetry.
unsigned int size(void) const
Return size (cardinality) of set.
Collection of symmetries.
Gecode toplevel namespace
IntArgs values
Array of values in symmetry.
@ SEL_VAL_COMMIT
Select value according to user-defined functions.
SymmetryImp< BoolView > * createBoolSym(Space &home, const SymmetryHandle &s, VariableMap variableMap)
Create a boolean symmetry implementation from a symmetry handle.
Implementation of a value sequence symmetry at the modelling level.
Argument array for non-primitive types.
Which Boolean variable to select for branching.
Implementation of a variable sequence symmetry.
Passing Boolean variables.
Home class for posting propagators
struct Gecode::@579::NNF::@61::@63 a
For atomic nodes.
SymmetryImp< IntView > * createIntSym(Space &home, const SymmetryHandle &s, VariableMap variableMap)
Create an integer symmetry implementation from a symmetry handle.
int nxs
Number of variables in symmetry.
Implementation of a variable symmetry at the modelling level.
@ SEL_SPLIT_MAX
Select values greater than mean of smallest and largest value.
Select select(void) const
Return selection strategy.
int nxs
Number of variables in symmetry.
Implementation of a value symmetry at the modelling level.
T * alloc(long unsigned int n)
Allocate block of n objects of type T from space heap.
Implementation of a value sequence symmetry.
@ SEL_VALUES_MIN
Select all values starting from smallest.
@ SEL_NONE
First unassigned.
#define GECODE_NEVER
Assert that this command is never executed.
Base class for value selection and commit.
Exception: Variable in symmetry not branched on
void expand(Home home, const IntVarArgs &x)
Expand AFC, action, and CHB.
@ SEL_RANGE_MIN
Select the smallest range of the variable domain if it has several ranges, otherwise select values no...
bool failed(void) const
Check whether corresponding space is failed.
A reference-counted pointer to a SymmetryObject.
void expand(Home home, const BoolVarArgs &x)
Expand decay factor into AFC or action.
SymmetryHandle ValueSymmetry(const IntArgs &vs)
Values in v are interchangeable.
SymmetryHandle values_reflect(int lower, int upper)
The values from lower to upper (inclusive) can be reflected.
SymmetryHandle VariableSequenceSymmetry(const IntVarArgs &vars, int ss)
Variable sequences in x of size ss are interchangeable.
std::function< bool(const Space &home, IntVar x, int i)> IntBranchFilter
Branch filter function type for integer variables.
Implementation of a variable sequence symmetry at the modelling level.
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.
@ SEL_VALUES_MAX
Select all values starting from largest.
int seq_size
Size of each sequence in symmetry.
Map from variable implementation to index.
Int::LDSB::SymmetryObject * ref
Symmetry object that this handle refers to.
Implementation of a single symmetry.
int n
Number of negative literals for node type.
ValSelCommitBase< IntView, int > * valselcommit(Space &home, const IntValBranch &ivb)
Return value and commit for integer views.
std::function< bool(const Space &home, BoolVar x, int i)> BoolBranchFilter
Branch filter function type for Boolean variables.
@ SEL_NONE
First unassigned.
Passing integer arguments.
Select select(void) const
Return selection strategy.
Value iterator for integer sets.
bool pos(const View &x)
Test whether x is postive.
BoolVarBranch BOOL_VAR_NONE(void)
Select first unassigned variable.
std::function< void(const Space &home, const Brancher &b, unsigned int a, IntVar x, int i, const int &n, std::ostream &o)> IntVarValPrint
Function type for printing branching alternatives for integer variables.
VarBranch a
Branching criteria to try in order.
Which values to select for branching first.