Generated on Wed Jan 1 2020 10:37:59 for Gecode by doxygen 1.8.16
int.cpp
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /*
3  * Main authors:
4  * Guido Tack <tack@gecode.org>
5  *
6  * Copyright:
7  * Guido Tack, 2005
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 "test/set.hh"
35 #include "test/int.hh"
36 #include <gecode/minimodel.hh>
37 
38 using namespace Gecode;
39 
40 namespace Test { namespace Set {
41 
43  namespace Int {
44 
50 
51  static const int d1r[4][2] = {
52  {-4,-3},{-1,-1},{1,1},{3,5}
53  };
54  static IntSet d1(d1r,4);
55 
56  static IntSet d2(-1,3);
57  static IntSet d3(0,3);
58 
59  static IntSet d4(0,4);
60 
61  static IntSet ds_33(-3,3);
62 
64  class Card : public SetTest {
65  public:
67  Card(const char* t)
68  : SetTest(t,1,ds_33,true,1) {}
70  virtual bool solution(const SetAssignment& x) const {
71  unsigned int s = 0;
72  for (CountableSetRanges xr(x.lub, x[0]);xr();++xr) s+= xr.width();
73  if (x.intval() < 0)
74  return false;
75  return s==(unsigned int)x.intval();
76  }
78  virtual void post(Space& home, SetVarArray& x, IntVarArray& y) {
79  Gecode::cardinality(home, x[0], y[0]);
80  }
82  virtual void post(Space& home, SetVarArray& x, IntVarArray& y,
83  Reify r) {
84  Gecode::cardinality(home, x[0], y[0], r);
85  }
86  };
87  Card _card("Int::Card");
88 
90  class Min : public SetTest {
91  public:
93  Min(const char* t)
94  : SetTest(t,1,ds_33,true,1) {}
96  virtual bool solution(const SetAssignment& x) const {
97  CountableSetRanges xr0(x.lub, x[0]);
98  return xr0() && xr0.min()==x.intval();
99  }
101  virtual void post(Space& home, SetVarArray& x, IntVarArray& y) {
102  Gecode::min(home, x[0], y[0]);
103  }
105  virtual void post(Space& home, SetVarArray& x, IntVarArray& y,
106  Reify r) {
107  Gecode::min(home, x[0], y[0], r);
108  }
109  };
110  Min _min("Int::Min");
111 
113  class NotMin : public SetTest {
114  public:
116  NotMin(const char* t)
117  : SetTest(t,1,ds_33,false,1) {}
119  virtual bool solution(const SetAssignment& x) const {
120  CountableSetRanges xr0(x.lub, x[0]);
121  return !(xr0() && xr0.min()==x.intval());
122  }
124  virtual void post(Space& home, SetVarArray& x, IntVarArray& y) {
125  Gecode::notMin(home, x[0], y[0]);
126  }
127  };
128  NotMin _notmin("Int::NotMin");
129 
131  class Max : public SetTest {
132  public:
134  Max(const char* t)
135  : SetTest(t,1,ds_33,true,1) {}
137  virtual bool solution(const SetAssignment& x) const {
138  CountableSetRanges xr0(x.lub, x[0]);
139  IntSet x0(xr0);
140  return x0.ranges() > 0 && x0.max()==x.intval();
141  }
143  virtual void post(Space& home, SetVarArray& x, IntVarArray& y) {
144  Gecode::max(home, x[0], y[0]);
145  }
147  virtual void post(Space& home, SetVarArray& x, IntVarArray& y,
148  Reify r) {
149  Gecode::max(home, x[0], y[0], r);
150  }
151  };
152  Max _max("Int::Max");
153 
155  class NotMax : public SetTest {
156  public:
158  NotMax(const char* t)
159  : SetTest(t,1,ds_33,false,1) {}
161  virtual bool solution(const SetAssignment& x) const {
162  CountableSetRanges xr0(x.lub, x[0]);
163  IntSet x0(xr0);
164  return !(x0.ranges() > 0 && x0.max()==x.intval());
165  }
167  virtual void post(Space& home, SetVarArray& x, IntVarArray& y) {
168  Gecode::notMax(home, x[0], y[0]);
169  }
170  };
171  NotMax _notmax("Int::NotMax");
172 
174  class Elem : public SetTest {
175  public:
177  Elem(const char* t)
178  : SetTest(t,1,ds_33,true,1) {}
180  virtual bool solution(const SetAssignment& x) const {
181  for (CountableSetValues xr(x.lub, x[0]);xr();++xr)
182  if (xr.val()==x.intval())
183  return true;
184  return false;
185  }
187  virtual void post(Space& home, SetVarArray& x, IntVarArray& y) {
188  Gecode::rel(home, x[0], SRT_SUP, y[0]);
189  }
191  virtual void post(Space& home, SetVarArray& x, IntVarArray& y,
192  Reify r) {
193  Gecode::rel(home, x[0], SRT_SUP, y[0], r);
194  }
195  };
196  Elem _elem("Int::Elem");
197 
199  class NoElem : public SetTest {
200  public:
202  NoElem(const char* t)
203  : SetTest(t,1,ds_33,false,1) {}
205  virtual bool solution(const SetAssignment& x) const {
206  for (CountableSetValues xr(x.lub, x[0]);xr();++xr)
207  if (xr.val()==x.intval())
208  return false;
209  return true;
210  }
212  virtual void post(Space& home, SetVarArray& x, IntVarArray& y) {
213  Gecode::rel(home, x[0], SRT_DISJ, y[0]);
214  }
215  };
216  NoElem _noelem("Int::NoElem");
217 
219  class Rel : public SetTest {
220  private:
222  Gecode::SetRelType srt;
224  bool swapped;
225  public:
227  Rel(Gecode::SetRelType srt0, bool s)
228  : SetTest("Int::Rel::"+str(srt0)+(s ? "::s" : ""),
229  1,ds_33,true,1),
230  srt(srt0), swapped(s) {}
232  virtual bool solution(const SetAssignment& x) const {
233  CountableSetRanges xr(x.lub, x[0]);
234  IntSet is(x.intval(), x.intval());
235  IntSetRanges dr(is);
236  Gecode::SetRelType rsrt = srt;
237  if (swapped) {
238  switch (srt) {
239  case SRT_SUB: rsrt = SRT_SUP; break;
240  case SRT_SUP: rsrt = SRT_SUB; break;
241  default: break;
242  }
243  }
244  switch (rsrt) {
245  case SRT_EQ: return Iter::Ranges::equal(xr, dr);
246  case SRT_NQ: return !Iter::Ranges::equal(xr, dr);
247  case SRT_SUB: return Iter::Ranges::subset(xr, dr);
248  case SRT_SUP: return Iter::Ranges::subset(dr, xr);
249  case SRT_DISJ:
250  {
252  inter(xr, dr);
253  return !inter();
254  }
255  case SRT_CMPL:
256  {
258  return Iter::Ranges::equal(xr,drc);
259  }
260  default: GECODE_NEVER;
261  }
262  return false;
263  }
265  virtual void post(Space& home, SetVarArray& x, IntVarArray& y) {
266  if (!swapped)
267  Gecode::rel(home, x[0], srt, y[0]);
268  else
269  Gecode::rel(home, y[0], srt, x[0]);
270  }
272  virtual void post(Space& home, SetVarArray& x, IntVarArray& y,
273  Reify r) {
274  if (!swapped)
275  Gecode::rel(home, x[0], srt, y[0], r);
276  else
277  Gecode::rel(home, y[0], srt, x[0], r);
278  }
279  };
280  Rel _rel_eq(Gecode::SRT_EQ,false);
281  Rel _rel_nq(Gecode::SRT_NQ,false);
282  Rel _rel_sub(Gecode::SRT_SUB,false);
283  Rel _rel_sup(Gecode::SRT_SUP,false);
284  Rel _rel_disj(Gecode::SRT_DISJ,false);
285  Rel _rel_cmpl(Gecode::SRT_CMPL,false);
286  Rel _rel_eqs(Gecode::SRT_EQ,true);
287  Rel _rel_nqs(Gecode::SRT_NQ,true);
288  Rel _rel_subs(Gecode::SRT_SUB,true);
289  Rel _rel_sups(Gecode::SRT_SUP,true);
290  Rel _rel_disjs(Gecode::SRT_DISJ,true);
291  Rel _rel_cmpls(Gecode::SRT_CMPL,true);
292 
294  class IntRel : public SetTest {
295  private:
297  Gecode::IntRelType irt;
299  bool swapped;
300  public:
303  : SetTest("Int::IntRel::"+Test::Int::Test::str(irt0)+
304  (s ? "::s" : ""),1,ds_33,true,1),
305  irt(irt0), swapped(s) {
306  testsubsumed = false;
307  }
309  virtual bool solution(const SetAssignment& x) const {
310  CountableSetValues xr(x.lub, x[0]);
311  if (!xr())
312  return false;
313  for (; xr(); ++xr)
314  switch (irt) {
315  case Gecode::IRT_EQ:
316  if (xr.val() != x.intval()) return false;
317  break;
318  case Gecode::IRT_NQ:
319  if (xr.val() == x.intval()) return false;
320  break;
321  case Gecode::IRT_GR:
322  if (!swapped && xr.val() <= x.intval()) return false;
323  if (swapped && xr.val() >= x.intval()) return false;
324  break;
325  case Gecode::IRT_GQ:
326  if (!swapped && xr.val() < x.intval()) return false;
327  if (swapped && xr.val() > x.intval()) return false;
328  break;
329  case Gecode::IRT_LE:
330  if (!swapped && xr.val() >= x.intval()) return false;
331  if (swapped && xr.val() <= x.intval()) return false;
332  break;
333  case Gecode::IRT_LQ:
334  if (!swapped && xr.val() > x.intval()) return false;
335  if (swapped && xr.val() < x.intval()) return false;
336  break;
337  default:
338  GECODE_NEVER;
339  return false;
340  }
341  return true;
342  }
344  virtual void post(Space& home, SetVarArray& x, IntVarArray& y) {
345  if (!swapped)
346  Gecode::rel(home, x[0], irt, y[0]);
347  else
348  Gecode::rel(home, y[0], irt, x[0]);
349  }
351  virtual void post(Space& home, SetVarArray& x, IntVarArray& y,
352  Reify r) {
353  assert((x.size() == 1) && (y.size() == 1));
354  if ((r.mode() != Gecode::RM_EQV) || (Base::rand(2) != 0)) {
355  if (!swapped)
356  Gecode::rel(home, x[0], irt, y[0], r);
357  else
358  Gecode::rel(home, y[0], irt, x[0], r);
359  } else if (swapped) {
360  switch (irt) {
361  case Gecode::IRT_EQ:
362  Gecode::rel(home, (y[0] == x[0]) == r.var()); break;
363  case Gecode::IRT_NQ:
364  Gecode::rel(home, (y[0] != x[0]) == r.var()); break;
365  case Gecode::IRT_LE:
366  Gecode::rel(home, (y[0] < x[0]) == r.var()); break;
367  case Gecode::IRT_LQ:
368  Gecode::rel(home, (y[0] <= x[0]) == r.var()); break;
369  case Gecode::IRT_GR:
370  Gecode::rel(home, (y[0] > x[0]) == r.var()); break;
371  case Gecode::IRT_GQ:
372  Gecode::rel(home, (y[0] >= x[0]) == r.var()); break;
373  default: GECODE_NEVER;
374  }
375  } else {
376  switch (irt) {
377  case Gecode::IRT_EQ:
378  Gecode::rel(home, (x[0] == y[0]) == r.var()); break;
379  case Gecode::IRT_NQ:
380  Gecode::rel(home, (x[0] != y[0]) == r.var()); break;
381  case Gecode::IRT_LE:
382  Gecode::rel(home, (x[0] < y[0]) == r.var()); break;
383  case Gecode::IRT_LQ:
384  Gecode::rel(home, (x[0] <= y[0]) == r.var()); break;
385  case Gecode::IRT_GR:
386  Gecode::rel(home, (x[0] > y[0]) == r.var()); break;
387  case Gecode::IRT_GQ:
388  Gecode::rel(home, (x[0] >= y[0]) == r.var()); break;
389  default: GECODE_NEVER;
390  }
391  }
392  }
393  };
394  IntRel _intrel_eq(Gecode::IRT_EQ,false);
395  IntRel _intrel_nq(Gecode::IRT_NQ,false);
396  IntRel _intrel_gr(Gecode::IRT_GR,false);
397  IntRel _intrel_gq(Gecode::IRT_GQ,false);
398  IntRel _intrel_le(Gecode::IRT_LE,false);
399  IntRel _intrel_lq(Gecode::IRT_LQ,false);
400  IntRel _intrel_eqs(Gecode::IRT_EQ,true);
401  IntRel _intrel_nqs(Gecode::IRT_NQ,true);
402  IntRel _intrel_grs(Gecode::IRT_GR,true);
403  IntRel _intrel_gqs(Gecode::IRT_GQ,true);
404  IntRel _intrel_les(Gecode::IRT_LE,true);
405  IntRel _intrel_lqs(Gecode::IRT_LQ,true);
406 
407 
408  template<class I>
409  int weightI(const IntArgs& elements,
410  const IntArgs& weights,
411  I& iter) {
412  int sum = 0;
413  int i = 0;
414  for (Iter::Ranges::ToValues<I> v(iter); v(); ++v) {
415  // Skip all elements below the current
416  while (elements[i]<v.val()) i++;
417  assert(elements[i] == v.val());
418  sum += weights[i];
419  }
420  return sum;
421  }
422 
424  class Weights : public SetTest {
425  public:
431  Weights(const char* t, IntArgs& el, IntArgs& w,
432  int min = -10000, int max = 10000)
433  : SetTest(t,1,ds_33,false,1),
434  elements(el), weights(w), minWeight(min), maxWeight(max) {}
436  virtual bool solution(const SetAssignment& x) const {
437  CountableSetRanges x0(x.lub, x[0]);
438  return x.intval()==weightI(elements,weights,x0) &&
439  x.intval() >= minWeight && x.intval() <= maxWeight;
440  }
442  virtual void post(Space& home, SetVarArray& x, IntVarArray& y) {
443  Gecode::rel(home, minWeight <= y[0]);
444  Gecode::rel(home, maxWeight >= y[0]);
445  Gecode::weights(home, elements, weights, x[0], y[0]);
446  }
447  };
448 
449  const int el1v[] = {-3,-2,-1,0,1,2,3};
450  IntArgs el1(7,el1v);
451  const int w1v[] = {1,-2,1,1,1,6,1};
452  IntArgs w1(7,w1v);
453  Weights _weights1("Int::Weights::1", el1, w1);
454 
455  const int w2v[] = {-1,-1,-1,10,-1,-1,-1};
456  IntArgs w2(7,w2v);
457  Weights _weights2("Int::Weights::2", el1, w2);
458  Weights _weights3("Int::Weights::3", el1, w2, 3);
459 
460  const int w4v[] = {1,1,0,0,0,0,0};
461  IntArgs w4(7,w4v);
462  Weights _weights4("Int::Weights::4", el1, w4);
463 
464 }}}
465 
466 // STATISTICS: test-set
LinFloatExpr sum(const FloatVarArgs &x)
Construct linear float expression as sum of float variables.
Definition: float-expr.cpp:546
Post propagator for SetVar x
Definition: set.hh:767
IntRel _intrel_gq(Gecode::IRT_GQ, false)
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
Definition: int.cpp:309
IntRelType
Relation types for integers.
Definition: int.hh:925
Post propagator for SetVar SetOpType SetVar y
Definition: set.hh:767
Rel _rel_disjs(Gecode::SRT_DISJ, true)
IntRel _intrel_lq(Gecode::IRT_LQ, false)
virtual void post(Space &home, SetVarArray &x, IntVarArray &y)
Post constraint on x.
Definition: int.cpp:344
virtual void post(Space &home, SetVarArray &x, IntVarArray &y)
Post constraint on x.
Definition: int.cpp:212
IntArgs elements
Definition: int.cpp:426
Test for set weight constraint
Definition: int.cpp:424
virtual void post(Space &home, SetVarArray &x, IntVarArray &y, Reify r)
Post reified constraint on x for r.
Definition: int.cpp:272
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition: arithmetic.cpp:49
Greater or equal ( )
Definition: int.hh:930
int max(int i) const
Return maximum of range at position i.
Definition: int-set-1.hpp:158
virtual void post(Space &home, SetVarArray &x, IntVarArray &y, Reify r)
Post reified constraint on x.
Definition: int.cpp:105
NoElem _noelem("Int::NoElem")
Rel _rel_sub(Gecode::SRT_SUB, false)
virtual void post(Space &home, SetVarArray &x, IntVarArray &y, Reify r)
Post reified constraint on x for r.
Definition: int.cpp:351
IntArgs w4(7, w4v)
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
Definition: int.cpp:119
int val(void) const
Return current value.
Definition: set.hh:94
Less ( )
Definition: int.hh:929
virtual void post(Space &home, SetVarArray &x, IntVarArray &y, Reify r)
Post reified constraint on x.
Definition: int.cpp:82
Rel _rel_cmpls(Gecode::SRT_CMPL, true)
NodeType t
Type of node.
Definition: bool-expr.cpp:230
void notMin(Home home, SetVar s, IntVar x)
Definition: int.cpp:235
IntRel _intrel_nq(Gecode::IRT_NQ, false)
Computation spaces.
Definition: core.hpp:1742
NotMax(const char *t)
Create and register test.
Definition: int.cpp:158
Test for cardinality constraint
Definition: int.cpp:64
Subset ( )
Definition: set.hh:646
IntArgs weights
Definition: int.cpp:427
IntRel _intrel_eqs(Gecode::IRT_EQ, true)
bool subset(I &i, J &j)
Check whether range iterator i is subset of range iterator j.
IntRel _intrel_grs(Gecode::IRT_GR, true)
Integer variable array.
Definition: int.hh:763
Weights _weights3("Int::Weights::3", el1, w2, 3)
Superset ( )
Definition: set.hh:647
Range iterator for integer sets.
Definition: int.hh:292
Test for minimal element constraint
Definition: int.cpp:90
Weights _weights2("Int::Weights::2", el1, w2)
Generate all set assignments.
Definition: set.hh:142
IntArgs w1(7, w1v)
Test for negated maximal element constraint
Definition: int.cpp:155
Rel _rel_sups(Gecode::SRT_SUP, true)
Disjoint ( )
Definition: set.hh:648
NotMin _notmin("Int::NotMin")
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
Definition: int.cpp:436
int maxWeight
Definition: int.cpp:429
virtual void post(Space &home, SetVarArray &x, IntVarArray &y)
Post constraint on x.
Definition: int.cpp:143
Rel _rel_nq(Gecode::SRT_NQ, false)
Gecode toplevel namespace
Test for negated element constraint
Definition: int.cpp:199
Min(const char *t)
Create and register test.
Definition: int.cpp:93
Integer sets.
Definition: int.hh:174
NotMin(const char *t)
Create and register test.
Definition: int.cpp:116
Rel _rel_sup(Gecode::SRT_SUP, false)
A complement iterator spezialized for the BndSet limits.
Definition: var-imp.hpp:292
int min(void) const
Return smallest value of range.
Equality ( )
Definition: set.hh:644
virtual void post(Space &home, SetVarArray &x, IntVarArray &y)
Post constraint on x.
Definition: int.cpp:187
virtual void post(Space &home, SetVarArray &x, IntVarArray &y)
Post constraint on x.
Definition: int.cpp:167
Reification specification.
Definition: int.hh:876
Equivalence for reification (default)
Definition: int.hh:855
Value iterator from range iterator.
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
Definition: int.cpp:205
Range iterator for computing intersection (binary)
Rel(Gecode::SetRelType srt0, bool s)
Create and register test.
Definition: int.cpp:227
IntRel _intrel_gr(Gecode::IRT_GR, false)
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
Definition: int.cpp:137
Card _card("Int::Card")
Test for maximal element constraint
Definition: int.cpp:131
Post propagator for SetVar SetOpType SetVar SetRelType r
Definition: set.hh:767
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
Definition: int.cpp:180
Value iterator producing subsets of an IntSet.
Definition: set.hh:60
Base class for tests with set constraints
Definition: set.hh:273
LinIntExpr cardinality(const SetExpr &e)
Cardinality of set expression.
Definition: set-expr.cpp:817
bool equal(I &i, J &j)
Check whether range iterators i and j are equal.
IntRel _intrel_gqs(Gecode::IRT_GQ, true)
const int el1v[]
Definition: int.cpp:449
SetRelType
Common relation types for sets.
Definition: set.hh:643
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
Definition: int.cpp:232
Test for element constraint
Definition: int.cpp:174
void weights(Home home, IntSharedArray elements, IntSharedArray weights, SetVar x, IntVar y)
Definition: int.cpp:292
IntRel _intrel_eq(Gecode::IRT_EQ, false)
NoElem(const char *t)
Create and register test.
Definition: int.cpp:202
Weights _weights4("Int::Weights::4", el1, w4)
void notMax(Home home, SetVar s, IntVar x)
Definition: int.cpp:267
#define GECODE_NEVER
Assert that this command is never executed.
Definition: macros.hpp:56
Disequality ( )
Definition: set.hh:645
IntRel(Gecode::IntRelType irt0, bool s)
Create and register test.
Definition: int.cpp:302
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
Definition: int.cpp:161
virtual void post(Space &home, SetVarArray &x, IntVarArray &y)
Post constraint on x.
Definition: int.cpp:265
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
Definition: int.cpp:96
Complement.
Definition: set.hh:649
Rel _rel_eqs(Gecode::SRT_EQ, true)
IntArgs w2(7, w2v)
Rel _rel_eq(Gecode::SRT_EQ, false)
const int v[7]
Definition: distinct.cpp:259
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
Definition: rel.cpp:43
const int w4v[]
Definition: int.cpp:460
Rel _rel_nqs(Gecode::SRT_NQ, true)
int minWeight
Definition: int.cpp:428
virtual void post(Space &home, SetVarArray &x, IntVarArray &y, Reify r)
Post reified constraint on x for b.
Definition: int.cpp:191
Elem(const char *t)
Create and register test.
Definition: int.cpp:177
IntRel _intrel_nqs(Gecode::IRT_NQ, true)
Test for integer relation constraint
Definition: int.cpp:294
IntRel _intrel_les(Gecode::IRT_LE, true)
Card(const char *t)
Create and register test.
Definition: int.cpp:67
General test support.
Definition: afc.cpp:39
Range iterator producing subsets of an IntSet.
Definition: set.hh:98
Max(const char *t)
Create and register test.
Definition: int.cpp:134
IntArgs el1(7, el1v)
Rel _rel_subs(Gecode::SRT_SUB, true)
NotMax _notmax("Int::NotMax")
Equality ( )
Definition: int.hh:926
IntRel _intrel_le(Gecode::IRT_LE, false)
IntRel _intrel_lqs(Gecode::IRT_LQ, true)
Test for negated minimal element constraint
Definition: int.cpp:113
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition: arithmetic.cpp:67
Disequality ( )
Definition: int.hh:927
Test for relation constraint
Definition: int.cpp:219
Min _min("Int::Min")
Set variable array
Definition: set.hh:570
Rel _rel_disj(Gecode::SRT_DISJ, false)
Weights(const char *t, IntArgs &el, IntArgs &w, int min=-10000, int max=10000)
Create and register test.
Definition: int.cpp:431
virtual void post(Space &home, SetVarArray &x, IntVarArray &y)
Post constraint on x.
Definition: int.cpp:124
Elem _elem("Int::Elem")
Greater ( )
Definition: int.hh:931
Passing integer arguments.
Definition: int.hh:628
virtual void post(Space &home, SetVarArray &x, IntVarArray &y)
Post constraint on x.
Definition: int.cpp:442
Gecode::IntArgs i({1, 2, 3, 4})
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
Definition: int.cpp:70
const int w1v[]
Definition: int.cpp:451
Max _max("Int::Max")
virtual void post(Space &home, SetVarArray &x, IntVarArray &y)
Post constraint on x.
Definition: int.cpp:101
SetExpr inter(const SetVarArgs &x)
Intersection of set variables.
Definition: set-expr.cpp:696
Weights _weights1("Int::Weights::1", el1, w1)
const int w2v[]
Definition: int.cpp:455
Rel _rel_cmpl(Gecode::SRT_CMPL, false)
int weightI(const IntArgs &elements, const IntArgs &weights, I &iter)
Definition: int.cpp:409
int ranges(void) const
Return number of ranges of the specification.
Definition: int-set-1.hpp:171
Less or equal ( )
Definition: int.hh:928
virtual void post(Space &home, SetVarArray &x, IntVarArray &y)
Post constraint on x.
Definition: int.cpp:78
virtual void post(Space &home, SetVarArray &x, IntVarArray &y, Reify r)
Post reified constraint on x.
Definition: int.cpp:147