00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #ifndef __GECODE_FLOAT_LINEAR_HH__
00043 #define __GECODE_FLOAT_LINEAR_HH__
00044
00045 #include <gecode/int.hh>
00046 #include <gecode/float.hh>
00047
00053 namespace Gecode { namespace Float { namespace Linear {
00054
00060 template<class P, class N, PropCond pc>
00061 class Lin : public Propagator {
00062 protected:
00064 ViewArray<P> x;
00066 ViewArray<N> y;
00068 FloatVal c;
00069
00071 Lin(Space& home, bool share, Lin<P,N,pc>& p);
00073 Lin(Home home, ViewArray<P>& x, ViewArray<N>& y, FloatVal c);
00074 public:
00076 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00078 virtual size_t dispose(Space& home);
00079 };
00080
00086 template<class View>
00087 void bounds_p(ModEventDelta med, ViewArray<View>& x,
00088 FloatVal& c, FloatNum& sl, FloatNum& su);
00089
00095 template<class View>
00096 void bounds_n(ModEventDelta med, ViewArray<View>& y,
00097 FloatVal& c, FloatNum& sl, FloatNum& su);
00098
00107 template<class P, class N>
00108 class Eq : public Lin<P,N,PC_FLOAT_BND> {
00109 protected:
00110 using Lin<P,N,PC_FLOAT_BND>::x;
00111 using Lin<P,N,PC_FLOAT_BND>::y;
00112 using Lin<P,N,PC_FLOAT_BND>::c;
00113
00115 Eq(Space& home, bool share, Eq& p);
00116 public:
00118 Eq(Home home, ViewArray<P>& x, ViewArray<N>& y, FloatVal c);
00120 virtual Actor* copy(Space& home, bool share);
00122 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00124 static ExecStatus
00125 post(Home home, ViewArray<P>& x, ViewArray<N>& y, FloatVal c);
00126 };
00127
00128
00137 template<class P, class N>
00138 class Lq : public Lin<P,N,PC_FLOAT_BND> {
00139 protected:
00140 using Lin<P,N,PC_FLOAT_BND>::x;
00141 using Lin<P,N,PC_FLOAT_BND>::y;
00142 using Lin<P,N,PC_FLOAT_BND>::c;
00143
00145 Lq(Space& home, bool share, Lq& p);
00146 public:
00148 Lq(Home home, ViewArray<P>& x, ViewArray<N>& y, FloatVal c);
00150 virtual Actor* copy(Space& home, bool share);
00152 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00154 static ExecStatus
00155 post(Home home, ViewArray<P>& x, ViewArray<N>& y, FloatVal c);
00156 };
00157
00158 }}}
00159
00160 #include <gecode/float/linear/nary.hpp>
00161
00162 namespace Gecode { namespace Float { namespace Linear {
00163
00168 class Term {
00169 public:
00171 FloatVal a;
00173 FloatView x;
00174 };
00175
00190 GECODE_FLOAT_EXPORT void
00191 estimate(Term* t, int n, FloatVal c, FloatNum& l, FloatNum& u);
00192
00209 GECODE_FLOAT_EXPORT void
00210 post(Home home, Term* t, int n, FloatRelType frt, FloatVal c);
00211
00229 GECODE_FLOAT_EXPORT void
00230 post(Home home, Term* t, int n, FloatRelType frt, FloatVal c, Reify r);
00231
00232 }}}
00233
00234 #endif
00235
00236