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 void reschedule(Space& home);
00080 virtual size_t dispose(Space& home);
00081 };
00082
00088 template<class View>
00089 void bounds_p(ModEventDelta med, ViewArray<View>& x,
00090 FloatVal& c, FloatNum& sl, FloatNum& su);
00091
00097 template<class View>
00098 void bounds_n(ModEventDelta med, ViewArray<View>& y,
00099 FloatVal& c, FloatNum& sl, FloatNum& su);
00100
00109 template<class P, class N>
00110 class Eq : public Lin<P,N,PC_FLOAT_BND> {
00111 protected:
00112 using Lin<P,N,PC_FLOAT_BND>::x;
00113 using Lin<P,N,PC_FLOAT_BND>::y;
00114 using Lin<P,N,PC_FLOAT_BND>::c;
00115
00117 Eq(Space& home, bool share, Eq& p);
00118 public:
00120 Eq(Home home, ViewArray<P>& x, ViewArray<N>& y, FloatVal c);
00122 virtual Actor* copy(Space& home, bool share);
00124 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00126 static ExecStatus
00127 post(Home home, ViewArray<P>& x, ViewArray<N>& y, FloatVal c);
00128 };
00129
00130
00139 template<class P, class N>
00140 class Lq : public Lin<P,N,PC_FLOAT_BND> {
00141 protected:
00142 using Lin<P,N,PC_FLOAT_BND>::x;
00143 using Lin<P,N,PC_FLOAT_BND>::y;
00144 using Lin<P,N,PC_FLOAT_BND>::c;
00145
00147 Lq(Space& home, bool share, Lq& p);
00148 public:
00150 Lq(Home home, ViewArray<P>& x, ViewArray<N>& y, FloatVal c);
00152 virtual Actor* copy(Space& home, bool share);
00154 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00156 static ExecStatus
00157 post(Home home, ViewArray<P>& x, ViewArray<N>& y, FloatVal c);
00158 };
00159
00160 }}}
00161
00162 #include <gecode/float/linear/nary.hpp>
00163
00164 namespace Gecode { namespace Float { namespace Linear {
00165
00170 class Term {
00171 public:
00173 FloatVal a;
00175 FloatView x;
00176 };
00177
00192 GECODE_FLOAT_EXPORT void
00193 estimate(Term* t, int n, FloatVal c, FloatNum& l, FloatNum& u);
00194
00211 GECODE_FLOAT_EXPORT void
00212 post(Home home, Term* t, int n, FloatRelType frt, FloatVal c);
00213
00231 GECODE_FLOAT_EXPORT void
00232 post(Home home, Term* t, int n, FloatRelType frt, FloatVal c, Reify r);
00233
00234 }}}
00235
00236 #endif
00237
00238