Generated on Sat Feb 7 2015 02:01:24 for Gecode by doxygen 1.8.9.1
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: 2010-03-03 17:32:21 +0100 (Wed, 03 Mar 2010) $ by $Author: schulte $
11  * $Revision: 10364 $
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
66  ScaleBoolArray::update(Space& home, bool share, ScaleBoolArray& sba) {
67  int n = static_cast<int>(sba._lst - sba._fst);
68  if (n > 0) {
69  _fst = home.alloc<ScaleBool>(n);
70  _lst = _fst+n;
71  for (int i=n; i--; ) {
72  _fst[i].a = sba._fst[i].a;
73  _fst[i].x.update(home,share,sba._fst[i].x);
74  }
75  } else {
76  _fst = _lst = NULL;
77  }
78  }
80  ScaleBoolArray::fst(void) const {
81  return _fst;
82  }
84  ScaleBoolArray::lst(void) const {
85  return _lst;
86  }
87  forceinline void
89  _fst = f;
90  }
91  forceinline void
93  _lst = l;
94  }
95  forceinline bool
96  ScaleBoolArray::empty(void) const {
97  return _fst == _lst;
98  }
99  forceinline int
100  ScaleBoolArray::size(void) const {
101  return static_cast<int>(_lst - _fst);
102  }
103  forceinline bool
104  ScaleBoolArray::ScaleDec::operator ()(const ScaleBool& x,
105  const ScaleBool& y) {
106  return x.a > y.a;
107  }
108 
109  inline void
111  ScaleDec scale_dec;
112  Support::quicksort<ScaleBool,ScaleDec>(fst(), size(), scale_dec);
113  }
114 
115 
116  /*
117  * Empty array of scale Boolean views
118  *
119  */
124  forceinline void
126  forceinline void
128  forceinline void
131  EmptyScaleBoolArray::fst(void) const { return NULL; }
133  EmptyScaleBoolArray::lst(void) const { return NULL; }
134  forceinline void
136  forceinline void
138  forceinline bool
139  EmptyScaleBoolArray::empty(void) const { return true; }
140  forceinline int
141  EmptyScaleBoolArray::size(void) const { return 0; }
142  forceinline void
144 
145 
146  /*
147  * Base-class for Boolean constraints with coefficients
148  *
149  */
150 
151  template<class SBAP, class SBAN, class VX, PropCond pcx>
154  SBAP& p0, SBAN& n0,
155  VX x0, int c0)
156  : Propagator(home), p(p0), n(n0), x(x0), c(c0) {
157  x.subscribe(home,*this,pcx);
158  p.subscribe(home,*this);
159  n.subscribe(home,*this);
160  }
161 
162  template<class SBAP, class SBAN, class VX, PropCond pcx>
163  PropCost
165  const ModEventDelta&) const {
166  return PropCost::linear(PropCost::LO, p.size() + n.size());
167  }
168 
169  template<class SBAP, class SBAN, class VX, PropCond pcx>
170  forceinline size_t
172  x.cancel(home,*this,pcx);
173  p.cancel(home,*this);
174  n.cancel(home,*this);
175  (void) Propagator::dispose(home);
176  return sizeof(*this);
177  }
178 
179  template<class SBAP, class SBAN, class VX, PropCond pcx>
182  Propagator& pr,
183  SBAP& p0, SBAN& n0,
184  VX x0, int c0)
185  : Propagator(home,share,pr), c(c0) {
186  x.update(home,share,x0);
187  p.update(home,share,p0);
188  n.update(home,share,n0);
189  }
190 
191  /*
192  * Boolean equality with coefficients
193  *
194  */
195 
196  template<class SBAP, class SBAN, class VX>
199  SBAP& p, SBAN& n,
200  VX x, int c)
201  : LinBoolScale<SBAP,SBAN,VX,PC_INT_BND>(home,p,n,x,c) {}
202 
203  template<class SBAP, class SBAN, class VX>
206  Propagator& pr,
207  SBAP& p, SBAN& n,
208  VX x, int c)
209  : LinBoolScale<SBAP,SBAN,VX,PC_INT_BND>(home,share,pr,p,n,x,c) {}
210 
211  template<class SBAP, class SBAN, class VX>
212  Actor*
214  if (p.empty()) {
216  if (x.assigned()) {
217  ZeroIntView z;
219  (home,share,*this,ep,n,z,c+x.val());
220  } else {
222  (home,share,*this,ep,n,x,c);
223  }
224  } else if (n.empty()) {
226  if (x.assigned()) {
227  ZeroIntView z;
229  (home,share,*this,p,en,z,c+x.val());
230  } else {
232  (home,share,*this,p,en,x,c);
233  }
234  } else {
235  return new (home) EqBoolScale<SBAP,SBAN,VX>(home,share,*this,p,n,x,c);
236  }
237  }
238 
239  template<class SBAP, class SBAN, class VX>
240  ExecStatus
242  int sl_p = 0; // Lower bound, computed positive
243  int su_n = 0; // Upper bound, computed negative
244  if (BoolView::me(med) == ME_BOOL_VAL) {
245  // Eliminate assigned positive views while keeping order
246  {
247  // Skip not assigned views
248  ScaleBool* f = p.fst();
249  ScaleBool* l = p.lst();
250  while ((f < l) && f->x.none()) {
251  su_n += f->a; f++;
252  }
253  // Copy unassigned views to t
254  ScaleBool* t = f;
255  while (f < l) {
256  if (f->x.one()) {
257  c -= f->a;
258  } else if (f->x.none()) {
259  su_n += f->a; *t = *f; t++;
260  }
261  f++;
262  }
263  p.lst(t);
264  }
265  // Eliminate assigned negative views while keeping order
266  {
267  // Skip not assigned views
268  ScaleBool* f = n.fst();
269  ScaleBool* l = n.lst();
270  while ((f < l) && f->x.none()) {
271  sl_p += f->a; f++;
272  }
273  // Copy unassigned views to t
274  ScaleBool* t = f;
275  while (f < l) {
276  if (f->x.one()) {
277  c += f->a;
278  } else if (f->x.none()) {
279  sl_p += f->a; *t = *f; t++;
280  }
281  f++;
282  }
283  n.lst(t);
284  }
285  } else {
286  for (ScaleBool* f=p.fst(); f<p.lst(); f++)
287  su_n += f->a;
288  for (ScaleBool* f=n.fst(); f<n.lst(); f++)
289  sl_p += f->a;
290  }
291 
292  if (p.empty() && n.empty()) {
293  GECODE_ME_CHECK(x.eq(home,-c));
294  return home.ES_SUBSUMED(*this);
295  }
296 
297  sl_p += x.max() + c;
298  su_n -= x.min() + c;
299 
300  const int MOD_SL = 1 << 0;
301  const int MOD_SU = 1 << 1;
302 
303  int mod = MOD_SL | MOD_SU;
304 
305  do {
306  if ((mod & MOD_SL) != 0) {
307  mod -= MOD_SL;
308  // Propagate lower bound for positive Boolean views
309  {
310  ScaleBool* f=p.fst();
311  for (ScaleBool* l=p.lst(); (f < l) && (f->a > sl_p); f++) {
312  GECODE_ME_CHECK(f->x.zero_none(home));
313  su_n -= f->a;
314  }
315  if (f > p.fst()) {
316  p.fst(f); mod |= MOD_SU;
317  }
318  }
319  // Propagate lower bound for negative Boolean views
320  {
321  ScaleBool* f=n.fst();
322  for (ScaleBool* l=n.lst(); (f < l) && (f->a > sl_p); f++) {
323  GECODE_ME_CHECK(f->x.one_none(home)); c += f->a;
324  su_n -= f->a;
325  }
326  if (f > n.fst()) {
327  n.fst(f); mod |= MOD_SU;
328  }
329  }
330  // Propagate lower bound for integer view
331  {
332  const int x_min = x.min();
333  ModEvent me = x.gq(home,x.max() - sl_p);
334  if (me_failed(me))
335  return ES_FAILED;
336  if (me_modified(me)) {
337  su_n -= x.min() - x_min;
338  mod |= MOD_SU;
339  }
340  }
341  }
342  if ((mod & MOD_SU) != 0) {
343  mod -= MOD_SU;
344  // Propagate upper bound for positive Boolean views
345  {
346  ScaleBool* f=p.fst();
347  for (ScaleBool* l=p.lst(); (f < l) && (f->a > su_n); f++) {
348  GECODE_ME_CHECK(f->x.one_none(home)); c -= f->a;
349  sl_p -= f->a;
350  }
351  if (f > p.fst()) {
352  p.fst(f); mod |= MOD_SL;;
353  }
354  }
355  // Propagate upper bound for negative Boolean views
356  {
357  ScaleBool* f=n.fst();
358  for (ScaleBool* l=n.lst(); (f < l) && (f->a > su_n); f++) {
359  GECODE_ME_CHECK(f->x.zero_none(home));
360  sl_p -= f->a;
361  }
362  if (f > n.fst()) {
363  n.fst(f); mod |= MOD_SL;;
364  }
365  }
366  // Propagate upper bound for integer view
367  {
368  const int x_max = x.max();
369  ModEvent me = x.lq(home,x.min() + su_n);
370  if (me_failed(me))
371  return ES_FAILED;
372  if (me_modified(me)) {
373  sl_p += x.max() - x_max;
374  mod |= MOD_SL;;
375  }
376  }
377  }
378  } while (mod != 0);
379 
380  return (sl_p == -su_n) ? home.ES_SUBSUMED(*this) : ES_FIX;
381  }
382 
383 
384 
385  template<class SBAP, class SBAN, class VX>
386  ExecStatus
388  SBAP& p, SBAN& n, VX x, int c) {
389  p.sort(); n.sort();
390  if (p.empty()) {
393  (home,ep,n,x,c);
394  } else if (n.empty()) {
397  (home,p,en,x,c);
398  } else {
399  (void) new (home) EqBoolScale<SBAP,SBAN,VX>
400  (home,p,n,x,c);
401  }
402  return ES_OK;
403  }
404 
405 
406  /*
407  * Boolean inequality with coefficients
408  *
409  */
410 
411  template<class SBAP, class SBAN, class VX>
414  SBAP& p, SBAN& n,
415  VX x, int c)
416  : LinBoolScale<SBAP,SBAN,VX,PC_INT_BND>(home,p,n,x,c) {}
417 
418  template<class SBAP, class SBAN, class VX>
421  Propagator& pr,
422  SBAP& p, SBAN& n,
423  VX x, int c)
424  : LinBoolScale<SBAP,SBAN,VX,PC_INT_BND>(home,share,pr,p,n,x,c) {}
425 
426  template<class SBAP, class SBAN, class VX>
427  Actor*
429  if (p.empty()) {
431  if (x.assigned()) {
432  ZeroIntView z;
434  (home,share,*this,ep,n,z,c+x.val());
435  } else {
437  (home,share,*this,ep,n,x,c);
438  }
439  } else if (n.empty()) {
441  if (x.assigned()) {
442  ZeroIntView z;
444  (home,share,*this,p,en,z,c+x.val());
445  } else {
447  (home,share,*this,p,en,x,c);
448  }
449  } else {
450  return new (home) LqBoolScale<SBAP,SBAN,VX>(home,share,*this,p,n,x,c);
451  }
452  }
453 
454  template<class SBAP, class SBAN, class VX>
455  ExecStatus
457  int sl = 0;
458  if (BoolView::me(med) == ME_BOOL_VAL) {
459  // Eliminate assigned positive views while keeping order
460  {
461  // Skip not assigned views
462  ScaleBool* f = p.fst();
463  ScaleBool* l = p.lst();
464  while ((f < l) && f->x.none())
465  f++;
466  // Copy unassigned views to t
467  ScaleBool* t = f;
468  while (f < l) {
469  if (f->x.one()) {
470  c -= f->a;
471  } else if (f->x.none()) {
472  *t = *f; t++;
473  }
474  f++;
475  }
476  p.lst(t);
477  }
478  // Eliminate assigned negative views while keeping order
479  {
480  // Skip not assigned views
481  ScaleBool* f = n.fst();
482  ScaleBool* l = n.lst();
483  while ((f < l) && f->x.none()) {
484  sl += f->a; f++;
485  }
486  // Copy unassigned views to t
487  ScaleBool* t = f;
488  while (f < l) {
489  if (f->x.one()) {
490  c += f->a;
491  } else if (f->x.none()) {
492  sl += f->a; *t = *f; t++;
493  }
494  f++;
495  }
496  n.lst(t);
497  }
498  } else {
499  for (ScaleBool* f=n.fst(); f<n.lst(); f++)
500  sl += f->a;
501  }
502 
503  sl += x.max() + c;
504 
505  // Propagate upper bound for positive Boolean views
506  {
507  ScaleBool* f=p.fst();
508  for (ScaleBool* l=p.lst(); (f < l) && (f->a > sl); f++)
509  GECODE_ME_CHECK(f->x.zero_none(home));
510  p.fst(f);
511  }
512  // Propagate lower bound for negative Boolean views
513  {
514  ScaleBool* f=n.fst();
515  for (ScaleBool* l=n.lst(); (f < l) && (f->a > sl); f++) {
516  c += f->a;
517  GECODE_ME_CHECK(f->x.one_none(home));
518  }
519  n.fst(f);
520  }
521  ExecStatus es = ES_FIX;
522  // Propagate lower bound for integer view
523  {
524  const int slx = x.max() - sl;
525  ModEvent me = x.gq(home,slx);
526  if (me_failed(me))
527  return ES_FAILED;
528  if (me_modified(me) && (slx != x.min()))
529  es = ES_NOFIX;
530  }
531 
532  if (p.empty() && n.empty())
533  return home.ES_SUBSUMED(*this);
534 
535  return es;
536  }
537 
538 
539 
540  template<class SBAP, class SBAN, class VX>
541  ExecStatus
543  SBAP& p, SBAN& n, VX x, int c) {
544  p.sort(); n.sort();
545  if (p.empty()) {
548  (home,ep,n,x,c);
549  } else if (n.empty()) {
552  (home,p,en,x,c);
553  } else {
554  (void) new (home) LqBoolScale<SBAP,SBAN,VX>
555  (home,p,n,x,c);
556  }
557  return ES_OK;
558  }
559 
560  /*
561  * Boolean disequality with coefficients
562  *
563  */
564 
565  template<class SBAP, class SBAN, class VX>
568  SBAP& p, SBAN& n,
569  VX x, int c)
570  : LinBoolScale<SBAP,SBAN,VX,PC_INT_VAL>(home,p,n,x,c) {}
571 
572  template<class SBAP, class SBAN, class VX>
575  Propagator& pr,
576  SBAP& p, SBAN& n,
577  VX x, int c)
578  : LinBoolScale<SBAP,SBAN,VX,PC_INT_VAL>(home,share,pr,p,n,x,c) {}
579 
580  template<class SBAP, class SBAN, class VX>
581  Actor*
583  if (p.empty()) {
585  if (x.assigned()) {
586  ZeroIntView z;
588  (home,share,*this,ep,n,z,c+x.val());
589  } else {
591  (home,share,*this,ep,n,x,c);
592  }
593  } else if (n.empty()) {
595  if (x.assigned()) {
596  ZeroIntView z;
598  (home,share,*this,p,en,z,c+x.val());
599  } else {
601  (home,share,*this,p,en,x,c);
602  }
603  } else {
604  return new (home) NqBoolScale<SBAP,SBAN,VX>(home,share,*this,p,n,x,c);
605  }
606  }
607 
608  template<class SBAP, class SBAN, class VX>
609  ExecStatus
611  if (BoolView::me(med) == ME_BOOL_VAL) {
612  // Eliminate assigned positive views
613  {
614  ScaleBool* f = p.fst();
615  ScaleBool* t = f;
616  ScaleBool* l = p.lst();
617  while (f < l) {
618  if (f->x.one()) {
619  c -= f->a; *f = *(t++);
620  } else if (f->x.zero()) {
621  *f = *(t++);
622  }
623  f++;
624  }
625  p.fst(t);
626  }
627  // Eliminate assigned negative views
628  {
629  ScaleBool* f = n.fst();
630  ScaleBool* t = f;
631  ScaleBool* l = n.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  n.fst(t);
641  }
642  }
643 
644  if (p.empty() && n.empty()) {
645  GECODE_ME_CHECK(x.nq(home,-c));
646  return home.ES_SUBSUMED(*this);
647  }
648 
649  if (x.assigned()) {
650  int r = x.val()+c;
651  if (p.empty() && (n.size() == 1)) {
652  if (r == -n.fst()->a) {
653  GECODE_ME_CHECK(n.fst()->x.zero_none(home));
654  } else if (r == 0) {
655  GECODE_ME_CHECK(n.fst()->x.one_none(home));
656  }
657  return home.ES_SUBSUMED(*this);
658  }
659  if ((p.size() == 1) && n.empty()) {
660  if (r == p.fst()->a) {
661  GECODE_ME_CHECK(p.fst()->x.zero_none(home));
662  } else if (r == 0) {
663  GECODE_ME_CHECK(p.fst()->x.one_none(home));
664  }
665  return home.ES_SUBSUMED(*this);
666  }
667  }
668  return ES_FIX;
669  }
670 
671 
672 
673  template<class SBAP, class SBAN, class VX>
674  ExecStatus
676  SBAP& p, SBAN& n, VX x, int c) {
677  if (p.empty()) {
680  (home,ep,n,x,c);
681  } else if (n.empty()) {
684  (home,p,en,x,c);
685  } else {
686  (void) new (home) NqBoolScale<SBAP,SBAN,VX>
687  (home,p,n,x,c);
688  }
689  return ES_OK;
690  }
691 
692 }}}
693 
694 // STATISTICS: int-prop
695 
bool none(void) const
Test whether view is not yet assigned.
Definition: bool.hpp:222
void sort(void)
Sort array in decreasing order of coefficients.
Definition: bool-scale.hpp:143
NodeType t
Type of node.
Definition: bool-expr.cpp:234
Propagator for inequality to Boolean sum with coefficients
Definition: linear.hh:1252
BoolView x
Boolean view.
Definition: linear.hh:1115
bool empty(void) const
Test whether array is empty.
Definition: bool-scale.hpp:139
NNF * l
Left subtree.
Definition: bool-expr.cpp:244
void mod(Home home, IntVar x0, IntVar x1, IntVar x2, IntConLevel icl)
Post propagator for .
Definition: arithmetic.cpp:213
Empty array of scale Boolean views.
Definition: linear.hh:1162
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
void subscribe(Space &home, Propagator &p)
Subscribe propagator p.
Definition: bool-scale.hpp:125
int ModEvent
Type for modification events.
Definition: core.hpp:146
Base-class for propagators.
Definition: core.hpp:755
void sort(void)
Sort array in decreasing order of coefficients.
Definition: bool-scale.hpp:110
static ExecStatus post(Home home, SBAP &p, SBAN &n, VX x, int c)
Post propagator.
Definition: bool-scale.hpp:542
int size(void) const
Return number of elements.
Definition: bool-scale.hpp:100
void cancel(Space &home, Propagator &p)
Cancel propagator p.
Definition: bool-scale.hpp:61
ScaleBool * lst(void) const
Return pointer after last element.
Definition: bool-scale.hpp:133
Propagation has computed fixpoint.
Definition: core.hpp:528
Computation spaces.
Definition: core.hpp:1362
Base-class for both propagators and branchers.
Definition: core.hpp:666
Propagator for equality to Boolean sum with coefficients
Definition: linear.hh:1225
T * alloc(long unsigned int n)
Allocate block of n objects of type T from space heap.
Definition: core.hpp:2397
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:456
LqBoolScale(Home home, SBAP &p, SBAN &n, VX x, int c)
Constructor for creation.
Definition: bool-scale.hpp:413
Execution has resulted in failure.
Definition: core.hpp:525
ModEvent zero_none(Space &home)
Assign not yet assigned view to zero.
Definition: bool.hpp:232
EqBoolScale(Home home, SBAP &p, SBAN &n, VX x, int c)
Constructor for creation.
Definition: bool-scale.hpp:198
static ExecStatus post(Home home, SBAP &p, SBAN &n, VX x, int c)
Post propagator.
Definition: bool-scale.hpp:675
NNF * r
Right subtree.
Definition: bool-expr.cpp:246
ScaleBool * fst(void) const
Return pointer to first element.
Definition: bool-scale.hpp:131
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:582
ScaleBool * fst(void) const
Return pointer to first element.
Definition: bool-scale.hpp:80
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: bool-scale.hpp:610
ScaleBoolArray(void)
Default constructor.
Definition: bool-scale.hpp:45
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:494
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
Definition: macros.hpp:45
Propagator for disequality to Boolean sum with coefficients
Definition: linear.hh:1279
SBAN n
Negative Boolean views with coefficients on left-hand side.
Definition: linear.hh:1201
EmptyScaleBoolArray(void)
Default constructor.
Definition: bool-scale.hpp:121
Base class for linear Boolean constraints with coefficients.
Definition: linear.hh:1196
Zero integer view.
Definition: view.hpp:959
void update(Space &home, bool share, ScaleBoolArray &sba)
Update sba during copying.
Definition: bool-scale.hpp:66
bool one(void) const
Test whether view is assigned to be one.
Definition: bool.hpp:218
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition: bool-scale.hpp:171
Array of scale Boolean views.
Definition: linear.hh:1119
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:253
SBAP p
Positive Boolean views with coefficients on left-hand side.
Definition: linear.hh:1199
ScaleBool * lst(void) const
Return pointer after last element.
Definition: bool-scale.hpp:84
virtual size_t dispose(Space &home)
Delete actor and return its size.
Definition: core.hpp:2877
Propagation cost.
Definition: core.hpp:537
virtual Actor * copy(Space &home, bool share)
Create copy during cloning.
Definition: bool-scale.hpp:428
ExecStatus
Definition: core.hpp:523
static ModEvent me(const ModEventDelta &med)
Return modification event for view type in med.
#define forceinline
Definition: config.hpp:132
bool me_modified(ModEvent me)
Check whether modification event me describes variable modification.
Definition: modevent.hpp:63
bool empty(void) const
Test whether array is empty.
Definition: bool-scale.hpp:96
Coefficient and Boolean view.
Definition: linear.hh:1110
NqBoolScale(Home home, SBAP &p, SBAN &n, VX x, int c)
Constructor for creation.
Definition: bool-scale.hpp:567
Execution is okay.
Definition: core.hpp:527
Propagation has not computed fixpoint.
Definition: core.hpp:526
void cancel(Space &home, Propagator &p)
Cancel propagator p.
Definition: bool-scale.hpp:127
int size(void) const
Return number of elements.
Definition: bool-scale.hpp:141
Gecode toplevel namespace
void update(Space &home, bool share, EmptyScaleBoolArray &esba)
Update sba during copying.
Definition: bool-scale.hpp:129
ModEvent one_none(Space &home)
Assign not yet assigned view to one.
Definition: bool.hpp:236
int a
Integer coefficient.
Definition: linear.hh:1113
bool zero(void) const
Test whether view is assigned to be zero.
Definition: bool.hpp:214
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as low linear)
Definition: bool-scale.hpp:164
LinBoolScale(Home home, SBAP &p, SBAN &n, VX x, int c)
Constructor for creation.
Definition: bool-scale.hpp:153
int ModEventDelta
Modification event deltas.
Definition: core.hpp:173
static ExecStatus post(Home home, SBAP &p, SBAN &n, VX x, int c)
Post propagator.
Definition: bool-scale.hpp:387
Home class for posting propagators
Definition: core.hpp:717
VX x
Integer view on right-hand side.
Definition: linear.hh:1203
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:213
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:241
const Gecode::ModEvent ME_BOOL_VAL
Domain operation has resulted in a value (assigned variable)
Definition: var-type.hpp:116