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