Generated on Thu Mar 16 2017 03:24:20 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  * Last modified:
10  * $Date: 2016-05-26 13:44:53 +0200 (Thu, 26 May 2016) $ by $Author: schulte $
11  * $Revision: 15087 $
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,
267  using namespace Int;
268  if (home.failed()) return;
269  vars.expand(home,x);
270  ViewArray<IntView> xv(home,x);
271  ViewSel<IntView>* vs[1] = {
272  Branch::viewselint(home,vars)
273  };
274  switch (vals.select()) {
281  throw LDSBBadValueSelection("Int::LDSB::branch");
282  break;
284  if (vals.commit() != NULL)
285  throw LDSBBadValueSelection("Int::LDSB::branch");
286  // If vals.commit() returns NULL, it means it will commit with
287  // binary branching, which is OK for LDSB, so we fall through.
288  default:
289  // Construct mapping from each variable in the array to its index
290  // in the array.
291  VariableMap variableMap;
292  for (int i = 0 ; i < x.size() ; i++)
293  variableMap[x[i].varimp()] = i;
294 
295  // Convert the modelling-level Symmetries object into an array of
296  // SymmetryImp objects.
297  int n = syms.size();
298  SymmetryImp<IntView>** array =
299  static_cast<Space&>(home).alloc<SymmetryImp<IntView>* >(n);
300  for (int i = 0 ; i < n ; i++) {
301  array[i] = createIntSym(home, syms[i], variableMap);
302  }
303 
305  (home,xv,vs,Branch::valselcommitint(home,x.size(),vals),
306  array,n,bf,vvp);
307  }
308  }
309 
310  void
311  branch(Home home, const IntVarArgs& x,
313  const Symmetries& syms,
315  using namespace Int;
316  if (home.failed()) return;
317  vars.a.expand(home,x);
318  if ((vars.a.select() == IntVarBranch::SEL_NONE) ||
319  (vars.a.select() == IntVarBranch::SEL_RND))
320  vars.b = INT_VAR_NONE();
321  vars.b.expand(home,x);
322  if ((vars.b.select() == IntVarBranch::SEL_NONE) ||
323  (vars.b.select() == IntVarBranch::SEL_RND))
324  vars.c = INT_VAR_NONE();
325  vars.c.expand(home,x);
326  if ((vars.c.select() == IntVarBranch::SEL_NONE) ||
327  (vars.c.select() == IntVarBranch::SEL_RND))
328  vars.d = INT_VAR_NONE();
329  vars.d.expand(home,x);
330  if (vars.b.select() == IntVarBranch::SEL_NONE) {
331  branch(home,x,vars.a,vals,syms,bf,vvp);
332  } else {
333  // Construct mapping from each variable in the array to its index
334  // in the array.
335  VariableMap variableMap;
336  for (int i = 0 ; i < x.size() ; i++)
337  variableMap[x[i].varimp()] = i;
338 
339  // Convert the modelling-level Symmetries object into an array of
340  // SymmetryImp objects.
341  int n = syms.size();
342  SymmetryImp<IntView>** array =
343  static_cast<Space&>(home).alloc<SymmetryImp<IntView>* >(n);
344  for (int i = 0 ; i < n ; i++) {
345  array[i] = createIntSym(home, syms[i], variableMap);
346  }
347 
348  ViewArray<IntView> xv(home,x);
349  if (vars.c.select() == IntVarBranch::SEL_NONE) {
350  ViewSel<IntView>* vs[2] = {
351  Branch::viewselint(home,vars.a),Branch::viewselint(home,vars.b)
352  };
353  switch (vals.select()) {
360  throw LDSBBadValueSelection("Int::LDSB::branch");
361  break;
363  if (vals.commit() != NULL)
364  throw LDSBBadValueSelection("Int::LDSB::branch");
365  // If vals.commit() returns NULL, it means it will commit with
366  // binary branching, which is OK for LDSB, so we fall through.
367  default:
369  ::post(home,xv,vs,Branch::valselcommitint(home,x.size(),vals),
370  array,n,bf,vvp);
371  }
372  } else if (vars.d.select() == IntVarBranch::SEL_NONE) {
373  ViewSel<IntView>* vs[3] = {
374  Branch::viewselint(home,vars.a),Branch::viewselint(home,vars.b),
375  Branch::viewselint(home,vars.c)
376  };
377  switch (vals.select()) {
384  throw LDSBBadValueSelection("Int::LDSB::branch");
385  break;
387  if (vals.commit() != NULL)
388  throw LDSBBadValueSelection("Int::LDSB::branch");
389  // If vals.commit() returns NULL, it means it will commit with
390  // binary branching, which is OK for LDSB, so we fall through.
391  default:
393  ::post(home,xv,vs,Branch::valselcommitint(home,x.size(),vals),
394  array,n,bf,vvp);
395  }
396  } else {
397  ViewSel<IntView>* vs[4] = {
398  Branch::viewselint(home,vars.a),Branch::viewselint(home,vars.b),
399  Branch::viewselint(home,vars.c),Branch::viewselint(home,vars.d)
400  };
401  switch (vals.select()) {
408  throw LDSBBadValueSelection("Int::LDSB::branch");
409  break;
411  if (vals.commit() != NULL)
412  throw LDSBBadValueSelection("Int::LDSB::branch");
413  // If vals.commit() returns NULL, it means it will commit with
414  // binary branching, which is OK for LDSB, so we fall through.
415  default:
417  ::post(home,xv,vs,Branch::valselcommitint(home,x.size(),vals),
418  array,n,bf,vvp);
419  }
420  }
421  }
422  }
423 
424  void
425  branch(Home home, const BoolVarArgs& x,
426  IntVarBranch vars, IntValBranch vals,
427  const Symmetries& syms,
429  using namespace Int;
430  if (home.failed()) return;
431  vars.expand(home,x);
432  ViewArray<BoolView> xv(home,x);
433  ViewSel<BoolView>* vs[1] = {
434  Branch::viewselbool(home,vars)
435  };
436 
437  // Construct mapping from each variable in the array to its index
438  // in the array.
439  VariableMap variableMap;
440  for (int i = 0 ; i < x.size() ; i++)
441  variableMap[x[i].varimp()] = i;
442 
443  // Convert the modelling-level Symmetries object into an array of
444  // SymmetryImp objects.
445  int n = syms.size();
446  SymmetryImp<BoolView>** array =
447  static_cast<Space&>(home).alloc<SymmetryImp<BoolView>* >(n);
448  for (int i = 0 ; i < n ; i++) {
449  array[i] = createBoolSym(home, syms[i], variableMap);
450  }
451 
452  // Technically these "bad" value selection could in fact work with
453  // LDSB, because they degenerate to binary splitting for
454  // Booleans. Nonetheless, we explicitly forbid them for
455  // consistency with the integer version.
456  switch (vals.select()) {
463  throw LDSBBadValueSelection("Int::LDSB::branch");
464  break;
466  if (vals.commit() != NULL)
467  throw LDSBBadValueSelection("Int::LDSB::branch");
468  // If vals.commit() returns NULL, it means it will commit with
469  // binary branching, which is OK for LDSB, so we fall through.
470  default:
472  (home,xv,vs,Branch::valselcommitbool(home,x.size(),vals),array,n,bf,vvp);
473  }
474  }
475 
476 
477  void
478  branch(Home home, const BoolVarArgs& x,
480  const Symmetries& syms,
482  using namespace Int;
483  if (home.failed()) return;
484  vars.a.expand(home,x);
485  if ((vars.a.select() == IntVarBranch::SEL_NONE) ||
486  (vars.a.select() == IntVarBranch::SEL_RND))
487  vars.b = INT_VAR_NONE();
488  vars.b.expand(home,x);
489  if ((vars.b.select() == IntVarBranch::SEL_NONE) ||
490  (vars.b.select() == IntVarBranch::SEL_RND))
491  vars.c = INT_VAR_NONE();
492  vars.c.expand(home,x);
493  if ((vars.c.select() == IntVarBranch::SEL_NONE) ||
494  (vars.c.select() == IntVarBranch::SEL_RND))
495  vars.d = INT_VAR_NONE();
496  vars.d.expand(home,x);
497  if (vars.b.select() == IntVarBranch::SEL_NONE) {
498  branch(home,x,vars.a,vals,syms,bf,vvp);
499  } else {
500  // Construct mapping from each variable in the array to its index
501  // in the array.
502  VariableMap variableMap;
503  for (int i = 0 ; i < x.size() ; i++)
504  variableMap[x[i].varimp()] = i;
505 
506  // Convert the modelling-level Symmetries object into an array of
507  // SymmetryImp objects.
508  int n = syms.size();
509  SymmetryImp<BoolView>** array =
510  static_cast<Space&>(home).alloc<SymmetryImp<BoolView>* >(n);
511  for (int i = 0 ; i < n ; i++) {
512  array[i] = createBoolSym(home, syms[i], variableMap);
513  }
514 
515  // Technically these "bad" value selection could in fact work with
516  // LDSB, because they degenerate to binary splitting for
517  // Booleans. Nonetheless, we explicitly forbid them for
518  // consistency with the integer version.
519  switch (vals.select()) {
526  throw LDSBBadValueSelection("Int::LDSB::branch");
527  break;
529  if (vals.commit() != NULL)
530  throw LDSBBadValueSelection("Int::LDSB::branch");
531  // If vals.commit() returns NULL, it means it will commit with
532  // binary branching, which is OK for LDSB, so we fall through.
533  default:
534  ;
535  // Do nothing and continue.
536  }
537 
538  ViewArray<BoolView> xv(home,x);
540  vsc = Branch::valselcommitbool(home,x.size(),vals);
541  if (vars.c.select() == IntVarBranch::SEL_NONE) {
542  ViewSel<BoolView>* vs[2] = {
543  Branch::viewselbool(home,vars.a),Branch::viewselbool(home,vars.b)
544  };
545  LDSBBrancher<BoolView,2,int,2>::post(home,xv,vs,vsc,array,n,bf,vvp);
546  } else if (vars.d.select() == IntVarBranch::SEL_NONE) {
547  ViewSel<BoolView>* vs[3] = {
548  Branch::viewselbool(home,vars.a),Branch::viewselbool(home,vars.b),
549  Branch::viewselbool(home,vars.c)
550  };
551  LDSBBrancher<BoolView,3,int,2>::post(home,xv,vs,vsc,array,n,bf,vvp);
552  } else {
553  ViewSel<BoolView>* vs[4] = {
554  Branch::viewselbool(home,vars.a),Branch::viewselbool(home,vars.b),
555  Branch::viewselbool(home,vars.c),Branch::viewselbool(home,vars.d)
556  };
557  LDSBBrancher<BoolView,4,int,2>::post(home,xv,vs,vsc,array,n,bf,vvp);
558  }
559  }
560  }
561 
562 }
563 
564 
565 
566 // STATISTICS: int-branch
VarImpBase ** xs
Array of variables in symmetry.
Definition: ldsb.hh:123
IntVarBranch INT_VAR_NONE(void)
Select first unassigned variable.
Definition: var.hpp:108
bool(* BoolBranchFilter)(const Space &home, BoolVar x, int i)
Branch filter function type for Boolean variables.
Definition: int.hh:3749
Combine variable selection criteria for tie-breaking.
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
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:4153
Which variable to select for branching.
Definition: int.hh:3970
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
VoidFunction commit(void) const
Return commit function.
Definition: branch-val.hpp:94
bool pos(const View &x)
Test whether x is postive.
Definition: mult.hpp:45
First unassigned.
Definition: int.hh:3974
Collection of symmetries.
Definition: int.hh:4472
void(* BoolVarValPrint)(const Space &home, const Brancher &b, unsigned int a, BoolVar x, int i, const int &n, std::ostream &o)
Function type for printing branching alternatives for Boolean variables.
Definition: int.hh:3956
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:4163
ViewSel< IntView > * viewselint(Space &home, const IntVarBranch &ivb)
Return view selectors for integer views.
Definition: view-sel.cpp:43
bool(* IntBranchFilter)(const Space &home, IntVar x, int i)
Branch filter function type for integer variables.
Definition: int.hh:3740
Computation spaces.
Definition: core.hpp:1672
Base class for value selection and commit.
int nxs
Number of variables in symmetry.
Definition: ldsb.hh:145
T * alloc(long unsigned int n)
Allocate block of n objects of type T from space heap.
Definition: core.hpp:2783
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
SymmetryHandle VariableSymmetry(const IntVarArgs &vars)
Variables in x are interchangeable.
Definition: ldsb.cpp:66
struct Gecode::@554::NNF::@60::@62 a
For atomic nodes.
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:4167
A reference-counted pointer to a SymmetryObject.
Definition: int.hh:4435
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:57
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:3967
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
ViewSel< BoolView > * viewselbool(Space &home, const IntVarBranch &ivb)
Return view selectors for Boolean views.
Definition: view-sel.cpp:163
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
Integer sets.
Definition: int.hh:172
VarImpBase ** xs
Array of variables in symmetry.
Definition: ldsb.hh:143
int seq_size
Size of each sequence in symmetry.
Definition: ldsb.hh:159
Exception: Variable in symmetry not branched on
Definition: exception.hpp:140
Passing integer variables.
Definition: int.hh:637
Passing integer arguments.
Definition: int.hh:608
Passing Boolean variables.
Definition: int.hh:691
Select values greater than mean of smallest and largest value.
Definition: int.hh:4162
static void 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.
Definition: brancher.hpp:120
const int v[7]
Definition: distinct.cpp:263
int max(void) const
Return maximum of domain.
Definition: int.hpp:74
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:4164
Implementation of a single symmetry.
Definition: ldsb.hh:166
void expand(Home home, const IntVarArgs &x)
Expand decay factor into AFC or activity.
Definition: var.hpp:74
Select values not greater than mean of smallest and largest value.
Definition: int.hh:4161
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:253
ValSelCommitBase< IntView, int > * valselcommitint(Space &home, int n, const IntValBranch &ivb)
Return value and commit for integer views.
int min(void) const
Return minimum of domain.
Definition: int.hpp:66
Integer variables.
Definition: int.hh:351
SymmetryHandle values_reflect(int lower, int upper)
The values from lower to upper (inclusive) can be reflected.
Definition: ldsb.cpp:110
ValSelCommitBase< BoolView, int > * valselcommitbool(Space &home, int n, const IntValBranch &ivb)
Return value and commit for Boolean views.
Implementation of a variable symmetry.
Definition: ldsb.hh:187
Value iterator for integer sets.
Definition: int.hh:313
Int::LDSB::SymmetryObject * ref
Symmetry object that this handle refers to.
Definition: int.hh:4438
void(* IntVarValPrint)(const Space &home, const Brancher &b, unsigned int a, IntVar x, int i, const int &n, std::ostream &o)
Function type for printing branching alternatives for integer variables.
Definition: int.hh:3950
Random (uniform, for tie breaking)
Definition: int.hh:3975
VarBranch a
Branching criteria to try in order.
Implementation of a value sequence symmetry.
Definition: ldsb.hh:269
SymmetryHandle VariableSequenceSymmetry(const IntVarArgs &vars, int ss)
Variable sequences in x of size ss are interchangeable.
Definition: ldsb.cpp:94
Gecode toplevel namespace
Map from variable implementation to index.
Definition: ldsb.cpp:134
Home class for posting propagators
Definition: core.hpp:905
Select value according to user-defined functions.
Definition: int.hh:4165
#define GECODE_NEVER
Assert that this command is never executed.
Definition: macros.hpp:60
Select all values starting from smallest.
Definition: int.hh:4166