Generated on Sat Feb 7 2015 02:01:24 for Gecode by doxygen 1.8.9.1
bool-int.hpp
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /*
3  * Main authors:
4  * Christian Schulte <schulte@gecode.org>
5  * Tias Guns <tias.guns@cs.kuleuven.be>
6  *
7  * Copyright:
8  * Christian Schulte, 2006
9  * Tias Guns, 2009
10  *
11  * Last modified:
12  * $Date: 2012-10-18 16:02:42 +0200 (Thu, 18 Oct 2012) $ by $Author: schulte $
13  * $Revision: 13154 $
14  *
15  * This file is part of Gecode, the generic constraint
16  * development environment:
17  * http://www.gecode.org
18  *
19  * Permission is hereby granted, free of charge, to any person obtaining
20  * a copy of this software and associated documentation files (the
21  * "Software"), to deal in the Software without restriction, including
22  * without limitation the rights to use, copy, modify, merge, publish,
23  * distribute, sublicense, and/or sell copies of the Software, and to
24  * permit persons to whom the Software is furnished to do so, subject to
25  * the following conditions:
26  *
27  * The above copyright notice and this permission notice shall be
28  * included in all copies or substantial portions of the Software.
29  *
30  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
31  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
32  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
33  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
34  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
35  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
36  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37  *
38  */
39 
40 #include <algorithm>
41 
42 #include <gecode/int/bool.hh>
43 
44 namespace Gecode { namespace Int { namespace Linear {
45 
46  /*
47  * Baseclass for integer Boolean sum using dependencies
48  *
49  */
50  template<class VX>
53  int n_s, int c0)
54  : Propagator(home), co(home), x(x0), n_as(n_s), n_hs(n_s), c(c0) {
55  Advisor* a = new (home) Advisor(home,*this,co);
56  for (int i=n_as; i--; )
57  x[i].subscribe(home,*a);
58  }
59 
60  template<class VX>
61  forceinline void
63  if (n_as != n_hs) {
64  // Remove views for which no more subscriptions exist
65  int n_x = x.size();
66  for (int i=n_hs; i--; )
67  if (!x[i].none()) {
68  x[i]=x[--n_hs]; x[n_hs]=x[--n_x];
69  }
70  x.size(n_x);
71  }
72  assert(n_as == n_hs);
73  // Remove assigned yet unsubscribed views
74  {
75  int n_x = x.size();
76  for (int i=n_x-1; i>=n_hs; i--)
77  if (x[i].one()) {
78  c--; x[i]=x[--n_x];
79  } else if (x[i].zero()) {
80  x[i]=x[--n_x];
81  }
82  x.size(n_x);
83  }
84  }
85 
86  template<class VX>
89  : Propagator(home,share,p), n_as(p.n_as), n_hs(n_as) {
90  p.normalize();
91  c=p.c;
92  co.update(home,share,p.co);
93  x.update(home,share,p.x);
94  }
95 
96  template<class VX>
97  PropCost
98  LinBoolInt<VX>::cost(const Space&, const ModEventDelta&) const {
100  }
101 
102  template<class VX>
103  forceinline size_t
105  Advisors<Advisor> as(co);
106  for (int i=n_hs; i--; )
107  x[i].cancel(home,as.advisor());
108  co.dispose(home);
109  (void) Propagator::dispose(home);
110  return sizeof(*this);
111  }
112 
113  /*
114  * Greater or equal propagator (integer rhs)
115  *
116  */
117  template<class VX>
120  : LinBoolInt<VX>(home,x,c+1,c) {}
121 
122  template<class VX>
125  : LinBoolInt<VX>(home,share,p) {}
126 
127  template<class VX>
128  Actor*
129  GqBoolInt<VX>::copy(Space& home, bool share) {
130  return new (home) GqBoolInt<VX>(home,share,*this);
131  }
132 
133  template<class VX>
134  ExecStatus
136  // Check whether propagator is running
137  if (n_as == 0)
138  return ES_FIX;
139 
140  if (VX::one(d)) {
141  c--; goto check;
142  }
143  if (c+1 < n_as)
144  goto check;
145  // Find a new subscription
146  for (int i = x.size()-1; i>=n_hs; i--)
147  if (x[i].none()) {
148  std::swap(x[i],x[n_hs]);
149  x[n_hs++].subscribe(home,a);
150  x.size(i+1);
151  return ES_FIX;
152  } else if (x[i].one()) {
153  c--;
154  if (c+1 < n_as) {
155  x.size(i);
156  assert(n_hs <= x.size());
157  goto check;
158  }
159  }
160  // No view left for subscription
161  x.size(n_hs);
162  check:
163  // Do not update subscription
164  n_as--;
165  int n = x.size()-n_hs+n_as;
166  if (n < c)
167  return ES_FAILED;
168  if ((c <= 0) || (c == n))
169  return ES_NOFIX;
170  else
171  return ES_FIX;
172  }
173 
174  template<class VX>
175  ExecStatus
177  if (c > 0) {
178  assert((n_as == c) && (x.size() == n_hs));
179  // Signal that propagator is running
180  n_as = 0;
181  // All views must be one to satisfy inequality
182  for (int i=n_hs; i--; )
183  if (x[i].none())
184  GECODE_ME_CHECK(x[i].one_none(home));
185  }
186  return home.ES_SUBSUMED(*this);
187  }
188 
189  template<class VX>
190  ExecStatus
192  // Eliminate assigned views
193  int n_x = x.size();
194  for (int i=n_x; i--; )
195  if (x[i].zero()) {
196  x[i] = x[--n_x];
197  } else if (x[i].one()) {
198  x[i] = x[--n_x]; c--;
199  }
200  x.size(n_x);
201  // RHS too large
202  if (n_x < c)
203  return ES_FAILED;
204  // Whatever the x[i] take for values, the inequality is subsumed
205  if (c <= 0)
206  return ES_OK;
207  // Use Boolean disjunction for this special case
208  if (c == 1)
209  return Bool::NaryOrTrue<VX>::post(home,x);
210  // All views must be one to satisfy inequality
211  if (c == n_x) {
212  for (int i=n_x; i--; )
213  GECODE_ME_CHECK(x[i].one_none(home));
214  return ES_OK;
215  }
216  // This is the needed invariant as c+1 subscriptions must be created
217  assert(n_x > c);
218  (void) new (home) GqBoolInt<VX>(home,x,c);
219  return ES_OK;
220  }
221 
222 
223 
224 
225  /*
226  * Equal propagator (integer rhs)
227  *
228  */
229  template<class VX>
232  : LinBoolInt<VX>(home,x,std::max(c,x.size()-c)+1,c) {}
233 
234  template<class VX>
237  : LinBoolInt<VX>(home,share,p) {}
238 
239  template<class VX>
240  Actor*
241  EqBoolInt<VX>::copy(Space& home, bool share) {
242  return new (home) EqBoolInt<VX>(home,share,*this);
243  }
244 
245  template<class VX>
246  ExecStatus
248  // Check whether propagator is running
249  if (n_as == 0)
250  return ES_FIX;
251 
252  if (VX::one(d))
253  c--;
254  if ((c+1 < n_as) && (x.size()-n_hs < c))
255  goto check;
256  // Find a new subscription
257  for (int i = x.size()-1; i>=n_hs; i--)
258  if (x[i].none()) {
259  std::swap(x[i],x[n_hs]);
260  x[n_hs++].subscribe(home,a);
261  x.size(i+1);
262  return ES_FIX;
263  } else if (x[i].one()) {
264  c--;
265  }
266  // No view left for subscription
267  x.size(n_hs);
268  check:
269  // Do not update subscription
270  n_as--;
271  int n = x.size()-n_hs+n_as;
272  if ((c < 0) || (c > n))
273  return ES_FAILED;
274  if ((c == 0) || (c == n))
275  return ES_NOFIX;
276  else
277  return ES_FIX;
278  }
279 
280  template<class VX>
281  ExecStatus
283  assert(x.size() == n_hs);
284  // Signal that propagator is running
285  n_as = 0;
286  if (c == 0) {
287  // All views must be zero to satisfy equality
288  for (int i=n_hs; i--; )
289  if (x[i].none())
290  GECODE_ME_CHECK(x[i].zero_none(home));
291  } else {
292  // All views must be one to satisfy equality
293  for (int i=n_hs; i--; )
294  if (x[i].none())
295  GECODE_ME_CHECK(x[i].one_none(home));
296  }
297  return home.ES_SUBSUMED(*this);
298  }
299 
300  template<class VX>
301  ExecStatus
303  // Eliminate assigned views
304  int n_x = x.size();
305  for (int i=n_x; i--; )
306  if (x[i].zero()) {
307  x[i] = x[--n_x];
308  } else if (x[i].one()) {
309  x[i] = x[--n_x]; c--;
310  }
311  x.size(n_x);
312  // RHS too small or too large
313  if ((c < 0) || (c > n_x))
314  return ES_FAILED;
315  // All views must be zero to satisfy equality
316  if (c == 0) {
317  for (int i=n_x; i--; )
318  GECODE_ME_CHECK(x[i].zero_none(home));
319  return ES_OK;
320  }
321  // All views must be one to satisfy equality
322  if (c == n_x) {
323  for (int i=n_x; i--; )
324  GECODE_ME_CHECK(x[i].one_none(home));
325  return ES_OK;
326  }
327  (void) new (home) EqBoolInt<VX>(home,x,c);
328  return ES_OK;
329  }
330 
331 
332  /*
333  * Integer disequal to Boolean sum
334  *
335  */
336 
337  template<class VX>
340  : BinaryPropagator<VX,PC_INT_VAL>(home,
341  b[b.size()-2],
342  b[b.size()-1]), x(b), c(c0) {
343  assert(x.size() >= 2);
344  x.size(x.size()-2);
345  }
346 
347  template<class VX>
348  forceinline size_t
351  return sizeof(*this);
352  }
353 
354  template<class VX>
357  : BinaryPropagator<VX,PC_INT_VAL>(home,share,p), x(home,p.x.size()) {
358  // Eliminate all zeros and ones in original and update
359  int n = p.x.size();
360  int p_c = p.c;
361  for (int i=n; i--; )
362  if (p.x[i].zero()) {
363  n--; p.x[i]=p.x[n]; x[i]=x[n];
364  } else if (p.x[i].one()) {
365  n--; p_c--; p.x[i]=p.x[n]; x[i]=x[n];
366  } else {
367  x[i].update(home,share,p.x[i]);
368  }
369  c = p_c; p.c = p_c;
370  x.size(n); p.x.size(n);
371  }
372 
373  template<class VX>
376  int n = x.size();
377  for (int i=n; i--; )
378  if (x[i].one()) {
379  x[i]=x[--n]; c--;
380  } else if (x[i].zero()) {
381  x[i]=x[--n];
382  }
383  x.size(n);
384  if ((n < c) || (c < 0))
385  return ES_OK;
386  if (n == 0)
387  return (c == 0) ? ES_FAILED : ES_OK;
388  if (n == 1) {
389  if (c == 1) {
390  GECODE_ME_CHECK(x[0].zero_none(home));
391  } else {
392  GECODE_ME_CHECK(x[0].one_none(home));
393  }
394  return ES_OK;
395  }
396  (void) new (home) NqBoolInt(home,x,c);
397  return ES_OK;
398  }
399 
400  template<class VX>
401  Actor*
402  NqBoolInt<VX>::copy(Space& home, bool share) {
403  return new (home) NqBoolInt<VX>(home,share,*this);
404  }
405 
406  template<class VX>
407  PropCost
408  NqBoolInt<VX>::cost(const Space&, const ModEventDelta&) const {
409  return PropCost::linear(PropCost::LO, x.size());
410  }
411 
412  template<class VX>
413  forceinline bool
415  if (y.one())
416  c--;
417  int n = x.size();
418  for (int i=n; i--; )
419  if (x[i].one()) {
420  c--; x[i]=x[--n];
421  } else if (x[i].zero()) {
422  x[i] = x[--n];
423  } else {
424  // New unassigned view found
425  assert(!x[i].zero() && !x[i].one());
426  // Move to y and subscribe
427  y=x[i]; x[i]=x[--n];
428  x.size(n);
429  y.subscribe(home,*this,PC_INT_VAL,false);
430  return true;
431  }
432  // All views have been assigned!
433  x.size(0);
434  return false;
435  }
436 
437  template<class VX>
438  ExecStatus
440  bool s0 = true;
441  if (x0.zero() || x0.one())
442  s0 = resubscribe(home,x0);
443  bool s1 = true;
444  if (x1.zero() || x1.one())
445  s1 = resubscribe(home,x1);
446  int n = x.size() + s0 + s1;
447  if ((n < c) || (c < 0))
448  return home.ES_SUBSUMED(*this);
449  if (n == 0)
450  return (c == 0) ? ES_FAILED : home.ES_SUBSUMED(*this);
451  if (n == 1) {
452  if (s0) {
453  if (c == 1) {
454  GECODE_ME_CHECK(x0.zero_none(home));
455  } else {
456  GECODE_ME_CHECK(x0.one_none(home));
457  }
458  } else {
459  assert(s1);
460  if (c == 1) {
461  GECODE_ME_CHECK(x1.zero_none(home));
462  } else {
463  GECODE_ME_CHECK(x1.one_none(home));
464  }
465  }
466  return home.ES_SUBSUMED(*this);
467  }
468  return ES_FIX;
469  }
470 
471  /*
472  * Baseclass for reified integer Boolean sum
473  *
474  */
475  template<class VX, class VB>
478  int c0, VB b0)
479  : Propagator(home), co(home), x(x0), n_s(x.size()), c(c0), b(b0) {
480  x.subscribe(home,*new (home) Advisor(home,*this,co));
481  b.subscribe(home,*this,PC_BOOL_VAL);
482  }
483 
484  template<class VX, class VB>
485  forceinline void
487  if (n_s != x.size()) {
488  int n_x = x.size();
489  for (int i=n_x; i--; )
490  if (!x[i].none())
491  x[i] = x[--n_x];
492  x.size(n_x);
493  assert(x.size() == n_s);
494  }
495  }
496 
497  template<class VX, class VB>
501  : Propagator(home,share,p), n_s(p.n_s), c(p.c) {
502  p.normalize();
503  co.update(home,share,p.co);
504  x.update(home,share,p.x);
505  b.update(home,share,p.b);
506  }
507 
508  template<class VX, class VB>
509  forceinline size_t
511  Advisors<Advisor> as(co);
512  x.cancel(home,as.advisor());
513  co.dispose(home);
514  b.cancel(home,*this,PC_BOOL_VAL);
515  (void) Propagator::dispose(home);
516  return sizeof(*this);
517  }
518 
519  template<class VX, class VB>
520  PropCost
523  }
524 
525 
526  template<>
529  public:
534  NegBoolView y(x); return y;
535  }
536  };
537 
538  template<>
541  public:
543  typedef BoolView NegView;
546  return x.base();
547  }
548  };
549 
550 
551  /*
552  * Reified greater or equal propagator (integer rhs)
553  *
554  */
555  template<class VX, class VB, ReifyMode rm>
558  : ReLinBoolInt<VX,VB>(home,x,c,b) {}
559 
560  template<class VX, class VB, ReifyMode rm>
564  : ReLinBoolInt<VX,VB>(home,share,p) {}
565 
566  template<class VX, class VB, ReifyMode rm>
567  Actor*
568  ReGqBoolInt<VX,VB,rm>::copy(Space& home, bool share) {
569  return new (home) ReGqBoolInt<VX,VB,rm>(home,share,*this);
570  }
571 
572  template<class VX, class VB, ReifyMode rm>
573  ExecStatus
575  if (VX::one(d))
576  c--;
577  n_s--;
578  if ((n_s < c) || (c <= 0))
579  return ES_NOFIX;
580  else
581  return ES_FIX;
582  }
583 
584  template<class VX, class VB, ReifyMode rm>
585  ExecStatus
587  if (b.none()) {
588  if (c <= 0) {
589  if (rm != RM_IMP)
590  GECODE_ME_CHECK(b.one_none(home));
591  } else {
592  if (rm != RM_PMI)
593  GECODE_ME_CHECK(b.zero_none(home));
594  }
595  } else {
596  normalize();
597  if (b.one()) {
598  if (rm != RM_PMI)
599  GECODE_REWRITE(*this,(GqBoolInt<VX>::post(home(*this),x,c)));
600  } else {
601  if (rm != RM_IMP) {
603  for (int i=x.size(); i--; )
604  nx[i]=BoolNegTraits<VX>::neg(x[i]);
606  ::post(home(*this),nx,x.size()-c+1));
607  }
608  }
609  }
610  return home.ES_SUBSUMED(*this);
611  }
612 
613  template<class VX, class VB, ReifyMode rm>
614  ExecStatus
616  assert(!b.assigned()); // checked before posting
617 
618  // Eliminate assigned views
619  int n_x = x.size();
620  for (int i=n_x; i--; )
621  if (x[i].zero()) {
622  x[i] = x[--n_x];
623  } else if (x[i].one()) {
624  x[i] = x[--n_x]; c--;
625  }
626  x.size(n_x);
627  if (n_x < c) {
628  // RHS too large
629  if (rm != RM_PMI)
630  GECODE_ME_CHECK(b.zero_none(home));
631  } else if (c <= 0) {
632  // Whatever the x[i] take for values, the inequality is subsumed
633  if (rm != RM_IMP)
634  GECODE_ME_CHECK(b.one_none(home));
635  } else if ((c == 1) && (rm == RM_EQV)) {
636  // Equivalent to Boolean disjunction
637  return Bool::NaryOr<VX,VB>::post(home,x,b);
638  } else if ((c == n_x) && (rm == RM_EQV)) {
639  // Equivalent to Boolean conjunction, transform to Boolean disjunction
641  for (int i=n_x; i--; )
642  nx[i]=BoolNegTraits<VX>::neg(x[i]);
643  return Bool::NaryOr
644  <typename BoolNegTraits<VX>::NegView,
646  ::post(home,nx,BoolNegTraits<VB>::neg(b));
647  } else {
648  (void) new (home) ReGqBoolInt<VX,VB,rm>(home,x,c,b);
649  }
650  return ES_OK;
651  }
652 
653  /*
654  * Reified equal propagator (integer rhs)
655  *
656  */
657  template<class VX, class VB, ReifyMode rm>
660  : ReLinBoolInt<VX,VB>(home,x,c,b) {}
661 
662  template<class VX, class VB, ReifyMode rm>
666  : ReLinBoolInt<VX,VB>(home,share,p) {}
667 
668  template<class VX, class VB, ReifyMode rm>
669  Actor*
670  ReEqBoolInt<VX,VB,rm>::copy(Space& home, bool share) {
671  return new (home) ReEqBoolInt<VX,VB,rm>(home,share,*this);
672  }
673 
674  template<class VX, class VB, ReifyMode rm>
675  ExecStatus
677  if (VX::one(d))
678  c--;
679  n_s--;
680 
681  if ((c < 0) || (c > n_s) || (n_s == 0))
682  return ES_NOFIX;
683  else
684  return ES_FIX;
685  }
686 
687  template<class VX, class VB, ReifyMode rm>
688  ExecStatus
690  if (b.none()) {
691  if ((c == 0) && (n_s == 0)) {
692  if (rm != RM_IMP)
693  GECODE_ME_CHECK(b.one_none(home));
694  } else {
695  if (rm != RM_PMI)
696  GECODE_ME_CHECK(b.zero_none(home));
697  }
698  } else {
699  normalize();
700  if (b.one()) {
701  if (rm != RM_PMI)
702  GECODE_REWRITE(*this,(EqBoolInt<VX>::post(home(*this),x,c)));
703  } else {
704  if (rm != RM_IMP)
705  GECODE_REWRITE(*this,(NqBoolInt<VX>::post(home(*this),x,c)));
706  }
707  }
708  return home.ES_SUBSUMED(*this);
709  }
710 
711  template<class VX, class VB, ReifyMode rm>
712  ExecStatus
714  assert(!b.assigned()); // checked before posting
715 
716  // Eliminate assigned views
717  int n_x = x.size();
718  for (int i=n_x; i--; )
719  if (x[i].zero()) {
720  x[i] = x[--n_x];
721  } else if (x[i].one()) {
722  x[i] = x[--n_x]; c--;
723  }
724  x.size(n_x);
725  if ((n_x < c) || (c < 0)) {
726  // RHS too large
727  if (rm != RM_PMI)
728  GECODE_ME_CHECK(b.zero_none(home));
729  } else if ((c == 0) && (n_x == 0)) {
730  // all variables set, and c == 0: equality
731  if (rm != RM_IMP)
732  GECODE_ME_CHECK(b.one_none(home));
733  } else if ((c == 0) && (rm == RM_EQV)) {
734  // Equivalent to Boolean disjunction
736  ::post(home,x,BoolNegTraits<VB>::neg(b));
737  } else if ((c == n_x) && (rm == RM_EQV)) {
738  // Equivalent to Boolean conjunction, transform to Boolean disjunction
740  for (int i=n_x; i--; )
741  nx[i]=BoolNegTraits<VX>::neg(x[i]);
742  return Bool::NaryOr
743  <typename BoolNegTraits<VX>::NegView,
745  ::post(home,nx,BoolNegTraits<VB>::neg(b));
746  } else {
747  (void) new (home) ReEqBoolInt<VX,VB,rm>(home,x,c,b);
748  }
749  return ES_OK;
750  }
751 
752 
753 }}}
754 
755 // STATISTICS: int-prop
756 
virtual ExecStatus advise(Space &home, Advisor &a, const Delta &d)
Give advice to propagator.
Definition: bool-int.hpp:676
ViewArray< VX > x
Boolean views.
Definition: linear.hh:784
#define GECODE_REWRITE(prop, post)
Rewrite propagator by executing post function.
Definition: macros.hpp:109
void update(Space &, bool share, ViewArray< View > &a)
Update array to be a clone of array a.
Definition: array.hpp:1387
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as low linear)
Definition: bool-int.hpp:408
Inverse implication for reification.
Definition: int.hh:847
static PropCost linear(PropCost::Mod m, unsigned int n)
Linear complexity for modifier pcm and size measure n.
Definition: core.hpp:4041
ExecStatus ES_SUBSUMED(Propagator &p)
Definition: core.hpp:2973
GqBoolInt(Space &home, bool share, GqBoolInt &p)
Constructor for cloning p.
Definition: bool-int.hpp:124
NqBoolInt(Home home, ViewArray< VX > &b, int c)
Constructor for posting.
Definition: bool-int.hpp:339
virtual ExecStatus advise(Space &home, Advisor &a, const Delta &d)
Give advice to propagator.
Definition: bool-int.hpp:247
Negated Boolean view.
Definition: view.hpp:1503
bool one(const Gecode::FloatValArgs &a)
Check whether has only one coefficients.
Definition: linear.cpp:50
void post(Home home, Term< BoolView > *t, int n, IntRelType irt, IntView x, int c, IntConLevel)
Post propagator for linear constraint over Booleans.
Definition: bool-post.cpp:608
void cancel(Space &home, Propagator &p, IntSet &y)
Definition: rel.hpp:84
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as high unary)
Definition: bool-int.hpp:98
ExecStatus resubscribe(Space &home, Propagator &p, VX &x0, ViewArray< VX > &x, VY &x1, ViewArray< VY > &y)
Definition: clause.hpp:142
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition: bool-int.hpp:104
Baseclass for integer Boolean sum.
Definition: linear.hh:779
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition: arithmetic.cpp:57
static ExecStatus post(Home home, ViewArray< VX > &x, int c, VB b)
Post propagator for .
Definition: bool-int.hpp:615
static ExecStatus post(Home home, ViewArray< VX > &x, int c, VB b)
Post propagator for .
Definition: bool-int.hpp:713
static ExecStatus post(Home home, ViewArray< VX > &x, int c)
Post propagator for .
Definition: bool-int.hpp:302
Propagator for integer disequal to Boolean sum (cardinality)
Definition: linear.hh:869
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: bool-int.hpp:689
bool normalize(Term< View > *t, int &n, Term< View > *&t_p, int &n_p, Term< View > *&t_n, int &n_n, int &g)
Normalize linear integer constraints.
Definition: post.hpp:119
virtual ExecStatus advise(Space &home, Advisor &a, const Delta &d)
Give advice to propagator.
Definition: bool-int.hpp:135
A & advisor(void) const
Return advisor.
Definition: core.hpp:3408
Base-class for propagators.
Definition: core.hpp:755
Expensive.
Definition: core.hpp:564
Base-class for advisors.
Definition: core.hpp:926
ReGqBoolInt(Space &home, bool share, ReGqBoolInt &p)
Constructor for cloning p.
Definition: bool-int.hpp:562
ReEqBoolInt(Space &home, bool share, ReEqBoolInt &p)
Constructor for cloning p.
Definition: bool-int.hpp:664
Class to iterate over advisors of a council.
Definition: core.hpp:227
ReLinBoolInt(Space &home, bool share, ReLinBoolInt &p)
Constructor for cloning p.
Definition: bool-int.hpp:499
Propagation has computed fixpoint.
Definition: core.hpp:528
static PropCost unary(PropCost::Mod m)
Single variable for modifier pcm.
Definition: core.hpp:4058
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition: bool-int.hpp:510
Computation spaces.
Definition: core.hpp:1362
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
Definition: bool-int.hpp:402
Base-class for both propagators and branchers.
Definition: core.hpp:666
Gecode::IntSet d(v, 7)
Council< Advisor > co
Council for single advisor.
Definition: linear.hh:905
Gecode::FloatVal c(-8, 8)
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:236
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:238
int n_as
Number of active subscriptions.
Definition: linear.hh:786
virtual Actor * copy(Space &home, bool share)
Create copy during cloning.
Definition: bool-int.hpp:129
Execution has resulted in failure.
Definition: core.hpp:525
EqBoolInt(Space &home, bool share, EqBoolInt &p)
Constructor for cloning p.
Definition: bool-int.hpp:236
Binary propagator.
Definition: propagator.hpp:87
Propagator for integer less or equal to Boolean sum (cardinality)
Definition: linear.hh:840
void subscribe(Space &home, Propagator &p, PropCond pc, bool process=true)
Subscribe propagator p with propagation condition pc to variable.
Definition: array.hpp:1400
View base(void) const
Return view from which this view is derived.
Definition: view.hpp:526
Propagator for integer equal to Boolean sum (cardinality)
Definition: linear.hh:811
void subscribe(Space &home, Propagator &p, IntSet &y)
Definition: rel.hpp:74
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: bool-int.hpp:439
unsigned int size(I &i)
Size of all ranges of range iterator i.
int c
Righthandside.
Definition: linear.hh:790
static ExecStatus post(Home home, ViewArray< VX > &x, int c)
Post propagator for .
Definition: bool-int.hpp:191
bool resubscribe(Space &home, VX &y)
Update subscription.
Definition: bool-int.hpp:414
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: bool-int.hpp:282
void normalize(void)
Normalize by removing unused views.
Definition: bool-int.hpp:486
Propagator for reified integer less or equal to Boolean sum (cardinality)
Definition: linear.hh:941
void normalize(void)
Normalize by removing unused views.
Definition: bool-int.hpp:62
Propagator for reified integer equal to Boolean sum (cardinality)
Definition: linear.hh:971
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
Definition: macros.hpp:45
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: bool-int.hpp:586
virtual Actor * copy(Space &home, bool share)
Create copy during cloning.
Definition: bool-int.hpp:670
Baseclass for reified integer Boolean sum.
Definition: linear.hh:902
void check(const FloatVal &n, const char *l)
Check whether float n is a valid number, otherwise throw out of limits exception with information l...
Definition: limits.hpp:48
static NegBoolView neg(BoolView x)
Return negated View.
Definition: bool-int.hpp:533
static ExecStatus post(Home home, ViewArray< VX > &b, int c)
Post propagator for .
Definition: bool-int.hpp:375
virtual Actor * copy(Space &home, bool share)
Create copy during cloning.
Definition: bool-int.hpp:568
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:253
NegBoolView NegView
The negated view.
Definition: bool-int.hpp:531
Generic domain change information to be supplied to advisors.
Definition: core.hpp:275
Traits for Boolean negation view.
Definition: linear.hh:932
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: bool-int.hpp:176
virtual size_t dispose(Space &home)
Delete actor and return its size.
Definition: core.hpp:2877
Propagation cost.
Definition: core.hpp:537
friend class Advisor
Definition: core.hpp:759
Boolean n-ary disjunction propagator.
Definition: bool.hh:355
ExecStatus
Definition: core.hpp:523
#define forceinline
Definition: config.hpp:132
virtual Actor * copy(Space &home, bool share)
Create copy during cloning.
Definition: bool-int.hpp:241
LinBoolInt(Space &home, bool share, LinBoolInt &p)
Constructor for cloning p.
Definition: bool-int.hpp:88
Execution is okay.
Definition: core.hpp:527
virtual ExecStatus advise(Space &home, Advisor &a, const Delta &d)
Give advice to propagator.
Definition: bool-int.hpp:574
Propagation has not computed fixpoint.
Definition: core.hpp:526
Council< Advisor > co
Council for managing single advisor.
Definition: linear.hh:782
static ExecStatus post(Home home, ViewArray< BV > &b)
Post propagator .
Definition: or.hpp:667
ViewArray< VX > x
Views not yet subscribed to.
Definition: linear.hh:874
int size(void) const
Return size of array (number of elements)
Definition: array.hpp:1215
static ExecStatus post(Home home, ViewArray< VX > &x, VY y)
Post propagator .
Definition: or.hpp:773
struct Gecode::@518::NNF::@57::@58 b
For binary nodes (and, or, eqv)
Gecode toplevel namespace
Implication for reification.
Definition: int.hh:840
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as high unary)
Definition: bool-int.hpp:521
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition: bool-int.hpp:349
static BoolView neg(NegBoolView x)
Return negated View.
Definition: bool-int.hpp:545
int ModEventDelta
Modification event deltas.
Definition: core.hpp:173
Home class for posting propagators
Definition: core.hpp:717
VB b
Control variable.
Definition: linear.hh:913
struct Gecode::@518::NNF::@57::@59 a
For atomic nodes.
int c
Righthandside.
Definition: linear.hh:876
Equivalence for reification (default)
Definition: int.hh:833
const Gecode::PropCond PC_INT_VAL
Propagate when a view becomes assigned (single value)
Definition: var-type.hpp:82
const Gecode::PropCond PC_BOOL_VAL
Propagate when a view becomes assigned (single value)
Definition: var-type.hpp:126
Boolean view for Boolean variables.
Definition: view.hpp:1315
ViewArray< VX > x
Views.
Definition: linear.hh:907