Generated on Thu Jul 25 2019 00:00:00 for Gecode by doxygen 1.8.15
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: 2016-06-29 17:28:17 +0200 (Wed, 29 Jun 2016) $ by $Author: schulte $
13  * $Revision: 15137 $
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) && !disabled())
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  void
177  int n = x.size()-n_hs+n_as;
178  if ((c <= 0) || (c >= n))
179  VX::schedule(home,*this,ME_INT_VAL);
180  }
181 
182  template<class VX>
183  ExecStatus
185  // Check for failure due to a disabled propagator
186  if (x.size() - n_hs + n_as < c)
187  return ES_FAILED;
188  if (c > 0) {
189  assert((n_as == c) && (x.size() == n_hs));
190  // Signal that propagator is running
191  n_as = 0;
192  // All views must be one to satisfy inequality
193  for (int i=n_hs; i--; )
194  if (x[i].none())
195  GECODE_ME_CHECK(x[i].one_none(home));
196  }
197  return home.ES_SUBSUMED(*this);
198  }
199 
200  template<class VX>
201  ExecStatus
203  // Eliminate assigned views
204  int n_x = x.size();
205  for (int i=n_x; i--; )
206  if (x[i].zero()) {
207  x[i] = x[--n_x];
208  } else if (x[i].one()) {
209  x[i] = x[--n_x]; c--;
210  }
211  x.size(n_x);
212  // RHS too large
213  if (n_x < c)
214  return ES_FAILED;
215  // Whatever the x[i] take for values, the inequality is subsumed
216  if (c <= 0)
217  return ES_OK;
218  // Use Boolean disjunction for this special case
219  if (c == 1)
220  return Bool::NaryOrTrue<VX>::post(home,x);
221  // All views must be one to satisfy inequality
222  if (c == n_x) {
223  for (int i=n_x; i--; )
224  GECODE_ME_CHECK(x[i].one_none(home));
225  return ES_OK;
226  }
227  // This is the needed invariant as c+1 subscriptions must be created
228  assert(n_x > c);
229  (void) new (home) GqBoolInt<VX>(home,x,c);
230  return ES_OK;
231  }
232 
233 
234 
235 
236  /*
237  * Equal propagator (integer rhs)
238  *
239  */
240  template<class VX>
243  : LinBoolInt<VX>(home,x,std::max(c,x.size()-c)+1,c) {}
244 
245  template<class VX>
248  : LinBoolInt<VX>(home,share,p) {}
249 
250  template<class VX>
251  Actor*
252  EqBoolInt<VX>::copy(Space& home, bool share) {
253  return new (home) EqBoolInt<VX>(home,share,*this);
254  }
255 
256  template<class VX>
257  ExecStatus
259  // Check whether propagator is running
260  if (n_as == 0)
261  return ES_FIX;
262 
263  if (VX::one(d))
264  c--;
265  if ((c+1 < n_as) && (x.size()-n_hs < c))
266  goto check;
267  // Find a new subscription
268  for (int i = x.size()-1; i>=n_hs; i--)
269  if (x[i].none()) {
270  std::swap(x[i],x[n_hs]);
271  x[n_hs++].subscribe(home,a);
272  x.size(i+1);
273  return ES_FIX;
274  } else if (x[i].one()) {
275  c--;
276  }
277  // No view left for subscription
278  x.size(n_hs);
279  check:
280  // Do not update subscription
281  n_as--;
282  int n = x.size()-n_hs+n_as;
283  if (((c < 0) || (c > n)) && !disabled())
284  return ES_FAILED;
285  if ((c == 0) || (c == n))
286  return ES_NOFIX;
287  else
288  return ES_FIX;
289  }
290 
291  template<class VX>
292  void
294  int n = x.size()-n_hs+n_as;
295  if ((c <= 0) || (c >= n))
296  VX::schedule(home,*this,ME_INT_VAL);
297  }
298 
299  template<class VX>
300  ExecStatus
302  // Check for failure due to being disabled before
303  if ((c < 0) || (c > x.size()-n_hs+n_as))
304  return ES_FAILED;
305 
306  assert(x.size() == n_hs);
307  // Signal that propagator is running
308  n_as = 0;
309  if (c == 0) {
310  // All views must be zero to satisfy equality
311  for (int i=n_hs; i--; )
312  if (x[i].none())
313  GECODE_ME_CHECK(x[i].zero_none(home));
314  } else {
315  // All views must be one to satisfy equality
316  for (int i=n_hs; i--; )
317  if (x[i].none())
318  GECODE_ME_CHECK(x[i].one_none(home));
319  }
320  return home.ES_SUBSUMED(*this);
321  }
322 
323  template<class VX>
324  ExecStatus
326  // Eliminate assigned views
327  int n_x = x.size();
328  for (int i=n_x; i--; )
329  if (x[i].zero()) {
330  x[i] = x[--n_x];
331  } else if (x[i].one()) {
332  x[i] = x[--n_x]; c--;
333  }
334  x.size(n_x);
335  // RHS too small or too large
336  if ((c < 0) || (c > n_x))
337  return ES_FAILED;
338  // All views must be zero to satisfy equality
339  if (c == 0) {
340  for (int i=n_x; i--; )
341  GECODE_ME_CHECK(x[i].zero_none(home));
342  return ES_OK;
343  }
344  // All views must be one to satisfy equality
345  if (c == n_x) {
346  for (int i=n_x; i--; )
347  GECODE_ME_CHECK(x[i].one_none(home));
348  return ES_OK;
349  }
350  (void) new (home) EqBoolInt<VX>(home,x,c);
351  return ES_OK;
352  }
353 
354 
355  /*
356  * Integer disequal to Boolean sum
357  *
358  */
359 
360  template<class VX>
363  : BinaryPropagator<VX,PC_INT_VAL>(home,
364  b[b.size()-2],
365  b[b.size()-1]), x(b), c(c0) {
366  assert(x.size() >= 2);
367  x.size(x.size()-2);
368  }
369 
370  template<class VX>
371  forceinline size_t
374  return sizeof(*this);
375  }
376 
377  template<class VX>
380  : BinaryPropagator<VX,PC_INT_VAL>(home,share,p), x(home,p.x.size()) {
381  // Eliminate all zeros and ones in original and update
382  int n = p.x.size();
383  int p_c = p.c;
384  for (int i=n; i--; )
385  if (p.x[i].zero()) {
386  n--; p.x[i]=p.x[n]; x[i]=x[n];
387  } else if (p.x[i].one()) {
388  n--; p_c--; p.x[i]=p.x[n]; x[i]=x[n];
389  } else {
390  x[i].update(home,share,p.x[i]);
391  }
392  c = p_c; p.c = p_c;
393  x.size(n); p.x.size(n);
394  }
395 
396  template<class VX>
399  int n = x.size();
400  for (int i=n; i--; )
401  if (x[i].one()) {
402  x[i]=x[--n]; c--;
403  } else if (x[i].zero()) {
404  x[i]=x[--n];
405  }
406  x.size(n);
407  if ((n < c) || (c < 0))
408  return ES_OK;
409  if (n == 0)
410  return (c == 0) ? ES_FAILED : ES_OK;
411  if (n == 1) {
412  if (c == 1) {
413  GECODE_ME_CHECK(x[0].zero_none(home));
414  } else {
415  GECODE_ME_CHECK(x[0].one_none(home));
416  }
417  return ES_OK;
418  }
419  (void) new (home) NqBoolInt(home,x,c);
420  return ES_OK;
421  }
422 
423  template<class VX>
424  Actor*
425  NqBoolInt<VX>::copy(Space& home, bool share) {
426  return new (home) NqBoolInt<VX>(home,share,*this);
427  }
428 
429  template<class VX>
430  PropCost
431  NqBoolInt<VX>::cost(const Space&, const ModEventDelta&) const {
432  return PropCost::linear(PropCost::LO, x.size());
433  }
434 
435  template<class VX>
436  forceinline bool
438  if (y.one())
439  c--;
440  int n = x.size();
441  for (int i=n; i--; )
442  if (x[i].one()) {
443  c--; x[i]=x[--n];
444  } else if (x[i].zero()) {
445  x[i] = x[--n];
446  } else {
447  // New unassigned view found
448  assert(!x[i].zero() && !x[i].one());
449  // Move to y and subscribe
450  y=x[i]; x[i]=x[--n];
451  x.size(n);
452  y.subscribe(home,*this,PC_INT_VAL,false);
453  return true;
454  }
455  // All views have been assigned!
456  x.size(0);
457  return false;
458  }
459 
460  template<class VX>
461  ExecStatus
463  bool s0 = true;
464  if (x0.zero() || x0.one())
465  s0 = resubscribe(home,x0);
466  bool s1 = true;
467  if (x1.zero() || x1.one())
468  s1 = resubscribe(home,x1);
469  int n = x.size() + s0 + s1;
470  if ((n < c) || (c < 0))
471  return home.ES_SUBSUMED(*this);
472  if (n == 0)
473  return (c == 0) ? ES_FAILED : home.ES_SUBSUMED(*this);
474  if (n == 1) {
475  if (s0) {
476  if (c == 1) {
477  GECODE_ME_CHECK(x0.zero_none(home));
478  } else {
479  GECODE_ME_CHECK(x0.one_none(home));
480  }
481  } else {
482  assert(s1);
483  if (c == 1) {
484  GECODE_ME_CHECK(x1.zero_none(home));
485  } else {
486  GECODE_ME_CHECK(x1.one_none(home));
487  }
488  }
489  return home.ES_SUBSUMED(*this);
490  }
491  return ES_FIX;
492  }
493 
494  /*
495  * Baseclass for reified integer Boolean sum
496  *
497  */
498  template<class VX, class VB>
501  int c0, VB b0)
502  : Propagator(home), co(home), x(x0), n_s(x.size()), c(c0), b(b0) {
503  x.subscribe(home,*new (home) Advisor(home,*this,co));
504  b.subscribe(home,*this,PC_BOOL_VAL);
505  }
506 
507  template<class VX, class VB>
508  forceinline void
510  if (n_s != x.size()) {
511  int n_x = x.size();
512  for (int i=n_x; i--; )
513  if (!x[i].none())
514  x[i] = x[--n_x];
515  x.size(n_x);
516  assert(x.size() == n_s);
517  }
518  }
519 
520  template<class VX, class VB>
524  : Propagator(home,share,p), n_s(p.n_s), c(p.c) {
525  p.normalize();
526  co.update(home,share,p.co);
527  x.update(home,share,p.x);
528  b.update(home,share,p.b);
529  }
530 
531  template<class VX, class VB>
532  forceinline size_t
534  Advisors<Advisor> as(co);
535  x.cancel(home,as.advisor());
536  co.dispose(home);
537  b.cancel(home,*this,PC_BOOL_VAL);
538  (void) Propagator::dispose(home);
539  return sizeof(*this);
540  }
541 
542  template<class VX, class VB>
543  PropCost
546  }
547 
548  template<>
551  public:
556  NegBoolView y(x); return y;
557  }
558  };
559 
560  template<>
563  public:
565  typedef BoolView NegView;
568  return x.base();
569  }
570  };
571 
572 
573  /*
574  * Reified greater or equal propagator (integer rhs)
575  *
576  */
577  template<class VX, class VB, ReifyMode rm>
580  : ReLinBoolInt<VX,VB>(home,x,c,b) {}
581 
582  template<class VX, class VB, ReifyMode rm>
586  : ReLinBoolInt<VX,VB>(home,share,p) {}
587 
588  template<class VX, class VB, ReifyMode rm>
589  Actor*
590  ReGqBoolInt<VX,VB,rm>::copy(Space& home, bool share) {
591  return new (home) ReGqBoolInt<VX,VB,rm>(home,share,*this);
592  }
593 
594  template<class VX, class VB, ReifyMode rm>
595  ExecStatus
597  if (VX::one(d))
598  c--;
599  n_s--;
600  if ((n_s < c) || (c <= 0))
601  return ES_NOFIX;
602  else
603  return ES_FIX;
604  }
605 
606  template<class VX, class VB, ReifyMode rm>
607  void
609  b.reschedule(home,*this,PC_BOOL_VAL);
610  if ((n_s < c) || (c <= 0))
611  VX::schedule(home,*this,ME_BOOL_VAL);
612  }
613 
614  template<class VX, class VB, ReifyMode rm>
615  ExecStatus
617  if (b.none()) {
618  if (c <= 0) {
619  if (rm != RM_IMP)
620  GECODE_ME_CHECK(b.one_none(home));
621  } else {
622  if (rm != RM_PMI)
623  GECODE_ME_CHECK(b.zero_none(home));
624  }
625  } else {
626  normalize();
627  if (b.one()) {
628  if (rm != RM_PMI)
629  GECODE_REWRITE(*this,(GqBoolInt<VX>::post(home(*this),x,c)));
630  } else {
631  if (rm != RM_IMP) {
633  for (int i=x.size(); i--; )
634  nx[i]=BoolNegTraits<VX>::neg(x[i]);
636  ::post(home(*this),nx,x.size()-c+1));
637  }
638  }
639  }
640  return home.ES_SUBSUMED(*this);
641  }
642 
643  template<class VX, class VB, ReifyMode rm>
644  ExecStatus
646  assert(!b.assigned()); // checked before posting
647 
648  // Eliminate assigned views
649  int n_x = x.size();
650  for (int i=n_x; i--; )
651  if (x[i].zero()) {
652  x[i] = x[--n_x];
653  } else if (x[i].one()) {
654  x[i] = x[--n_x]; c--;
655  }
656  x.size(n_x);
657  if (n_x < c) {
658  // RHS too large
659  if (rm != RM_PMI)
660  GECODE_ME_CHECK(b.zero_none(home));
661  } else if (c <= 0) {
662  // Whatever the x[i] take for values, the inequality is subsumed
663  if (rm != RM_IMP)
664  GECODE_ME_CHECK(b.one_none(home));
665  } else if ((c == 1) && (rm == RM_EQV)) {
666  // Equivalent to Boolean disjunction
667  return Bool::NaryOr<VX,VB>::post(home,x,b);
668  } else if ((c == n_x) && (rm == RM_EQV)) {
669  // Equivalent to Boolean conjunction, transform to Boolean disjunction
671  for (int i=n_x; i--; )
672  nx[i]=BoolNegTraits<VX>::neg(x[i]);
673  return Bool::NaryOr
674  <typename BoolNegTraits<VX>::NegView,
676  ::post(home,nx,BoolNegTraits<VB>::neg(b));
677  } else {
678  (void) new (home) ReGqBoolInt<VX,VB,rm>(home,x,c,b);
679  }
680  return ES_OK;
681  }
682 
683  /*
684  * Reified equal propagator (integer rhs)
685  *
686  */
687  template<class VX, class VB, ReifyMode rm>
690  : ReLinBoolInt<VX,VB>(home,x,c,b) {}
691 
692  template<class VX, class VB, ReifyMode rm>
696  : ReLinBoolInt<VX,VB>(home,share,p) {}
697 
698  template<class VX, class VB, ReifyMode rm>
699  Actor*
700  ReEqBoolInt<VX,VB,rm>::copy(Space& home, bool share) {
701  return new (home) ReEqBoolInt<VX,VB,rm>(home,share,*this);
702  }
703 
704  template<class VX, class VB, ReifyMode rm>
705  ExecStatus
707  if (VX::one(d))
708  c--;
709  n_s--;
710 
711  if ((c < 0) || (c > n_s) || (n_s == 0))
712  return ES_NOFIX;
713  else
714  return ES_FIX;
715  }
716 
717  template<class VX, class VB, ReifyMode rm>
718  void
720  b.reschedule(home,*this,PC_BOOL_VAL);
721  if ((c < 0) || (c > n_s) || (n_s == 0))
722  VX::schedule(home,*this,ME_BOOL_VAL);
723  }
724 
725  template<class VX, class VB, ReifyMode rm>
726  ExecStatus
728  if (b.none()) {
729  if ((c == 0) && (n_s == 0)) {
730  if (rm != RM_IMP)
731  GECODE_ME_CHECK(b.one_none(home));
732  } else {
733  if (rm != RM_PMI)
734  GECODE_ME_CHECK(b.zero_none(home));
735  }
736  } else {
737  normalize();
738  if (b.one()) {
739  if (rm != RM_PMI)
740  GECODE_REWRITE(*this,(EqBoolInt<VX>::post(home(*this),x,c)));
741  } else {
742  if (rm != RM_IMP)
743  GECODE_REWRITE(*this,(NqBoolInt<VX>::post(home(*this),x,c)));
744  }
745  }
746  return home.ES_SUBSUMED(*this);
747  }
748 
749  template<class VX, class VB, ReifyMode rm>
750  ExecStatus
752  assert(!b.assigned()); // checked before posting
753 
754  // Eliminate assigned views
755  int n_x = x.size();
756  for (int i=n_x; i--; )
757  if (x[i].zero()) {
758  x[i] = x[--n_x];
759  } else if (x[i].one()) {
760  x[i] = x[--n_x]; c--;
761  }
762  x.size(n_x);
763  if ((n_x < c) || (c < 0)) {
764  // RHS too large
765  if (rm != RM_PMI)
766  GECODE_ME_CHECK(b.zero_none(home));
767  } else if ((c == 0) && (n_x == 0)) {
768  // all variables set, and c == 0: equality
769  if (rm != RM_IMP)
770  GECODE_ME_CHECK(b.one_none(home));
771  } else if ((c == 0) && (rm == RM_EQV)) {
772  // Equivalent to Boolean disjunction
775  } else if ((c == n_x) && (rm == RM_EQV)) {
776  // Equivalent to Boolean conjunction, transform to Boolean disjunction
778  for (int i=n_x; i--; )
779  nx[i]=BoolNegTraits<VX>::neg(x[i]);
780  return Bool::NaryOr
781  <typename BoolNegTraits<VX>::NegView,
783  ::post(home,nx,BoolNegTraits<VB>::neg(b));
784  } else {
785  (void) new (home) ReEqBoolInt<VX,VB,rm>(home,x,c,b);
786  }
787  return ES_OK;
788  }
789 
790 
791 }}}
792 
793 // STATISTICS: int-prop
794 
virtual ExecStatus advise(Space &home, Advisor &a, const Delta &d)
Give advice to propagator.
Definition: bool-int.hpp:706
ViewArray< VX > x
Boolean views.
Definition: linear.hh:796
#define GECODE_REWRITE(prop, post)
Rewrite propagator by executing post function.
Definition: macros.hpp:120
void update(Space &, bool share, ViewArray< View > &a)
Update array to be a clone of array a.
Definition: array.hpp:1387
Inverse implication for reification.
Definition: int.hh:850
static PropCost linear(PropCost::Mod m, unsigned int n)
Linear complexity for modifier pcm and size measure n.
Definition: core.hpp:4841
ExecStatus ES_SUBSUMED(Propagator &p)
Definition: core.hpp:3614
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:362
virtual ExecStatus advise(Space &home, Advisor &a, const Delta &d)
Give advice to propagator.
Definition: bool-int.hpp:258
Negated Boolean view.
Definition: view.hpp:1503
bool one(const Gecode::FloatValArgs &a)
Check whether has only one coefficients.
Definition: linear.cpp:50
void cancel(Space &home, Propagator &p, IntSet &y)
Definition: rel.hpp:85
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
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as high unary)
Definition: bool-int.hpp:98
Baseclass for integer Boolean sum.
Definition: linear.hh:791
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition: arithmetic.cpp:53
static ExecStatus post(Home home, ViewArray< VX > &x, int c, VB b)
Post propagator for .
Definition: bool-int.hpp:645
static ExecStatus post(Home home, ViewArray< VX > &x, int c, VB b)
Post propagator for .
Definition: bool-int.hpp:751
static ExecStatus post(Home home, ViewArray< VX > &x, int c)
Post propagator for .
Definition: bool-int.hpp:325
Propagator for integer disequal to Boolean sum (cardinality)
Definition: linear.hh:887
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: bool-int.hpp:727
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
Base-class for propagators.
Definition: core.hpp:1092
Base-class for advisors.
Definition: core.hpp:1294
virtual void reschedule(Space &home)
Schedule function.
Definition: bool-int.hpp:719
ReGqBoolInt(Space &home, bool share, ReGqBoolInt &p)
Constructor for cloning p.
Definition: bool-int.hpp:584
void subscribe(Space &home, Propagator &p, PropCond pc, bool schedule=true)
Subscribe propagator p with propagation condition pc to variable.
Definition: array.hpp:1400
ReEqBoolInt(Space &home, bool share, ReEqBoolInt &p)
Constructor for cloning p.
Definition: bool-int.hpp:694
virtual void reschedule(Space &home)
Schedule function.
Definition: bool-int.hpp:293
Class to iterate over advisors of a council.
Definition: core.hpp:233
ReLinBoolInt(Space &home, bool share, ReLinBoolInt &p)
Constructor for cloning p.
Definition: bool-int.hpp:522
Propagation has computed fixpoint.
Definition: core.hpp:545
static PropCost unary(PropCost::Mod m)
Single variable for modifier pcm.
Definition: core.hpp:4858
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition: bool-int.hpp:533
Computation spaces.
Definition: core.hpp:1748
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
Definition: bool-int.hpp:425
Base-class for both propagators and branchers.
Definition: core.hpp:696
Gecode::IntSet d(v, 7)
Council< Advisor > co
Council for single advisor.
Definition: linear.hh:923
struct Gecode::@579::NNF::@61::@63 a
For atomic nodes.
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)
virtual void reschedule(Space &home)
Schedule function.
Definition: bool-int.hpp:608
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:238
int n_as
Number of active subscriptions.
Definition: linear.hh:798
virtual Actor * copy(Space &home, bool share)
Create copy during cloning.
Definition: bool-int.hpp:129
Execution has resulted in failure.
Definition: core.hpp:542
EqBoolInt(Space &home, bool share, EqBoolInt &p)
Constructor for cloning p.
Definition: bool-int.hpp:247
Binary propagator.
Definition: propagator.hpp:89
Propagator for integer less or equal to Boolean sum (cardinality)
Definition: linear.hh:855
Propagator for integer equal to Boolean sum (cardinality)
Definition: linear.hh:823
const Gecode::ModEvent ME_INT_VAL
Domain operation has resulted in a value (assigned variable)
Definition: var-type.hpp:56
void subscribe(Space &home, Propagator &p, IntSet &y)
Definition: rel.hpp:75
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: bool-int.hpp:462
unsigned int size(I &i)
Size of all ranges of range iterator i.
struct Gecode::@579::NNF::@61::@62 b
For binary nodes (and, or, eqv)
static ExecStatus post(Home home, ViewArray< VX > &x, int c)
Post propagator for .
Definition: bool-int.hpp:202
bool resubscribe(Space &home, VX &y)
Update subscription.
Definition: bool-int.hpp:437
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: bool-int.hpp:301
Expensive.
Definition: core.hpp:582
void normalize(void)
Normalize by removing unused views.
Definition: bool-int.hpp:509
Propagator for reified integer less or equal to Boolean sum (cardinality)
Definition: linear.hh:959
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:991
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
Definition: macros.hpp:56
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: bool-int.hpp:616
virtual Actor * copy(Space &home, bool share)
Create copy during cloning.
Definition: bool-int.hpp:700
Baseclass for reified integer Boolean sum.
Definition: linear.hh:920
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:555
Post propagator for SetVar SetOpType SetVar y
Definition: set.hh:784
static ExecStatus post(Home home, ViewArray< VX > &b, int c)
Post propagator for .
Definition: bool-int.hpp:398
virtual void reschedule(Space &home)
Schedule function.
Definition: bool-int.hpp:176
virtual Actor * copy(Space &home, bool share)
Create copy during cloning.
Definition: bool-int.hpp:590
NegBoolView NegView
The negated view.
Definition: bool-int.hpp:553
Generic domain change information to be supplied to advisors.
Definition: core.hpp:281
Traits for Boolean negation view.
Definition: linear.hh:950
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: bool-int.hpp:184
virtual size_t dispose(Space &home)
Delete actor and return its size.
Definition: core.hpp:3354
Propagation cost.
Definition: core.hpp:554
friend class Advisor
Definition: core.hpp:1096
Boolean n-ary disjunction propagator.
Definition: bool.hh:359
ExecStatus
Definition: core.hpp:540
#define forceinline
Definition: config.hpp:173
virtual Actor * copy(Space &home, bool share)
Create copy during cloning.
Definition: bool-int.hpp:252
LinBoolInt(Space &home, bool share, LinBoolInt &p)
Constructor for cloning p.
Definition: bool-int.hpp:88
Post propagator for SetVar x
Definition: set.hh:784
Execution is okay.
Definition: core.hpp:544
virtual ExecStatus advise(Space &home, Advisor &a, const Delta &d)
Give advice to propagator.
Definition: bool-int.hpp:596
Propagation has not computed fixpoint.
Definition: core.hpp:543
Council< Advisor > co
Council for managing single advisor.
Definition: linear.hh:794
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:892
static ExecStatus post(Home home, ViewArray< VX > &x, VY y)
Post propagator .
Definition: or.hpp:773
Gecode toplevel namespace
Implication for reification.
Definition: int.hh:843
void post(Home home, Term< BoolView > *t, int n, IntRelType irt, IntView x, int c, IntPropLevel)
Post propagator for linear constraint over Booleans.
Definition: bool-post.cpp:593
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition: bool-int.hpp:372
static BoolView neg(NegBoolView x)
Return negated View.
Definition: bool-int.hpp:567
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as high unary)
Definition: bool-int.hpp:544
int size(void) const
Return size of array (number of elements)
Definition: array.hpp:1215
int ModEventDelta
Modification event deltas.
Definition: core.hpp:169
Home class for posting propagators
Definition: core.hpp:922
A & advisor(void) const
Return advisor.
Definition: core.hpp:4061
VB b
Control variable.
Definition: linear.hh:931
int c
Righthandside.
Definition: linear.hh:894
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as low linear)
Definition: bool-int.hpp:431
Equivalence for reification (default)
Definition: int.hh:836
IntRelType swap(IntRelType irt)
Return swapped relation type of irt.
Definition: irt.hpp:41
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
const Gecode::ModEvent ME_BOOL_VAL
Domain operation has resulted in a value (assigned variable)
Definition: var-type.hpp:116
Boolean view for Boolean variables.
Definition: view.hpp:1315
ViewArray< VX > x
Views.
Definition: linear.hh:925