Generated on Sat Feb 7 2015 02:01:23 for Gecode by doxygen 1.8.9.1
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: 2013-05-15 20:32:39 +0200 (Wed, 15 May 2013) $ by $Author: schulte $
11  * $Revision: 13639 $
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  BrancherHandle
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 BrancherHandle();
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  BrancherHandle
311  branch(Home home, const IntVarArgs& x,
313  const Symmetries& syms,
315  using namespace Int;
316  if (home.failed()) return BrancherHandle();
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  return 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  GECODE_NEVER;
423  return BrancherHandle();
424  }
425 
426  BrancherHandle
427  branch(Home home, const BoolVarArgs& x,
428  IntVarBranch vars, IntValBranch vals,
429  const Symmetries& syms,
431  using namespace Int;
432  if (home.failed()) return BrancherHandle();
433  vars.expand(home,x);
434  ViewArray<BoolView> xv(home,x);
435  ViewSel<BoolView>* vs[1] = {
436  Branch::viewselbool(home,vars)
437  };
438 
439  // Construct mapping from each variable in the array to its index
440  // in the array.
441  VariableMap variableMap;
442  for (int i = 0 ; i < x.size() ; i++)
443  variableMap[x[i].varimp()] = i;
444 
445  // Convert the modelling-level Symmetries object into an array of
446  // SymmetryImp objects.
447  int n = syms.size();
448  SymmetryImp<BoolView>** array =
449  static_cast<Space&>(home).alloc<SymmetryImp<BoolView>* >(n);
450  for (int i = 0 ; i < n ; i++) {
451  array[i] = createBoolSym(home, syms[i], variableMap);
452  }
453 
454  // Technically these "bad" value selection could in fact work with
455  // LDSB, because they degenerate to binary splitting for
456  // Booleans. Nonetheless, we explicitly forbid them for
457  // consistency with the integer version.
458  switch (vals.select()) {
465  throw LDSBBadValueSelection("Int::LDSB::branch");
466  break;
468  if (vals.commit() != NULL)
469  throw LDSBBadValueSelection("Int::LDSB::branch");
470  // If vals.commit() returns NULL, it means it will commit with
471  // binary branching, which is OK for LDSB, so we fall through.
472  default:
474  (home,xv,vs,Branch::valselcommitbool(home,x.size(),vals),array,n,bf,vvp);
475  }
476  GECODE_NEVER;
477  return BrancherHandle();
478  }
479 
480 
481  BrancherHandle
482  branch(Home home, const BoolVarArgs& x,
484  const Symmetries& syms,
486  using namespace Int;
487  if (home.failed()) return BrancherHandle();
488  vars.a.expand(home,x);
489  if ((vars.a.select() == IntVarBranch::SEL_NONE) ||
490  (vars.a.select() == IntVarBranch::SEL_RND))
491  vars.b = INT_VAR_NONE();
492  vars.b.expand(home,x);
493  if ((vars.b.select() == IntVarBranch::SEL_NONE) ||
494  (vars.b.select() == IntVarBranch::SEL_RND))
495  vars.c = INT_VAR_NONE();
496  vars.c.expand(home,x);
497  if ((vars.c.select() == IntVarBranch::SEL_NONE) ||
498  (vars.c.select() == IntVarBranch::SEL_RND))
499  vars.d = INT_VAR_NONE();
500  vars.d.expand(home,x);
501  if (vars.b.select() == IntVarBranch::SEL_NONE) {
502  return branch(home,x,vars.a,vals,syms,bf,vvp);
503  } else {
504  // Construct mapping from each variable in the array to its index
505  // in the array.
506  VariableMap variableMap;
507  for (int i = 0 ; i < x.size() ; i++)
508  variableMap[x[i].varimp()] = i;
509 
510  // Convert the modelling-level Symmetries object into an array of
511  // SymmetryImp objects.
512  int n = syms.size();
513  SymmetryImp<BoolView>** array =
514  static_cast<Space&>(home).alloc<SymmetryImp<BoolView>* >(n);
515  for (int i = 0 ; i < n ; i++) {
516  array[i] = createBoolSym(home, syms[i], variableMap);
517  }
518 
519  // Technically these "bad" value selection could in fact work with
520  // LDSB, because they degenerate to binary splitting for
521  // Booleans. Nonetheless, we explicitly forbid them for
522  // consistency with the integer version.
523  switch (vals.select()) {
530  throw LDSBBadValueSelection("Int::LDSB::branch");
531  break;
533  if (vals.commit() != NULL)
534  throw LDSBBadValueSelection("Int::LDSB::branch");
535  // If vals.commit() returns NULL, it means it will commit with
536  // binary branching, which is OK for LDSB, so we fall through.
537  default:
538  ;
539  // Do nothing and continue.
540  }
541 
542  ViewArray<BoolView> xv(home,x);
544  vsc = Branch::valselcommitbool(home,x.size(),vals);
545  if (vars.c.select() == IntVarBranch::SEL_NONE) {
546  ViewSel<BoolView>* vs[2] = {
547  Branch::viewselbool(home,vars.a),Branch::viewselbool(home,vars.b)
548  };
549  return
550  LDSBBrancher<BoolView,2,int,2>::post(home,xv,vs,vsc,array,n,bf,vvp);
551  } else if (vars.d.select() == IntVarBranch::SEL_NONE) {
552  ViewSel<BoolView>* vs[3] = {
553  Branch::viewselbool(home,vars.a),Branch::viewselbool(home,vars.b),
554  Branch::viewselbool(home,vars.c)
555  };
556  return
557  LDSBBrancher<BoolView,3,int,2>::post(home,xv,vs,vsc,array,n,bf,vvp);
558  } else {
559  ViewSel<BoolView>* vs[4] = {
560  Branch::viewselbool(home,vars.a),Branch::viewselbool(home,vars.b),
561  Branch::viewselbool(home,vars.c),Branch::viewselbool(home,vars.d)
562  };
563  return
564  LDSBBrancher<BoolView,4,int,2>::post(home,xv,vs,vsc,array,n,bf,vvp);
565  }
566  }
567  GECODE_NEVER;
568  return BrancherHandle();
569  }
570 
571 }
572 
573 
574 
575 // STATISTICS: int-branch
bool failed(void) const
Check whether corresponding space is failed.
Definition: core.hpp:3446
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:3577
Combine variable selection criteria for tie-breaking.
Select all values starting from smallest.
Definition: int.hh:3994
int max(void) const
Return maximum of domain.
Definition: int.hpp:74
IntSet values
Set of symmetric values.
Definition: ldsb.hh:135
IntArgs values
Array of values in symmetry.
Definition: ldsb.hh:157
Select values greater than mean of smallest and largest value.
Definition: int.hh:3990
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
int size(void) const
Return size of array (number of elements)
Definition: array.hpp:1662
Select the smallest range of the variable domain if it has several ranges, otherwise select values no...
Definition: int.hh:3991
Which values to select for branching first.
Definition: int.hh:3981
Which variable to select for branching.
Definition: int.hh:3798
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
Handle for brancher.
Definition: core.hpp:1157
Select all values starting from largest.
Definition: int.hh:3995
bool pos(const View &x)
Test whether x is postive.
Definition: mult.hpp:45
Collection of symmetries.
Definition: int.hh:4300
Select value according to user-defined functions.
Definition: int.hh:3993
Implementation of a variable sequence symmetry.
Definition: ldsb.hh:225
Select values not greater than mean of smallest and largest value.
Definition: int.hh:3989
Select select(void) const
Return selection strategy.
Definition: val.hpp:57
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.
Definition: int.hh:3784
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:3568
Computation spaces.
Definition: core.hpp:1362
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:2397
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
A reference-counted pointer to a SymmetryObject.
Definition: int.hh:4263
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:205
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:171
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
unsigned int size(void) const
Return size (cardinality) of set.
Definition: int-set-1.hpp:161
Passing integer variables.
Definition: int.hh:636
Passing integer arguments.
Definition: int.hh:607
Passing Boolean variables.
Definition: int.hh:690
const int v[7]
Definition: distinct.cpp:207
Exception: Value selection incompatible with LDSB
Definition: exception.hpp:147
Implementation of a single symmetry.
Definition: ldsb.hh:166
Random (uniform, for tie breaking)
Definition: int.hh:3803
void expand(Home home, const IntVarArgs &x)
Expand decay factor into AFC or activity.
Definition: var.hpp:74
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.
First unassigned.
Definition: int.hh:3802
VoidFunction commit(void) const
Return commit function.
Definition: branch-val.hpp:94
Integer variables.
Definition: int.hh:350
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.
Definition: int.hh:3778
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:185
Value iterator for integer sets.
Definition: int.hh:312
Int::LDSB::SymmetryObject * ref
Symmetry object that this handle refers to.
Definition: int.hh:4266
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.
Definition: brancher.hpp:120
VarBranch a
Branching criteria to try in order.
Implementation of a value sequence symmetry.
Definition: ldsb.hh:267
SymmetryHandle VariableSequenceSymmetry(const IntVarArgs &vars, int ss)
Variable sequences in x of size ss are interchangeable.
Definition: ldsb.cpp:94
Gecode toplevel namespace
int min(void) const
Return minimum of domain.
Definition: int.hpp:66
Map from variable implementation to index.
Definition: ldsb.cpp:134
Select the largest range of the variable domain if it has several ranges, otherwise select values gre...
Definition: int.hh:3992
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.
Definition: branch.cpp:43
Home class for posting propagators
Definition: core.hpp:717
#define GECODE_NEVER
Assert that this command is never executed.
Definition: macros.hpp:60
struct Gecode::@518::NNF::@57::@59 a
For atomic nodes.