Generated on Thu Jan 31 2019 20:56:37 for Gecode by doxygen 1.8.15
bool-scale.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  *
6  * Copyright:
7  * Christian Schulte, 2006
8  *
9  * Last modified:
10  * $Date: 2016-06-29 17:28:17 +0200 (Wed, 29 Jun 2016) $ by $Author: schulte $
11  * $Revision: 15137 $
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 namespace Gecode { namespace Int { namespace Linear {
39 
40  /*
41  * Array of scale Boolean views
42  *
43  */
48  if (n > 0) {
49  _fst = home.alloc<ScaleBool>(n);
50  _lst = _fst+n;
51  } else {
52  _fst = _lst = NULL;
53  }
54  }
55  forceinline void
57  for (ScaleBool* f = _fst; f < _lst; f++)
58  f->x.subscribe(home,p,PC_BOOL_VAL);
59  }
60  forceinline void
62  for (ScaleBool* f = _fst; f < _lst; f++)
63  f->x.cancel(home,p,PC_BOOL_VAL);
64  }
65  forceinline void
67  for (ScaleBool* f = _fst; f < _lst; f++)
68  f->x.reschedule(home,p,PC_BOOL_VAL);
69  }
70  forceinline void
71  ScaleBoolArray::update(Space& home, bool share, ScaleBoolArray& sba) {
72  int n = static_cast<int>(sba._lst - sba._fst);
73  if (n > 0) {
74  _fst = home.alloc<ScaleBool>(n);
75  _lst = _fst+n;
76  for (int i=n; i--; ) {
77  _fst[i].a = sba._fst[i].a;
78  _fst[i].x.update(home,share,sba._fst[i].x);
79  }
80  } else {
81  _fst = _lst = NULL;
82  }
83  }
85  ScaleBoolArray::fst(void) const {
86  return _fst;
87  }
89  ScaleBoolArray::lst(void) const {
90  return _lst;
91  }
92  forceinline void
94  _fst = f;
95  }
96  forceinline void
98  _lst = l;
99  }
100  forceinline bool
101  ScaleBoolArray::empty(void) const {
102  return _fst == _lst;
103  }
104  forceinline int
105  ScaleBoolArray::size(void) const {
106  return static_cast<int>(_lst - _fst);
107  }
108  forceinline bool
109  ScaleBoolArray::ScaleDec::operator ()(const ScaleBool& x,
110  const ScaleBool& y) {
111  return x.a > y.a;
112  }
113 
114  inline void
116  ScaleDec scale_dec;
117  Support::quicksort<ScaleBool,ScaleDec>(fst(), size(), scale_dec);
118  }
119 
120 
121  /*
122  * Empty array of scale Boolean views
123  *
124  */
129  forceinline void
131  forceinline void
133  forceinline void
135  forceinline void
138  EmptyScaleBoolArray::fst(void) const { return NULL; }
140  EmptyScaleBoolArray::lst(void) const { return NULL; }
141  forceinline void
143  forceinline void
145  forceinline bool
146  EmptyScaleBoolArray::empty(void) const { return true; }
147  forceinline int
148  EmptyScaleBoolArray::size(void) const { return 0; }
149  forceinline void
151 
152 
153  /*
154  * Base-class for Boolean constraints with coefficients
155  *
156  */
157 
158  template<class SBAP, class SBAN, class VX, PropCond pcx>
161  SBAP& p0, SBAN& n0,
162  VX x0, int c0)
163  : Propagator(home), p(p0), n(n0), x(x0), c(c0) {
164  x.subscribe(home,*this,pcx);
165  p.subscribe(home,*this);
166  n.subscribe(home,*this);
167  }
168 
169  template<class SBAP, class SBAN, class VX, PropCond pcx>
170  PropCost
172  const ModEventDelta&) const {
173  return PropCost::linear(PropCost::LO, p.size() + n.size());
174  }
175 
176  template<class SBAP, class SBAN, class VX, PropCond pcx>
177  void
179  x.reschedule(home,*this,pcx);
180  p.reschedule(home,*this);
181  n.reschedule(home,*this);
182  }
183 
184  template<class SBAP, class SBAN, class VX, PropCond pcx>
185  forceinline size_t
187  x.cancel(home,*this,pcx);
188  p.cancel(home,*this);
189  n.cancel(home,*this);
190  (void) Propagator::dispose(home);
191  return sizeof(*this);
192  }
193 
194  template<class SBAP, class SBAN, class VX, PropCond pcx>
197  Propagator& pr,
198  SBAP& p0, SBAN& n0,
199  VX x0, int c0)
200  : Propagator(home,share,pr), c(c0) {
201  x.update(home,share,x0);
202  p.update(home,share,p0);
203  n.update(home,share,n0);
204  }
205 
206  /*
207  * Boolean equality with coefficients
208  *
209  */
210 
211  template<class SBAP, class SBAN, class VX>
214  SBAP& p, SBAN& n,
215  VX x, int c)
216  : LinBoolScale<SBAP,SBAN,VX,PC_INT_BND>(home,p,n,x,c) {}
217 
218  template<class SBAP, class SBAN, class VX>
221  Propagator& pr,
222  SBAP& p, SBAN& n,
223  VX x, int c)
224  : LinBoolScale<SBAP,SBAN,VX,PC_INT_BND>(home,share,pr,p,n,x,c) {}
225 
226  template<class SBAP, class SBAN, class VX>
227  Actor*
229  if (p.empty()) {
231  if (x.assigned()) {
232  ZeroIntView z;
234  (home,share,*this,ep,n,z,c+x.val());
235  } else {
237  (home,share,*this,ep,n,x,c);
238  }
239  } else if (n.empty()) {
241  if (x.assigned()) {
242  ZeroIntView z;
244  (home,share,*this,p,en,z,c+x.val());
245  } else {
247  (home,share,*this,p,en,x,c);
248  }
249  } else {
250  return new (home) EqBoolScale<SBAP,SBAN,VX>(home,share,*this,p,n,x,c);
251  }
252  }
253 
254  template<class SBAP, class SBAN, class VX>
255  ExecStatus
257  int sl_p = 0; // Lower bound, computed positive
258  int su_n = 0; // Upper bound, computed negative
259  if (BoolView::me(med) == ME_BOOL_VAL) {
260  // Eliminate assigned positive views while keeping order
261  {
262  // Skip not assigned views
263  ScaleBool* f = p.fst();
264  ScaleBool* l = p.lst();
265  while ((f < l) && f->x.none()) {
266  su_n += f->a; f++;
267  }
268  // Copy unassigned views to t
269  ScaleBool* t = f;
270  while (f < l) {
271  if (f->x.one()) {
272  c -= f->a;
273  } else if (f->x.none()) {
274  su_n += f->a; *t = *f; t++;
275  }
276  f++;
277  }
278  p.lst(t);
279  }
280  // Eliminate assigned negative views while keeping order
281  {
282  // Skip not assigned views
283  ScaleBool* f = n.fst();
284  ScaleBool* l = n.lst();
285  while ((f < l) && f->x.none()) {
286  sl_p += f->a; f++;
287  }
288  // Copy unassigned views to t
289  ScaleBool* t = f;
290  while (f < l) {
291  if (f->x.one()) {
292  c += f->a;
293  } else if (f->x.none()) {
294  sl_p += f->a; *t = *f; t++;
295  }
296  f++;
297  }
298  n.lst(t);
299  }
300  } else {
301  for (ScaleBool* f=p.fst(); f<p.lst(); f++)
302  su_n += f->a;
303  for (ScaleBool* f=n.fst(); f<n.lst(); f++)
304  sl_p += f->a;
305  }
306 
307  if (p.empty() && n.empty()) {
308  GECODE_ME_CHECK(x.eq(home,-c));
309  return home.ES_SUBSUMED(*this);
310  }
311 
312  sl_p += x.max() + c;
313  su_n -= x.min() + c;
314 
315  const int MOD_SL = 1 << 0;
316  const int MOD_SU = 1 << 1;
317 
318  int mod = MOD_SL | MOD_SU;
319 
320  do {
321  if ((mod & MOD_SL) != 0) {
322  mod -= MOD_SL;
323  // Propagate lower bound for positive Boolean views
324  {
325  ScaleBool* f=p.fst();
326  for (ScaleBool* l=p.lst(); (f < l) && (f->a > sl_p); f++) {
327  GECODE_ME_CHECK(f->x.zero_none(home));
328  su_n -= f->a;
329  }
330  if (f > p.fst()) {
331  p.fst(f); mod |= MOD_SU;
332  }
333  }
334  // Propagate lower bound for negative Boolean views
335  {
336  ScaleBool* f=n.fst();
337  for (ScaleBool* l=n.lst(); (f < l) && (f->a > sl_p); f++) {
338  GECODE_ME_CHECK(f->x.one_none(home)); c += f->a;
339  su_n -= f->a;
340  }
341  if (f > n.fst()) {
342  n.fst(f); mod |= MOD_SU;
343  }
344  }
345  // Propagate lower bound for integer view
346  {
347  const int x_min = x.min();
348  ModEvent me = x.gq(home,x.max() - sl_p);
349  if (me_failed(me))
350  return ES_FAILED;
351  if (me_modified(me)) {
352  su_n -= x.min() - x_min;
353  mod |= MOD_SU;
354  }
355  }
356  }
357  if ((mod & MOD_SU) != 0) {
358  mod -= MOD_SU;
359  // Propagate upper bound for positive Boolean views
360  {
361  ScaleBool* f=p.fst();
362  for (ScaleBool* l=p.lst(); (f < l) && (f->a > su_n); f++) {
363  GECODE_ME_CHECK(f->x.one_none(home)); c -= f->a;
364  sl_p -= f->a;
365  }
366  if (f > p.fst()) {
367  p.fst(f); mod |= MOD_SL;;
368  }
369  }
370  // Propagate upper bound for negative Boolean views
371  {
372  ScaleBool* f=n.fst();
373  for (ScaleBool* l=n.lst(); (f < l) && (f->a > su_n); f++) {
374  GECODE_ME_CHECK(f->x.zero_none(home));
375  sl_p -= f->a;
376  }
377  if (f > n.fst()) {
378  n.fst(f); mod |= MOD_SL;;
379  }
380  }
381  // Propagate upper bound for integer view
382  {
383  const int x_max = x.max();
384  ModEvent me = x.lq(home,x.min() + su_n);
385  if (me_failed(me))
386  return ES_FAILED;
387  if (me_modified(me)) {
388  sl_p += x.max() - x_max;
389  mod |= MOD_SL;;
390  }
391  }
392  }
393  } while (mod != 0);
394 
395  return (sl_p == -su_n) ? home.ES_SUBSUMED(*this) : ES_FIX;
396  }
397 
398 
399 
400  template<class SBAP, class SBAN, class VX>
401  ExecStatus
403  SBAP& p, SBAN& n, VX x, int c) {
404  p.sort(); n.sort();
405  if (p.empty()) {
408  (home,ep,n,x,c);
409  } else if (n.empty()) {
412  (home,p,en,x,c);
413  } else {
414  (void) new (home) EqBoolScale<SBAP,SBAN,VX>
415  (home,p,n,x,c);
416  }
417  return ES_OK;
418  }
419 
420 
421  /*
422  * Boolean inequality with coefficients
423  *
424  */
425 
426  template<class SBAP, class SBAN, class VX>
429  SBAP& p, SBAN& n,
430  VX x, int c)
431  : LinBoolScale<SBAP,SBAN,VX,PC_INT_BND>(home,p,n,x,c) {}
432 
433  template<class SBAP, class SBAN, class VX>
436  Propagator& pr,
437  SBAP& p, SBAN& n,
438  VX x, int c)
439  : LinBoolScale<SBAP,SBAN,VX,PC_INT_BND>(home,share,pr,p,n,x,c) {}
440 
441  template<class SBAP, class SBAN, class VX>
442  Actor*
444  if (p.empty()) {
446  if (x.assigned()) {
447  ZeroIntView z;
449  (home,share,*this,ep,n,z,c+x.val());
450  } else {
452  (home,share,*this,ep,n,x,c);
453  }
454  } else if (n.empty()) {
456  if (x.assigned()) {
457  ZeroIntView z;
459  (home,share,*this,p,en,z,c+x.val());
460  } else {
462  (home,share,*this,p,en,x,c);
463  }
464  } else {
465  return new (home) LqBoolScale<SBAP,SBAN,VX>(home,share,*this,p,n,x,c);
466  }
467  }
468 
469  template<class SBAP, class SBAN, class VX>
470  ExecStatus
472  int sl = 0;
473  if (BoolView::me(med) == ME_BOOL_VAL) {
474  // Eliminate assigned positive views while keeping order
475  {
476  // Skip not assigned views
477  ScaleBool* f = p.fst();
478  ScaleBool* l = p.lst();
479  while ((f < l) && f->x.none())
480  f++;
481  // Copy unassigned views to t
482  ScaleBool* t = f;
483  while (f < l) {
484  if (f->x.one()) {
485  c -= f->a;
486  } else if (f->x.none()) {
487  *t = *f; t++;
488  }
489  f++;
490  }
491  p.lst(t);
492  }
493  // Eliminate assigned negative views while keeping order
494  {
495  // Skip not assigned views
496  ScaleBool* f = n.fst();
497  ScaleBool* l = n.lst();
498  while ((f < l) && f->x.none()) {
499  sl += f->a; f++;
500  }
501  // Copy unassigned views to t
502  ScaleBool* t = f;
503  while (f < l) {
504  if (f->x.one()) {
505  c += f->a;
506  } else if (f->x.none()) {
507  sl += f->a; *t = *f; t++;
508  }
509  f++;
510  }
511  n.lst(t);
512  }
513  } else {
514  for (ScaleBool* f=n.fst(); f<n.lst(); f++)
515  sl += f->a;
516  }
517 
518  sl += x.max() + c;
519 
520  // Propagate upper bound for positive Boolean views
521  {
522  ScaleBool* f=p.fst();
523  for (ScaleBool* l=p.lst(); (f < l) && (f->a > sl); f++)
524  GECODE_ME_CHECK(f->x.zero_none(home));
525  p.fst(f);
526  }
527  // Propagate lower bound for negative Boolean views
528  {
529  ScaleBool* f=n.fst();
530  for (ScaleBool* l=n.lst(); (f < l) && (f->a > sl); f++) {
531  c += f->a;
532  GECODE_ME_CHECK(f->x.one_none(home));
533  }
534  n.fst(f);
535  }
536  ExecStatus es = ES_FIX;
537  // Propagate lower bound for integer view
538  {
539  const int slx = x.max() - sl;
540  ModEvent me = x.gq(home,slx);
541  if (me_failed(me))
542  return ES_FAILED;
543  if (me_modified(me) && (slx != x.min()))
544  es = ES_NOFIX;
545  }
546 
547  if (p.empty() && n.empty())
548  return home.ES_SUBSUMED(*this);
549 
550  return es;
551  }
552 
553 
554 
555  template<class SBAP, class SBAN, class VX>
556  ExecStatus
558  SBAP& p, SBAN& n, VX x, int c) {
559  p.sort(); n.sort();
560  if (p.empty()) {
563  (home,ep,n,x,c);
564  } else if (n.empty()) {
567  (home,p,en,x,c);
568  } else {
569  (void) new (home) LqBoolScale<SBAP,SBAN,VX>
570  (home,p,n,x,c);
571  }
572  return ES_OK;
573  }
574 
575  /*
576  * Boolean disequality with coefficients
577  *
578  */
579 
580  template<class SBAP, class SBAN, class VX>
583  SBAP& p, SBAN& n,
584  VX x, int c)
585  : LinBoolScale<SBAP,SBAN,VX,PC_INT_VAL>(home,p,n,x,c) {}
586 
587  template<class SBAP, class SBAN, class VX>
590  Propagator& pr,
591  SBAP& p, SBAN& n,
592  VX x, int c)
593  : LinBoolScale<SBAP,SBAN,VX,PC_INT_VAL>(home,share,pr,p,n,x,c) {}
594 
595  template<class SBAP, class SBAN, class VX>
596  Actor*
598  if (p.empty()) {
600  if (x.assigned()) {
601  ZeroIntView z;
603  (home,share,*this,ep,n,z,c+x.val());
604  } else {
606  (home,share,*this,ep,n,x,c);
607  }
608  } else if (n.empty()) {
610  if (x.assigned()) {
611  ZeroIntView z;
613  (home,share,*this,p,en,z,c+x.val());
614  } else {
616  (home,share,*this,p,en,x,c);
617  }
618  } else {
619  return new (home) NqBoolScale<SBAP,SBAN,VX>(home,share,*this,p,n,x,c);
620  }
621  }
622 
623  template<class SBAP, class SBAN, class VX>
624  ExecStatus
626  if (BoolView::me(med) == ME_BOOL_VAL) {
627  // Eliminate assigned positive views
628  {
629  ScaleBool* f = p.fst();
630  ScaleBool* t = f;
631  ScaleBool* l = p.lst();
632  while (f < l) {
633  if (f->x.one()) {
634  c -= f->a; *f = *(t++);
635  } else if (f->x.zero()) {
636  *f = *(t++);
637  }
638  f++;
639  }
640  p.fst(t);
641  }
642  // Eliminate assigned negative views
643  {
644  ScaleBool* f = n.fst();
645  ScaleBool* t = f;
646  ScaleBool* l = n.lst();
647  while (f < l) {
648  if (f->x.one()) {
649  c += f->a; *f = *(t++);
650  } else if (f->x.zero()) {
651  *f = *(t++);
652  }
653  f++;
654  }
655  n.fst(t);
656  }
657  }
658 
659  if (p.empty() && n.empty()) {
660  GECODE_ME_CHECK(x.nq(home,-c));
661  return home.ES_SUBSUMED(*this);
662  }
663 
664  if (x.assigned()) {
665  int r = x.val()+c;
666  if (p.empty() && (n.size() == 1)) {
667  if (r == -n.fst()->a) {
668  GECODE_ME_CHECK(n.fst()->x.zero_none(home));
669  } else if (r == 0) {
670  GECODE_ME_CHECK(n.fst()->x.one_none(home));
671  }
672  return home.ES_SUBSUMED(*this);
673  }
674  if ((p.size() == 1) && n.empty()) {
675  if (r == p.fst()->a) {
676  GECODE_ME_CHECK(p.fst()->x.zero_none(home));
677  } else if (r == 0) {
678  GECODE_ME_CHECK(p.fst()->x.one_none(home));
679  }
680  return home.ES_SUBSUMED(*this);
681  }
682  }
683  return ES_FIX;
684  }
685 
686 
687 
688  template<class SBAP, class SBAN, class VX>
689  ExecStatus
691  SBAP& p, SBAN& n, VX x, int c) {
692  if (p.empty()) {
695  (home,ep,n,x,c);
696  } else if (n.empty()) {
699  (home,p,en,x,c);
700  } else {
701  (void) new (home) NqBoolScale<SBAP,SBAN,VX>
702  (home,p,n,x,c);
703  }
704  return ES_OK;
705  }
706 
707 }}}
708 
709 // STATISTICS: int-prop
710 
void mod(Home home, IntVar x0, IntVar x1, IntVar x2, IntPropLevel ipl)
Post propagator for .
Definition: arithmetic.cpp:267
void sort(void)
Sort array in decreasing order of coefficients.
Definition: bool-scale.hpp:150
NodeType t
Type of node.
Definition: bool-expr.cpp:234
Propagator for inequality to Boolean sum with coefficients
Definition: linear.hh:1282
BoolView x
Boolean view.
Definition: linear.hh:1139
NNF * l
Left subtree.
Definition: bool-expr.cpp:244
Empty array of scale Boolean views.
Definition: linear.hh:1188
ScaleBool * lst(void) const
Return pointer after last element.
Definition: bool-scale.hpp:140
ExecStatus ES_SUBSUMED(Propagator &p)
Definition: core.hpp:3614
ScaleBool * lst(void) const
Return pointer after last element.
Definition: bool-scale.hpp:89
void subscribe(Space &home, Propagator &p)
Subscribe propagator p.
Definition: bool-scale.hpp:130
void reschedule(Space &home, Propagator &p)
Schedule propagator p.
Definition: bool-scale.hpp:134
bool assigned(void) const
Test whether view is assigned.
Definition: var.hpp:123
int ModEvent
Type for modification events.
Definition: core.hpp:142
void linear(Home home, const FloatVarArgs &x, FloatRelType frt, FloatVal c)
Post propagator for .
Definition: linear.cpp:45
Base-class for propagators.
Definition: core.hpp:1092
void sort(void)
Sort array in decreasing order of coefficients.
Definition: bool-scale.hpp:115
static ExecStatus post(Home home, SBAP &p, SBAN &n, VX x, int c)
Post propagator.
Definition: bool-scale.hpp:557
void cancel(Space &home, Propagator &p)
Cancel propagator p.
Definition: bool-scale.hpp:61
Propagation has computed fixpoint.
Definition: core.hpp:545
Computation spaces.
Definition: core.hpp:1748
Base-class for both propagators and branchers.
Definition: core.hpp:696
Propagator for equality to Boolean sum with coefficients
Definition: linear.hh:1255
T * alloc(long unsigned int n)
Allocate block of n objects of type T from space heap.
Definition: core.hpp:2868
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
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: bool-scale.hpp:471
LqBoolScale(Home home, SBAP &p, SBAN &n, VX x, int c)
Constructor for creation.
Definition: bool-scale.hpp:428
Execution has resulted in failure.
Definition: core.hpp:542
EqBoolScale(Home home, SBAP &p, SBAN &n, VX x, int c)
Constructor for creation.
Definition: bool-scale.hpp:213
static ExecStatus post(Home home, SBAP &p, SBAN &n, VX x, int c)
Post propagator.
Definition: bool-scale.hpp:690
const Gecode::PropCond PC_INT_BND
Propagate when minimum or maximum of a view changes.
Definition: var-type.hpp:91
virtual Actor * copy(Space &home, bool share)
Create copy during cloning.
Definition: bool-scale.hpp:597
int size(void) const
Return number of elements.
Definition: bool-scale.hpp:148
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: bool-scale.hpp:625
ScaleBoolArray(void)
Default constructor.
Definition: bool-scale.hpp:45
Post propagator for SetVar SetOpType SetVar SetRelType SetVar z
Definition: set.hh:784
void subscribe(Space &home, Propagator &p)
Subscribe propagator p.
Definition: bool-scale.hpp:56
void update(Space &home, bool share, VarImpView< Var > &y)
Update this view to be a clone of view y.
Definition: view.hpp:529
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
Definition: macros.hpp:56
Propagator for disequality to Boolean sum with coefficients
Definition: linear.hh:1309
EmptyScaleBoolArray(void)
Default constructor.
Definition: bool-scale.hpp:126
Base class for linear Boolean constraints with coefficients.
Definition: linear.hh:1224
Zero integer view.
Definition: view.hpp:959
void update(Space &home, bool share, ScaleBoolArray &sba)
Update sba during copying.
Definition: bool-scale.hpp:71
Post propagator for SetVar SetOpType SetVar SetRelType r
Definition: set.hh:784
Post propagator for f(x \diamond_{\mathit{op}} y) \sim_r z \f$ void rel(Home home
Post propagator for SetVar SetOpType SetVar y
Definition: set.hh:784
Array of scale Boolean views.
Definition: linear.hh:1143
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:253
int size(void) const
Return number of elements.
Definition: bool-scale.hpp:105
Propagation cost.
Definition: core.hpp:554
ScaleBool * fst(void) const
Return pointer to first element.
Definition: bool-scale.hpp:138
virtual Actor * copy(Space &home, bool share)
Create copy during cloning.
Definition: bool-scale.hpp:443
ExecStatus
Definition: core.hpp:540
static ModEvent me(const ModEventDelta &med)
Return modification event for view type in med.
Definition: view.hpp:514
#define forceinline
Definition: config.hpp:173
bool me_modified(ModEvent me)
Check whether modification event me describes variable modification.
Definition: modevent.hpp:63
Coefficient and Boolean view.
Definition: linear.hh:1134
NqBoolScale(Home home, SBAP &p, SBAN &n, VX x, int c)
Constructor for creation.
Definition: bool-scale.hpp:582
Post propagator for SetVar x
Definition: set.hh:784
Execution is okay.
Definition: core.hpp:544
Propagation has not computed fixpoint.
Definition: core.hpp:543
void cancel(Space &home, Propagator &p)
Cancel propagator p.
Definition: bool-scale.hpp:132
bool empty(void) const
Test whether array is empty.
Definition: bool-scale.hpp:101
Gecode toplevel namespace
void update(Space &home, bool share, EmptyScaleBoolArray &esba)
Update sba during copying.
Definition: bool-scale.hpp:136
int a
Integer coefficient.
Definition: linear.hh:1137
void reschedule(Space &home, Propagator &p, IntSet &y)
Definition: rel.hpp:96
LinBoolScale(Home home, SBAP &p, SBAN &n, VX x, int c)
Constructor for creation.
Definition: bool-scale.hpp:160
void reschedule(Space &home, Propagator &p)
Schedule propagator p.
Definition: bool-scale.hpp:66
bool empty(void) const
Test whether array is empty.
Definition: bool-scale.hpp:146
int ModEventDelta
Modification event deltas.
Definition: core.hpp:169
static ExecStatus post(Home home, SBAP &p, SBAN &n, VX x, int c)
Post propagator.
Definition: bool-scale.hpp:402
Home class for posting propagators
Definition: core.hpp:922
ScaleBool * fst(void) const
Return pointer to first element.
Definition: bool-scale.hpp:85
bool me_failed(ModEvent me)
Check whether modification event me is failed.
Definition: modevent.hpp:58
virtual Actor * copy(Space &home, bool share)
Create copy during cloning.
Definition: bool-scale.hpp:228
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
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: bool-scale.hpp:256
const Gecode::ModEvent ME_BOOL_VAL
Domain operation has resulted in a value (assigned variable)
Definition: var-type.hpp:116