Generated on Fri Aug 24 2012 04:52:17 for Gecode by doxygen 1.8.1.1
linear.hh
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  * Guido Tack <tack@gecode.org>
6  * Tias Guns <tias.guns@cs.kuleuven.be>
7  *
8  * Copyright:
9  * Christian Schulte, 2002
10  * Guido Tack, 2004
11  * Tias Guns, 2009
12  *
13  * Last modified:
14  * $Date: 2009-12-04 23:57:33 +1100 (Fri, 04 Dec 2009) $ by $Author: schulte $
15  * $Revision: 10188 $
16  *
17  * This file is part of Gecode, the generic constraint
18  * development environment:
19  * http://www.gecode.org
20  *
21  * Permission is hereby granted, free of charge, to any person obtaining
22  * a copy of this software and associated documentation files (the
23  * "Software"), to deal in the Software without restriction, including
24  * without limitation the rights to use, copy, modify, merge, publish,
25  * distribute, sublicense, and/or sell copies of the Software, and to
26  * permit persons to whom the Software is furnished to do so, subject to
27  * the following conditions:
28  *
29  * The above copyright notice and this permission notice shall be
30  * included in all copies or substantial portions of the Software.
31  *
32  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
33  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
34  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
35  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
36  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
37  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
38  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
39  *
40  */
41 
42 #ifndef __GECODE_INT_LINEAR_HH__
43 #define __GECODE_INT_LINEAR_HH__
44 
45 #include <gecode/int.hh>
46 
52 namespace Gecode { namespace Int { namespace Linear {
53 
54  /*
55  * Binary propagators
56  *
57  */
58 
68  template<class Val, class A, class B, PropCond pc>
69  class LinBin : public Propagator {
70  protected:
72  A x0;
74  B x1;
76  Val c;
78  LinBin(Space& home, bool share, LinBin& p);
80  LinBin(Space& home, bool share, Propagator& p, A x0, B x1, Val c);
82  LinBin(Home home, A x0, B x1, Val c);
83  public:
85  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
87  virtual size_t dispose(Space& home);
88  };
89 
99  template<class Val, class A, class B, PropCond pc, class Ctrl>
100  class ReLinBin : public Propagator {
101  protected:
103  A x0;
105  B x1;
107  Val c;
109  Ctrl b;
111  ReLinBin(Space& home, bool share, ReLinBin& p);
113  ReLinBin(Home home, A x0, B x1, Val c, Ctrl b);
114  public:
116  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
118  virtual size_t dispose(Space& home);
119  };
120 
133  template<class Val, class A, class B>
134  class EqBin : public LinBin<Val,A,B,PC_INT_BND> {
135  protected:
139 
141  EqBin(Space& home, bool share, EqBin& p);
143  EqBin(Home home, A x0, B x1, Val c);
144  public:
146  EqBin(Space& home, bool share, Propagator& p, A x0, B x1, Val c);
148  virtual Actor* copy(Space& home, bool share);
150  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
152  static ExecStatus post(Home home, A x0, B x1, Val c);
153  };
154 
167  template<class Val, class A, class B, class Ctrl>
168  class ReEqBin : public ReLinBin<Val,A,B,PC_INT_BND,Ctrl> {
169  protected:
174 
176  ReEqBin(Space& home, bool share, ReEqBin& p);
178  ReEqBin(Home home,A,B,Val,Ctrl);
179  public:
181  virtual Actor* copy(Space& home, bool share);
183  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
185  static ExecStatus post(Home home, A x0, B x1, Val c, Ctrl b);
186  };
187 
200  template<class Val, class A, class B>
201  class NqBin : public LinBin<Val,A,B,PC_INT_VAL> {
202  protected:
206 
208  NqBin(Space& home, bool share, NqBin& p);
210  NqBin(Home home, A x0, B x1, Val c);
211  public:
213  NqBin(Space& home, bool share, Propagator& p, A x0, B x1, Val c);
215  virtual Actor* copy(Space& home, bool share);
217  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
219  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
221  static ExecStatus post(Home home, A x0, B x1, Val c);
222  };
223 
236  template<class Val, class A, class B>
237  class LqBin : public LinBin<Val,A,B,PC_INT_BND> {
238  protected:
242 
244  LqBin(Space& home, bool share, LqBin& p);
246  LqBin(Home home, A x0, B x1, Val c);
247  public:
249  LqBin(Space& home, bool share, Propagator& p, A x0, B x1, Val c);
251  virtual Actor* copy(Space& home, bool share);
253  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
255  static ExecStatus post(Home home, A x0, B x1, Val c);
256  };
257 
270  template<class Val, class A, class B>
271  class GqBin : public LinBin<Val,A,B,PC_INT_BND> {
272  protected:
276 
278  GqBin(Space& home, bool share, GqBin& p);
280  GqBin(Home home, A x0, B x1, Val c);
281  public:
283  GqBin(Space& home, bool share, Propagator& p, A x0, B x1, Val c);
285  virtual Actor* copy(Space& home, bool share);
287  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
289  static ExecStatus post(Home home, A x0, B x1, Val c);
290  };
291 
304  template<class Val, class A, class B>
305  class ReLqBin : public ReLinBin<Val,A,B,PC_INT_BND,BoolView> {
306  protected:
311 
313  ReLqBin(Space& home, bool share, ReLqBin& p);
315  ReLqBin(Home home, A x0, B x1, Val c, BoolView b);
316  public:
318  virtual Actor* copy(Space& home, bool share);
320  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
322  static ExecStatus post(Home home, A x0, B x1, Val c, BoolView b);
323  };
324 
325 }}}
326 
328 
329 namespace Gecode { namespace Int { namespace Linear {
330 
331  /*
332  * Ternary propagators
333  *
334  */
335 
345  template<class Val, class A, class B, class C, PropCond pc>
346  class LinTer : public Propagator {
347  protected:
349  A x0;
351  B x1;
353  C x2;
355  Val c;
357  LinTer(Space& home, bool share, LinTer& p);
359  LinTer(Home home, A x0, B x1, C x2, Val c);
361  LinTer(Space& home, bool share, Propagator& p, A x0, B x1, C x2, Val c);
362  public:
364  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
366  virtual size_t dispose(Space& home);
367  };
368 
381  template<class Val, class A, class B, class C>
382  class EqTer : public LinTer<Val,A,B,C,PC_INT_BND> {
383  protected:
388 
390  EqTer(Space& home, bool share, EqTer& p);
392  EqTer(Home home, A x0, B x1, C x2, Val c);
393  public:
395  EqTer(Space& home, bool share, Propagator& p, A x0, B x1, C x2, Val c);
397  virtual Actor* copy(Space& home, bool share);
399  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
401  static ExecStatus post(Home home, A x0, B x1, C x2, Val c);
402  };
403 
416  template<class Val, class A, class B, class C>
417  class NqTer : public LinTer<Val,A,B,C,PC_INT_VAL> {
418  protected:
423 
425  NqTer(Space& home, bool share, NqTer& p);
427  NqTer(Home home, A x0, B x1, C x2, Val c);
428  public:
430  NqTer(Space& home, bool share, Propagator& p, A x0, B x1, C x2, Val c);
432  virtual Actor* copy(Space& home, bool share);
434  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
436  static ExecStatus post(Home home, A x0, B x1, C x2, Val c);
437  };
438 
451  template<class Val, class A, class B, class C>
452  class LqTer : public LinTer<Val,A,B,C,PC_INT_BND> {
453  protected:
458 
460  LqTer(Space& home, bool share, LqTer& p);
462  LqTer(Home home, A x0, B x1, C x2, Val c);
463  public:
465  LqTer(Space& home, bool share, Propagator& p, A x0, B x1, C x2, Val c);
467  virtual Actor* copy(Space& home, bool share);
469  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
471  static ExecStatus post(Home home, A x0, B x1, C x2, Val c);
472  };
473 
474 }}}
475 
477 
478 namespace Gecode { namespace Int { namespace Linear {
479 
480  /*
481  * n-ary propagators
482  *
483  */
484 
494  template<class Val, class P, class N, PropCond pc>
495  class Lin : public Propagator {
496  protected:
502  Val c;
503 
505  Lin(Space& home, bool share, Lin<Val,P,N,pc>& p);
507  Lin(Home home, ViewArray<P>& x, ViewArray<N>& y, Val c);
508  public:
510  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
512  virtual size_t dispose(Space& home);
513  };
514 
524  template<class Val, class P, class N, PropCond pc, class Ctrl>
525  class ReLin : public Lin<Val,P,N,pc> {
526  protected:
528  Ctrl b;
530  ReLin(Space& home, bool share, ReLin& p);
532  ReLin(Home home, ViewArray<P>& x, ViewArray<N>& y, Val c, Ctrl b);
533  public:
535  virtual size_t dispose(Space& home);
536  };
537 
543  template<class Val, class View>
545  Val& c, Val& sl, Val& su);
546 
552  template<class Val, class View>
554  Val& c, Val& sl, Val& su);
555 
568  template<class Val, class P, class N>
569  class Eq : public Lin<Val,P,N,PC_INT_BND> {
570  protected:
574 
576  Eq(Space& home, bool share, Eq& p);
577  public:
579  Eq(Home home, ViewArray<P>& x, ViewArray<N>& y, Val c);
581  virtual Actor* copy(Space& home, bool share);
583  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
585  static ExecStatus
586  post(Home home, ViewArray<P>& x, ViewArray<N>& y, Val c);
587  };
588 
599  template<class Val, class View>
600  class DomEq
601  : public Lin<Val,View,View,PC_INT_DOM> {
602  protected:
606 
608  DomEq(Space& home, bool share, DomEq& p);
609  public:
611  DomEq(Home home, ViewArray<View>& x, ViewArray<View>& y, Val c);
613  virtual Actor* copy(Space& home, bool share);
620  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
622  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
624  static ExecStatus
625  post(Home home, ViewArray<View>& x, ViewArray<View>& y, Val c);
626  };
627 
640  template<class Val, class P, class N, class Ctrl>
641  class ReEq : public ReLin<Val,P,N,PC_INT_BND,Ctrl> {
642  protected:
647 
649  ReEq(Space& home, bool share, ReEq& p);
650  public:
652  ReEq(Home home, ViewArray<P>& x, ViewArray<N>& y, Val c, Ctrl b);
654  virtual Actor* copy(Space& home, bool share);
656  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
658  static ExecStatus
659  post(Home home, ViewArray<P>& x, ViewArray<N>& y, Val c, Ctrl b);
660  };
661 
674  template<class Val, class P, class N>
675  class Nq : public Lin<Val,P,N,PC_INT_VAL> {
676  protected:
680 
682  Nq(Space& home, bool share, Nq& p);
683  public:
685  Nq(Home home, ViewArray<P>& x, ViewArray<N>& y, Val c);
687  virtual Actor* copy(Space& home, bool share);
689  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
691  static ExecStatus
692  post(Home home, ViewArray<P>& x, ViewArray<N>& y, Val c);
693  };
694 
707  template<class Val, class P, class N>
708  class Lq : public Lin<Val,P,N,PC_INT_BND> {
709  protected:
713 
715  Lq(Space& home, bool share, Lq& p);
716  public:
718  Lq(Home home, ViewArray<P>& x, ViewArray<N>& y, Val c);
720  virtual Actor* copy(Space& home, bool share);
722  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
724  static ExecStatus
725  post(Home home, ViewArray<P>& x, ViewArray<N>& y, Val c);
726  };
727 
740  template<class Val, class P, class N>
741  class ReLq : public ReLin<Val,P,N,PC_INT_BND,BoolView> {
742  protected:
747 
749  ReLq(Space& home, bool share, ReLq& p);
750  public:
752  ReLq(Home home, ViewArray<P>& x, ViewArray<N>& y, Val c, BoolView b);
754  virtual Actor* copy(Space& home, bool share);
756  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
758  static ExecStatus
759  post(Home home, ViewArray<P>& x, ViewArray<N>& y, Val c, BoolView b);
760  };
761 
762 }}}
763 
766 
767 namespace Gecode { namespace Int { namespace Linear {
768 
769  /*
770  * Boolean linear propagators
771  *
772  */
773 
778  template<class VX>
779  class LinBoolInt : public Propagator {
780  protected:
786  int n_as;
788  int n_hs;
790  int c;
792  void normalize(void);
794  LinBoolInt(Space& home, bool share, LinBoolInt& p);
796  LinBoolInt(Home home, ViewArray<VX>& x, int n_s, int c);
797  public:
799  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
801  virtual size_t dispose(Space& home);
802  };
803 
810  template<class VX>
811  class EqBoolInt : public LinBoolInt<VX> {
812  protected:
813  using LinBoolInt<VX>::co;
814  using LinBoolInt<VX>::x;
815  using LinBoolInt<VX>::n_as;
816  using LinBoolInt<VX>::n_hs;
817  using LinBoolInt<VX>::c;
819  EqBoolInt(Space& home, bool share, EqBoolInt& p);
821  EqBoolInt(Home home, ViewArray<VX>& x, int c);
822  public:
824  virtual Actor* copy(Space& home, bool share);
826  virtual ExecStatus advise(Space& home, Advisor& a, const Delta& d);
828  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
830  static ExecStatus post(Home home, ViewArray<VX>& x, int c);
831  };
832 
839  template<class VX>
840  class GqBoolInt : public LinBoolInt<VX> {
841  protected:
842  using LinBoolInt<VX>::co;
843  using LinBoolInt<VX>::x;
844  using LinBoolInt<VX>::n_as;
845  using LinBoolInt<VX>::n_hs;
846  using LinBoolInt<VX>::c;
848  GqBoolInt(Space& home, bool share, GqBoolInt& p);
850  GqBoolInt(Home home, ViewArray<VX>& x, int c);
851  public:
853  virtual Actor* copy(Space& home, bool share);
855  virtual ExecStatus advise(Space& home, Advisor& a, const Delta& d);
857  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
859  static ExecStatus post(Home home, ViewArray<VX>& x, int c);
860  };
861 
868  template<class VX>
869  class NqBoolInt : public BinaryPropagator<VX,PC_INT_VAL> {
870  protected:
876  int c;
878  bool resubscribe(Space& home, VX& y);
880  NqBoolInt(Home home, ViewArray<VX>& b, int c);
882  NqBoolInt(Space& home, bool share, NqBoolInt<VX>& p);
883  public:
885  virtual Actor* copy(Space& home, bool share);
887  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
889  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
891  static ExecStatus post(Home home, ViewArray<VX>& b, int c);
893  virtual size_t dispose(Space& home);
894  };
895 
896 
901  template<class VX, class VB>
902  class ReLinBoolInt : public Propagator {
903  protected:
909  int n_s;
911  int c;
913  VB b;
915  void normalize(void);
917  ReLinBoolInt(Space& home, bool share, ReLinBoolInt& p);
919  ReLinBoolInt(Home home, ViewArray<VX>& x, int c, VB b);
920  public:
922  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
924  virtual size_t dispose(Space& home);
925  };
926 
927 
931  template<class BV>
932  class BoolNegTraits {};
933 
940  template<class VX, class VB>
941  class ReGqBoolInt : public ReLinBoolInt<VX,VB> {
942  protected:
950  ReGqBoolInt(Space& home, bool share, ReGqBoolInt& p);
952  ReGqBoolInt(Home home, ViewArray<VX>& x, int c, VB b);
953  public:
955  virtual Actor* copy(Space& home, bool share);
957  virtual ExecStatus advise(Space& home, Advisor& a, const Delta& d);
959  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
961  static ExecStatus post(Home home, ViewArray<VX>& x, int c, VB b);
962  };
963 
970  template<class VX, class VB>
971  class ReEqBoolInt : public ReLinBoolInt<VX,VB> {
972  protected:
980  ReEqBoolInt(Space& home, bool share, ReEqBoolInt& p);
982  ReEqBoolInt(Home home, ViewArray<VX>& x, int c, VB b);
983  public:
985  virtual Actor* copy(Space& home, bool share);
987  virtual ExecStatus advise(Space& home, Advisor& a, const Delta& d);
989  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
991  static ExecStatus post(Home home, ViewArray<VX>& x, int c, VB b);
992  };
993 
994 }}}
995 
997 
998 namespace Gecode { namespace Int { namespace Linear {
999 
1004  template<class XV, class YV>
1005  class LinBoolView : public Propagator {
1006  protected:
1010  YV y;
1012  int c;
1014  LinBoolView(Space& home, bool share, LinBoolView& p);
1016  LinBoolView(Home home, ViewArray<XV>& x, YV y, int c);
1017  public:
1019  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
1021  virtual size_t dispose(Space& home);
1022  };
1023 
1024 
1031  template<class XV, class YV>
1032  class EqBoolView : public LinBoolView<XV,YV> {
1033  protected:
1034  using LinBoolView<XV,YV>::x;
1035  using LinBoolView<XV,YV>::y;
1036  using LinBoolView<XV,YV>::c;
1037 
1039  EqBoolView(Space& home, bool share, EqBoolView& p);
1041  EqBoolView(Home home, ViewArray<XV>& x, YV y, int c);
1042  public:
1044  virtual Actor* copy(Space& home, bool share);
1046  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
1048  static ExecStatus post(Home home, ViewArray<XV>& x, YV y, int c);
1049  };
1050 
1057  template<class XV, class YV>
1058  class NqBoolView : public LinBoolView<XV,YV> {
1059  protected:
1060  using LinBoolView<XV,YV>::x;
1061  using LinBoolView<XV,YV>::y;
1062  using LinBoolView<XV,YV>::c;
1063 
1065  NqBoolView(Space& home, bool share, NqBoolView& p);
1067  NqBoolView(Home home, ViewArray<XV>& x, YV y, int c);
1068  public:
1070  virtual Actor* copy(Space& home, bool share);
1072  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
1074  static ExecStatus post(Home home, ViewArray<XV>& x, YV y, int c);
1075  };
1076 
1083  template<class XV, class YV>
1084  class GqBoolView : public LinBoolView<XV,YV> {
1085  protected:
1086  using LinBoolView<XV,YV>::x;
1087  using LinBoolView<XV,YV>::y;
1088  using LinBoolView<XV,YV>::c;
1089 
1091  GqBoolView(Space& home, bool share, GqBoolView& p);
1093  GqBoolView(Home home, ViewArray<XV>& x, YV y, int c);
1094  public:
1096  virtual Actor* copy(Space& home, bool share);
1098  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
1100  static ExecStatus post(Home home, ViewArray<XV>& x, YV y, int c);
1101  };
1102 
1103 }}}
1104 
1106 
1107 namespace Gecode { namespace Int { namespace Linear {
1108 
1110  class ScaleBool {
1111  public:
1113  int a;
1116  };
1117 
1120  private:
1122  ScaleBool* _fst;
1124  ScaleBool* _lst;
1125  public:
1127  ScaleBoolArray(void);
1129  ScaleBoolArray(Space& home, int n);
1131  void subscribe(Space& home, Propagator& p);
1133  void cancel(Space& home, Propagator& p);
1135  void update(Space& home, bool share, ScaleBoolArray& sba);
1137  ScaleBool* fst(void) const;
1139  ScaleBool* lst(void) const;
1141  void fst(ScaleBool* f);
1143  void lst(ScaleBool* l);
1145  bool empty(void) const;
1147  int size(void) const;
1148  private:
1150  class ScaleDec {
1151  public:
1152  bool
1153  operator ()(const ScaleBool& x, const ScaleBool& y);
1154  };
1155  public:
1157  void sort(void);
1158  };
1159 
1160 
1163  public:
1165  EmptyScaleBoolArray(void);
1167  EmptyScaleBoolArray(Space& home, int n);
1169  void subscribe(Space& home, Propagator& p);
1171  void cancel(Space& home, Propagator& p);
1173  void update(Space& home, bool share, EmptyScaleBoolArray& esba);
1175  ScaleBool* fst(void) const;
1177  ScaleBool* lst(void) const;
1179  void fst(ScaleBool* f);
1181  void lst(ScaleBool* l);
1183  bool empty(void) const;
1185  int size(void) const;
1187  void sort(void);
1188  };
1189 
1190 
1195  template<class SBAP, class SBAN, class VX, PropCond pcx>
1196  class LinBoolScale : public Propagator {
1197  protected:
1199  SBAP p;
1201  SBAN n;
1203  VX x;
1205  int c;
1206  public:
1208  LinBoolScale(Home home, SBAP& p, SBAN& n, VX x, int c);
1210  LinBoolScale(Space& home, bool share, Propagator& pr,
1211  SBAP& p, SBAN& n, VX x, int c);
1213  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
1215  virtual size_t dispose(Space& home);
1216  };
1217 
1224  template<class SBAP, class SBAN, class VX>
1225  class EqBoolScale : public LinBoolScale<SBAP,SBAN,VX,PC_INT_BND> {
1226  protected:
1231  public:
1233  EqBoolScale(Home home, SBAP& p, SBAN& n, VX x, int c);
1235  EqBoolScale(Space& home, bool share, Propagator& pr,
1236  SBAP& p, SBAN& n, VX x, int c);
1238  virtual Actor* copy(Space& home, bool share);
1240  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
1242  static ExecStatus post(Home home, SBAP& p, SBAN& n, VX x, int c);
1243  };
1244 
1251  template<class SBAP, class SBAN, class VX>
1252  class LqBoolScale : public LinBoolScale<SBAP,SBAN,VX,PC_INT_BND> {
1253  protected:
1258  public:
1260  LqBoolScale(Home home, SBAP& p, SBAN& n, VX x, int c);
1262  LqBoolScale(Space& home, bool share, Propagator& pr,
1263  SBAP& p, SBAN& n, VX x, int c);
1265  virtual Actor* copy(Space& home, bool share);
1267  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
1269  static ExecStatus post(Home home, SBAP& p, SBAN& n, VX x, int c);
1270  };
1271 
1278  template<class SBAP, class SBAN, class VX>
1279  class NqBoolScale : public LinBoolScale<SBAP,SBAN,VX,PC_INT_VAL> {
1280  protected:
1285  public:
1287  NqBoolScale(Home home, SBAP& p, SBAN& n, VX x, int c);
1289  NqBoolScale(Space& home, bool share, Propagator& pr,
1290  SBAP& p, SBAN& n, VX x, int c);
1292  virtual Actor* copy(Space& home, bool share);
1294  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
1296  static ExecStatus post(Home home, SBAP& p, SBAN& n, VX x, int c);
1297  };
1298 
1299 }}}
1300 
1302 
1303 namespace Gecode { namespace Int { namespace Linear {
1304 
1309  template<class View>
1310  class Term {
1311  public:
1313  int a;
1315  View x;
1316  };
1317 
1332  template<class View>
1333  void estimate(Term<View>* t, int n, int c,
1334  int& l, int& u);
1335 
1357  template<class View>
1358  bool normalize(Term<View>* t, int &n,
1359  Term<View>* &t_p, int &n_p,
1360  Term<View>* &t_n, int &n_n);
1361 
1362 
1390  GECODE_INT_EXPORT void
1391  post(Home home, Term<IntView>* t, int n, IntRelType r, int c,
1393 
1423  GECODE_INT_EXPORT void
1424  post(Home home, Term<IntView>* t, int n, IntRelType r, int c, BoolView b,
1426 
1454  GECODE_INT_EXPORT void
1455  post(Home home, Term<BoolView>* t, int n, IntRelType r, int c,
1457 
1486  GECODE_INT_EXPORT void
1487  post(Home home, Term<BoolView>* t, int n, IntRelType r, int c, BoolView b,
1489 
1518  GECODE_INT_EXPORT void
1519  post(Home home, Term<BoolView>* t, int n, IntRelType r, IntView y, int c=0,
1521 
1550  GECODE_INT_EXPORT void
1551  post(Home home, Term<BoolView>* t, int n, IntRelType r, IntView y,
1553 
1554 }}}
1555 
1556 #include <gecode/int/linear/post.hpp>
1557 
1558 #endif
1559 
1560 // STATISTICS: int-prop