Generated on Sat Jun 2 2018 07:17:44 for Gecode by doxygen 1.8.13
ldsb.cpp
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /*
3  * Main authors:
4  * Christopher Mears <chris.mears@monash.edu>
5  *
6  * Copyright:
7  * Christopher Mears, 2012
8  *
9  * This file is part of Gecode, the generic constraint
10  * development environment:
11  * http://www.gecode.org
12  *
13  * Permission is hereby granted, free of charge, to any person obtaining
14  * a copy of this software and associated documentation files (the
15  * "Software"), to deal in the Software without restriction, including
16  * without limitation the rights to use, copy, modify, merge, publish,
17  * distribute, sublicense, and/or sell copies of the Software, and to
18  * permit persons to whom the Software is furnished to do so, subject to
19  * the following conditions:
20  *
21  * The above copyright notice and this permission notice shall be
22  * included in all copies or substantial portions of the Software.
23  *
24  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31  *
32  */
33 
34 #include <gecode/int/ldsb.hh>
35 #include <gecode/int/branch.hh>
36 
37 #include <map>
38 
39 namespace Gecode { namespace Int { namespace LDSB {
40 
41  std::pair<int,int>
42  findVar(int *indices, unsigned int n_values, unsigned int seq_size, int index) {
43  unsigned int seq = 0;
44  unsigned int pos = 0;
45  for (unsigned int i = 0 ; i < n_values ; i++) {
46  if (indices[i] == index)
47  return std::pair<int,int>(seq,pos);
48  pos++;
49  if (pos == seq_size) {
50  pos = 0;
51  seq++;
52  }
53  }
54  return std::pair<int,int>(-1,-1);
55  }
56 
57 }}}
58 
59 namespace Gecode {
60  using namespace Int::LDSB;
61 
64  for (int i = 0 ; i < vars.size() ; i++)
65  a[i] = vars[i].varimp();
67  }
70  for (int i = 0 ; i < vars.size() ; i++)
71  a[i] = vars[i].varimp();
73  }
75  const IntArgs& indices) {
76  IntVarArgs xs(indices.size());
77  for (int i = 0 ; i < indices.size() ; i++)
78  xs[i] = x[indices[i]];
79  return VariableSymmetry(xs);
80  }
82  return SymmetryHandle(new ValueSymmetryObject(IntSet(vs)));
83  }
85  return SymmetryHandle(new ValueSymmetryObject(vs));
86  }
88  return ValueSymmetry(IntSet(x.min(), x.max()));
89  }
92  for (int i = 0 ; i < vars.size() ; i++)
93  a[i] = vars[i].varimp();
95  }
98  for (int i = 0 ; i < vars.size() ; i++)
99  a[i] = vars[i].varimp();
101  }
103  return SymmetryHandle(new ValueSequenceSymmetryObject(vs, ss));
104  }
105 
106  SymmetryHandle values_reflect(int lower, int upper) {
107  int n = (upper-lower+1)/2;
108  IntArgs a(n*2);
109  int i = lower;
110  int j = upper;
111  int k = 0;
112  while (i < j) {
113  a[k] = j;
114  a[n+k] = i;
115  i++;
116  j--;
117  k++;
118  }
119  return ValueSequenceSymmetry(a,n);
120  }
122  return values_reflect(x.min(), x.max());
123  }
124 }
125 
126 
127 namespace Gecode { namespace Int { namespace LDSB {
128 
130  class VariableMap : public std::map<VarImpBase*,int> {};
131 
132  /*
133  * The duplication in createIntSym/createBoolSym is undesirable,
134  * and so is the use of dynamic_cast to tell the symmetries
135  * apart.
136  */
137 
141  VariableMap variableMap) {
142  VariableSymmetryObject* varref =
143  dynamic_cast<VariableSymmetryObject*>(s.ref);
144  ValueSymmetryObject* valref =
145  dynamic_cast<ValueSymmetryObject*>(s.ref);
146  VariableSequenceSymmetryObject* varseqref =
147  dynamic_cast<VariableSequenceSymmetryObject*>(s.ref);
148  ValueSequenceSymmetryObject* valseqref =
149  dynamic_cast<ValueSequenceSymmetryObject*>(s.ref);
150  if (varref) {
151  int n = varref->nxs;
152  int* indices = home.alloc<int>(n);
153  for (int i = 0 ; i < n ; i++) {
154  VariableMap::const_iterator index = variableMap.find(varref->xs[i]);
155  if (index == variableMap.end())
156  throw LDSBUnbranchedVariable("VariableSymmetryObject::createInt");
157  indices[i] = index->second;
158  }
159  return new (home) VariableSymmetryImp<IntView>(home, indices, n);
160  }
161  if (valref) {
162  int n = valref->values.size();
163  int *vs = home.alloc<int>(n);
164  int i = 0;
165  for (IntSetValues v(valref->values) ; v() ; ++v) {
166  vs[i] = v.val();
167  i++;
168  }
169  return new (home) ValueSymmetryImp<IntView>(home, vs, n);
170  }
171  if (varseqref) {
172  int n = varseqref->nxs;
173  int* indices = home.alloc<int>(n);
174  for (int i = 0 ; i < n ; i++) {
175  VariableMap::const_iterator index =
176  variableMap.find(varseqref->xs[i]);
177  if (index == variableMap.end())
178  throw LDSBUnbranchedVariable("VariableSequenceSymmetryObject::createInt");
179  indices[i] = index->second;
180  }
181  return new (home) VariableSequenceSymmetryImp<IntView>(home, indices, n,
182  varseqref->seq_size);
183  }
184  if (valseqref) {
185  unsigned int n = valseqref->values.size();
186  int *vs = home.alloc<int>(n);
187  for (unsigned int i = 0 ; i < n ; i++)
188  vs[i] = valseqref->values[i];
189  return new (home) ValueSequenceSymmetryImp<IntView>(home, vs, n,
190  valseqref->seq_size);
191  }
192  GECODE_NEVER;
193  return NULL;
194  }
195 
198  VariableMap variableMap) {
199  VariableSymmetryObject* varref =
200  dynamic_cast<VariableSymmetryObject*>(s.ref);
201  ValueSymmetryObject* valref =
202  dynamic_cast<ValueSymmetryObject*>(s.ref);
203  VariableSequenceSymmetryObject* varseqref =
204  dynamic_cast<VariableSequenceSymmetryObject*>(s.ref);
205  ValueSequenceSymmetryObject* valseqref =
206  dynamic_cast<ValueSequenceSymmetryObject*>(s.ref);
207  if (varref) {
208  int n = varref->nxs;
209  int* indices = home.alloc<int>(n);
210  for (int i = 0 ; i < n ; i++) {
211  VariableMap::const_iterator index = variableMap.find(varref->xs[i]);
212  if (index == variableMap.end())
213  throw LDSBUnbranchedVariable("VariableSymmetryObject::createBool");
214  indices[i] = index->second;
215  }
216  return new (home) VariableSymmetryImp<BoolView>(home, indices, n);
217  }
218  if (valref) {
219  int n = valref->values.size();
220  int *vs = home.alloc<int>(n);
221  int i = 0;
222  for (IntSetValues v(valref->values) ; v() ; ++v) {
223  vs[i] = v.val();
224  i++;
225  }
226  return new (home) ValueSymmetryImp<BoolView>(home, vs, n);
227  }
228  if (varseqref) {
229  int n = varseqref->nxs;
230  int* indices = home.alloc<int>(n);
231  for (int i = 0 ; i < n ; i++) {
232  VariableMap::const_iterator index =
233  variableMap.find(varseqref->xs[i]);
234  if (index == variableMap.end())
235  throw LDSBUnbranchedVariable("VariableSequenceSymmetryObject::createBool");
236  indices[i] = index->second;
237  }
238  return new (home) VariableSequenceSymmetryImp<BoolView>(home, indices,
239  n, varseqref->seq_size);
240  }
241  if (valseqref) {
242  unsigned int n = valseqref->values.size();
243  int *vs = home.alloc<int>(n);
244  for (unsigned int i = 0 ; i < n ; i++)
245  vs[i] = valseqref->values[i];
246  return new (home) ValueSequenceSymmetryImp<BoolView>(home, vs, n,
247  valseqref->seq_size);
248  }
249  GECODE_NEVER;
250  return NULL;
251  }
252 }}}
253 
254 namespace Gecode {
255 
256  using namespace Int::LDSB;
257 
258  void
259  branch(Home home, const IntVarArgs& x,
260  IntVarBranch vars, IntValBranch vals,
261  const Symmetries& syms,
262  IntBranchFilter bf,
263  IntVarValPrint vvp) {
264  using namespace Int;
265  if (home.failed()) return;
266  vars.expand(home,x);
267  ViewArray<IntView> xv(home,x);
268  ViewSel<IntView>* vs[1] = {
269  Branch::viewsel(home,vars)
270  };
271  switch (vals.select()) {
278  throw LDSBBadValueSelection("Int::LDSB::branch");
279  break;
281  if (vals.commit())
282  throw LDSBBadValueSelection("Int::LDSB::branch");
283  // If vals.commit() is valid, it means it will commit with
284  // binary branching, which is OK for LDSB, so we fall through.
285  default:
286  // Construct mapping from each variable in the array to its index
287  // in the array.
288  VariableMap variableMap;
289  for (int i = 0 ; i < x.size() ; i++)
290  variableMap[x[i].varimp()] = i;
291 
292  // Convert the modelling-level Symmetries object into an array of
293  // SymmetryImp objects.
294  int n = syms.size();
295  SymmetryImp<IntView>** array =
296  static_cast<Space&>(home).alloc<SymmetryImp<IntView>* >(n);
297  for (int i = 0 ; i < n ; i++) {
298  array[i] = createIntSym(home, syms[i], variableMap);
299  }
300 
301  postldsbbrancher<IntView,1,int,2>
302  (home,xv,vs,Branch::valselcommit(home,vals),
303  array,n,bf,vvp);
304  }
305  }
306 
307  void
308  branch(Home home, const IntVarArgs& x,
310  const Symmetries& syms,
311  IntBranchFilter bf,
312  IntVarValPrint vvp) {
313  using namespace Int;
314  if (home.failed()) return;
315  vars.a.expand(home,x);
316  if ((vars.a.select() == IntVarBranch::SEL_NONE) ||
317  (vars.a.select() == IntVarBranch::SEL_RND))
318  vars.b = INT_VAR_NONE();
319  vars.b.expand(home,x);
320  if ((vars.b.select() == IntVarBranch::SEL_NONE) ||
321  (vars.b.select() == IntVarBranch::SEL_RND))
322  vars.c = INT_VAR_NONE();
323  vars.c.expand(home,x);
324  if ((vars.c.select() == IntVarBranch::SEL_NONE) ||
325  (vars.c.select() == IntVarBranch::SEL_RND))
326  vars.d = INT_VAR_NONE();
327  vars.d.expand(home,x);
328  if (vars.b.select() == IntVarBranch::SEL_NONE) {
329  branch(home,x,vars.a,vals,syms,bf,vvp);
330  } else {
331  // Construct mapping from each variable in the array to its index
332  // in the array.
333  VariableMap variableMap;
334  for (int i = 0 ; i < x.size() ; i++)
335  variableMap[x[i].varimp()] = i;
336 
337  // Convert the modelling-level Symmetries object into an array of
338  // SymmetryImp objects.
339  int n = syms.size();
340  SymmetryImp<IntView>** array =
341  static_cast<Space&>(home).alloc<SymmetryImp<IntView>* >(n);
342  for (int i = 0 ; i < n ; i++) {
343  array[i] = createIntSym(home, syms[i], variableMap);
344  }
345 
346  ViewArray<IntView> xv(home,x);
347  if (vars.c.select() == IntVarBranch::SEL_NONE) {
348  ViewSel<IntView>* vs[2] = {
349  Branch::viewsel(home,vars.a),Branch::viewsel(home,vars.b)
350  };
351  switch (vals.select()) {
358  throw LDSBBadValueSelection("Int::LDSB::branch");
359  break;
361  if (vals.commit())
362  throw LDSBBadValueSelection("Int::LDSB::branch");
363  // If vals.commit() is valid, it means it will commit with
364  // binary branching, which is OK for LDSB, so we fall through.
365  default:
366  postldsbbrancher<IntView,2,int,2>
367  (home,xv,vs,Branch::valselcommit(home,vals),
368  array,n,bf,vvp);
369  }
370  } else if (vars.d.select() == IntVarBranch::SEL_NONE) {
371  ViewSel<IntView>* vs[3] = {
372  Branch::viewsel(home,vars.a),Branch::viewsel(home,vars.b),
373  Branch::viewsel(home,vars.c)
374  };
375  switch (vals.select()) {
382  throw LDSBBadValueSelection("Int::LDSB::branch");
383  break;
385  if (vals.commit())
386  throw LDSBBadValueSelection("Int::LDSB::branch");
387  // If vals.commit() is valid, it means it will commit with
388  // binary branching, which is OK for LDSB, so we fall through.
389  default:
390  postldsbbrancher<IntView,3,int,2>
391  (home,xv,vs,Branch::valselcommit(home,vals),
392  array,n,bf,vvp);
393  }
394  } else {
395  ViewSel<IntView>* vs[4] = {
396  Branch::viewsel(home,vars.a),Branch::viewsel(home,vars.b),
397  Branch::viewsel(home,vars.c),Branch::viewsel(home,vars.d)
398  };
399  switch (vals.select()) {
406  throw LDSBBadValueSelection("Int::LDSB::branch");
407  break;
409  if (vals.commit())
410  throw LDSBBadValueSelection("Int::LDSB::branch");
411  // If vals.commit() is valid, it means it will commit with
412  // binary branching, which is OK for LDSB, so we fall through.
413  default:
414  postldsbbrancher<IntView,4,int,2>
415  (home,xv,vs,Branch::valselcommit(home,vals),
416  array,n,bf,vvp);
417  }
418  }
419  }
420  }
421 
422  void
423  branch(Home home, const BoolVarArgs& x,
424  BoolVarBranch vars, BoolValBranch vals,
425  const Symmetries& syms,
426  BoolBranchFilter bf,
427  BoolVarValPrint vvp) {
428  using namespace Int;
429  if (home.failed()) return;
430  vars.expand(home,x);
431  ViewArray<BoolView> xv(home,x);
432  ViewSel<BoolView>* vs[1] = {
433  Branch::viewsel(home,vars)
434  };
435 
436  // Construct mapping from each variable in the array to its index
437  // in the array.
438  VariableMap variableMap;
439  for (int i = 0 ; i < x.size() ; i++)
440  variableMap[x[i].varimp()] = i;
441 
442  // Convert the modelling-level Symmetries object into an array of
443  // SymmetryImp objects.
444  int n = syms.size();
445  SymmetryImp<BoolView>** array =
446  static_cast<Space&>(home).alloc<SymmetryImp<BoolView>* >(n);
447  for (int i = 0 ; i < n ; i++) {
448  array[i] = createBoolSym(home, syms[i], variableMap);
449  }
450 
451  // Technically these "bad" value selection could in fact work with
452  // LDSB, because they degenerate to binary splitting for
453  // Booleans. Nonetheless, we explicitly forbid them for
454  // consistency with the integer version.
455  switch (vals.select()) {
457  if (vals.commit())
458  throw LDSBBadValueSelection("Int::LDSB::branch");
459  // If vals.commit() is valid, it means it will commit with
460  // binary branching, which is OK for LDSB, so we fall through.
461  default:
462  postldsbbrancher<BoolView,1,int,2>
463  (home,xv,vs,Branch::valselcommit(home,vals),array,n,bf,vvp);
464  }
465  }
466 
467 
468  void
469  branch(Home home, const BoolVarArgs& x,
471  const Symmetries& syms,
472  BoolBranchFilter bf,
473  BoolVarValPrint vvp) {
474  using namespace Int;
475  if (home.failed()) return;
476  vars.a.expand(home,x);
477  if ((vars.a.select() == BoolVarBranch::SEL_NONE) ||
478  (vars.a.select() == BoolVarBranch::SEL_RND))
479  vars.b = BOOL_VAR_NONE();
480  vars.b.expand(home,x);
481  if ((vars.b.select() == BoolVarBranch::SEL_NONE) ||
482  (vars.b.select() == BoolVarBranch::SEL_RND))
483  vars.c = BOOL_VAR_NONE();
484  vars.c.expand(home,x);
485  if ((vars.c.select() == BoolVarBranch::SEL_NONE) ||
486  (vars.c.select() == BoolVarBranch::SEL_RND))
487  vars.d = BOOL_VAR_NONE();
488  vars.d.expand(home,x);
489  if (vars.b.select() == BoolVarBranch::SEL_NONE) {
490  branch(home,x,vars.a,vals,syms,bf,vvp);
491  } else {
492  // Construct mapping from each variable in the array to its index
493  // in the array.
494  VariableMap variableMap;
495  for (int i = 0 ; i < x.size() ; i++)
496  variableMap[x[i].varimp()] = i;
497 
498  // Convert the modelling-level Symmetries object into an array of
499  // SymmetryImp objects.
500  int n = syms.size();
501  SymmetryImp<BoolView>** array =
502  static_cast<Space&>(home).alloc<SymmetryImp<BoolView>* >(n);
503  for (int i = 0 ; i < n ; i++) {
504  array[i] = createBoolSym(home, syms[i], variableMap);
505  }
506 
507  // Technically these "bad" value selection could in fact work with
508  // LDSB, because they degenerate to binary splitting for
509  // Booleans. Nonetheless, we explicitly forbid them for
510  // consistency with the integer version.
511  switch (vals.select()) {
513  if (vals.commit())
514  throw LDSBBadValueSelection("Int::LDSB::branch");
515  // If vals.commit() is valid, it means it will commit with
516  // binary branching, which is OK for LDSB, so we fall through.
517  default:
518  ;
519  // Do nothing and continue.
520  }
521 
522  ViewArray<BoolView> xv(home,x);
524  vsc = Branch::valselcommit(home,vals);
525  if (vars.c.select() == BoolVarBranch::SEL_NONE) {
526  ViewSel<BoolView>* vs[2] = {
527  Branch::viewsel(home,vars.a),Branch::viewsel(home,vars.b)
528  };
529  postldsbbrancher<BoolView,2,int,2>(home,xv,vs,vsc,array,n,bf,vvp);
530  } else if (vars.d.select() == BoolVarBranch::SEL_NONE) {
531  ViewSel<BoolView>* vs[3] = {
532  Branch::viewsel(home,vars.a),Branch::viewsel(home,vars.b),
533  Branch::viewsel(home,vars.c)
534  };
535  postldsbbrancher<BoolView,3,int,2>(home,xv,vs,vsc,array,n,bf,vvp);
536  } else {
537  ViewSel<BoolView>* vs[4] = {
538  Branch::viewsel(home,vars.a),Branch::viewsel(home,vars.b),
539  Branch::viewsel(home,vars.c),Branch::viewsel(home,vars.d)
540  };
541  postldsbbrancher<BoolView,4,int,2>(home,xv,vs,vsc,array,n,bf,vvp);
542  }
543  }
544  }
545 
546 }
547 
548 
549 
550 // STATISTICS: int-branch
ViewSel< IntView > * viewsel(Space &home, const IntVarBranch &ivb)
Return view selectors for integer views.
Definition: view-sel.cpp:39
Select value according to user-defined functions.
Definition: int.hh:4689
VarImpBase ** xs
Array of variables in symmetry.
Definition: ldsb.hh:119
IntVarBranch INT_VAR_NONE(void)
Select first unassigned variable.
Definition: var.hpp:96
Combine variable selection criteria for tie-breaking.
Definition: tiebreak.hpp:38
BoolVarBranch BOOL_VAR_NONE(void)
Select first unassigned variable.
Definition: var.hpp:364
int size(void) const
Return size of array (number of elements)
Definition: array.hpp:1653
VarBranch c
Definition: tiebreak.hpp:41
IntSet values
Set of symmetric values.
Definition: ldsb.hh:131
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.
Definition: branch.cpp:39
Which values to select for branching first.
Definition: int.hh:4682
IntArgs values
Array of values in symmetry.
Definition: ldsb.hh:153
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.
Definition: ldsb.cpp:42
Which values to select for branching first.
Definition: int.hh:4647
Which integer variable to select for branching.
Definition: int.hh:4363
Implementation of a value symmetry at the modelling level.
Definition: ldsb.hh:128
SymmetryImp< IntView > * createIntSym(Space &home, const SymmetryHandle &s, VariableMap variableMap)
Create an integer symmetry implementation from a symmetry handle.
Definition: ldsb.cpp:140
Implementation of a value sequence symmetry at the modelling level.
Definition: ldsb.hh:150
bool pos(const View &x)
Test whether x is postive.
Definition: mult.hpp:41
First unassigned.
Definition: int.hh:4367
Collection of symmetries.
Definition: int.hh:5018
Implementation of a variable sequence symmetry.
Definition: ldsb.hh:223
Select the smallest range of the variable domain if it has several ranges, otherwise select values no...
Definition: int.hh:4657
Computation spaces.
Definition: core.hpp:1701
Base class for value selection and commit.
int nxs
Number of variables in symmetry.
Definition: ldsb.hh:141
Random (uniform, for tie breaking)
Definition: int.hh:4454
T * alloc(long unsigned int n)
Allocate block of n objects of type T from space heap.
Definition: core.hpp:2794
SymmetryHandle VariableSymmetry(const IntVarArgs &vars)
Variables in x are interchangeable.
Definition: ldsb.cpp:62
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:234
Argument array for non-primitive types.
Definition: array.hpp:711
Select all values starting from largest.
Definition: int.hh:4661
A reference-counted pointer to a SymmetryObject.
Definition: int.hh:4981
SymmetryHandle ValueSequenceSymmetry(const IntArgs &vs, int ss)
Value sequences in v of size ss are interchangeable.
Definition: ldsb.cpp:102
Implementation of a variable symmetry at the modelling level.
Definition: ldsb.hh:116
Implementation of a value symmetry.
Definition: ldsb.hh:203
Select select(void) const
Return selection strategy.
Definition: val.hpp:49
VarBranch b
Definition: tiebreak.hpp:41
unsigned int size(void) const
Return size (cardinality) of set.
Definition: int-set-1.hpp:157
bool failed(void) const
Check whether corresponding space is failed.
Definition: core.hpp:3967
SymmetryHandle ValueSymmetry(const IntArgs &vs)
Values in v are interchangeable.
Definition: ldsb.cpp:81
int nxs
Number of variables in symmetry.
Definition: ldsb.hh:121
int seq_size
Size of each sequence in symmetry.
Definition: ldsb.hh:143
SymmetryImp< BoolView > * createBoolSym(Space &home, const SymmetryHandle &s, VariableMap variableMap)
Create a boolean symmetry implementation from a symmetry handle.
Definition: ldsb.cpp:197
Implementation of a variable sequence symmetry at the modelling level.
Definition: ldsb.hh:136
Which Boolean variable to select for branching.
Definition: int.hh:4449
Integer sets.
Definition: int.hh:170
VarImpBase ** xs
Array of variables in symmetry.
Definition: ldsb.hh:139
std::function< bool(const Space &home, IntVar x, int i)> IntBranchFilter
Branch filter function type for integer variables.
Definition: int.hh:3969
int seq_size
Size of each sequence in symmetry.
Definition: ldsb.hh:155
Exception: Variable in symmetry not branched on
Definition: exception.hpp:150
ValSelCommitBase< IntView, int > * valselcommit(Space &home, const IntValBranch &ivb)
Return value and commit for integer views.
Passing integer variables.
Definition: int.hh:633
Passing integer arguments.
Definition: int.hh:604
Passing Boolean variables.
Definition: int.hh:687
Select values greater than mean of smallest and largest value.
Definition: int.hh:4656
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.
Definition: int.hh:4345
const int v[7]
Definition: distinct.cpp:259
int max(void) const
Return maximum of domain.
Definition: int.hpp:70
Exception: Value selection incompatible with LDSB
Definition: exception.hpp:157
Select the largest range of the variable domain if it has several ranges, otherwise select values gre...
Definition: int.hh:4658
Implementation of a single symmetry.
Definition: ldsb.hh:162
std::function< bool(const Space &home, BoolVar x, int i)> BoolBranchFilter
Branch filter function type for Boolean variables.
Definition: int.hh:3979
void expand(Home home, const IntVarArgs &x)
Expand AFC, action, and CHB.
Definition: var.hpp:74
Select values not greater than mean of smallest and largest value.
Definition: int.hh:4655
struct Gecode::@585::NNF::@62::@64 a
For atomic nodes.
int min(void) const
Return minimum of domain.
Definition: int.hpp:62
Integer variables.
Definition: int.hh:347
SymmetryHandle values_reflect(int lower, int upper)
The values from lower to upper (inclusive) can be reflected.
Definition: ldsb.cpp:106
Implementation of a variable symmetry.
Definition: ldsb.hh:183
Value iterator for integer sets.
Definition: int.hh:309
Int::LDSB::SymmetryObject * ref
Symmetry object that this handle refers to.
Definition: int.hh:4984
Random (uniform, for tie breaking)
Definition: int.hh:4368
VarBranch a
Branching criteria to try in order.
Definition: tiebreak.hpp:41
BranchCommit commit(void) const
Return commit function.
Definition: val.hpp:102
Implementation of a value sequence symmetry.
Definition: ldsb.hh:265
Post propagator for SetVar x
Definition: set.hh:765
First unassigned.
Definition: int.hh:4453
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.
Definition: int.hh:4352
SymmetryHandle VariableSequenceSymmetry(const IntVarArgs &vars, int ss)
Variable sequences in x of size ss are interchangeable.
Definition: ldsb.cpp:90
Gecode toplevel namespace
void expand(Home home, const BoolVarArgs &x)
Expand decay factor into AFC or action.
Definition: var.hpp:345
Map from variable implementation to index.
Definition: ldsb.cpp:130
Home class for posting propagators
Definition: core.hpp:853
Select value according to user-defined functions.
Definition: int.hh:4659
#define GECODE_NEVER
Assert that this command is never executed.
Definition: macros.hpp:56
VarBranch d
Definition: tiebreak.hpp:41
Select select(void) const
Return selection strategy.
Definition: val.hpp:124
Select all values starting from smallest.
Definition: int.hh:4660