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_HH__
00043 #define __GECODE_FLOAT_HH__
00044
00045 #include <climits>
00046 #include <cfloat>
00047 #include <iostream>
00048
00049 #include <gecode/kernel.hh>
00050 #include <gecode/int.hh>
00051
00052
00053
00054
00055
00056 #if !defined(GECODE_STATIC_LIBS) && \
00057 (defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER))
00058
00059 #ifdef GECODE_BUILD_FLOAT
00060 #define GECODE_FLOAT_EXPORT __declspec( dllexport )
00061 #else
00062 #define GECODE_FLOAT_EXPORT __declspec( dllimport )
00063 #endif
00064
00065 #else
00066
00067 #ifdef GECODE_GCC_HAS_CLASS_VISIBILITY
00068 #define GECODE_FLOAT_EXPORT __attribute__ ((visibility("default")))
00069 #else
00070 #define GECODE_FLOAT_EXPORT
00071 #endif
00072
00073 #endif
00074
00075
00076 #ifndef GECODE_BUILD_FLOAT
00077 #define GECODE_LIBRARY_NAME "Float"
00078 #include <gecode/support/auto-link.hpp>
00079 #endif
00080
00081
00082 #include <gecode/third-party/boost/numeric/interval.hpp>
00083
00095 #include <gecode/float/exception.hpp>
00096
00097 #include <gecode/float/nextafter.hpp>
00098
00099 namespace Gecode {
00100
00108 typedef double FloatNum;
00109
00111 FloatNum pi_half_lower(void);
00113 FloatNum pi_half_upper(void);
00115 FloatNum pi_lower(void);
00117 FloatNum pi_upper(void);
00119 FloatNum pi_twice_lower(void);
00121 FloatNum pi_twice_upper(void);
00122
00123
00124 class FloatVal;
00125
00126 }
00127
00128 #include <gecode/float/num.hpp>
00129
00130 namespace Gecode { namespace Float {
00131
00137 class Rounding :
00138 public gecode_boost::numeric::interval_lib::rounded_arith_opp<FloatNum> {
00139 protected:
00141 typedef gecode_boost::numeric::interval_lib::rounded_arith_opp<FloatNum> Base;
00142 public:
00144
00145
00146 Rounding(void);
00148 ~Rounding(void);
00150
00152
00153
00154 FloatNum add_down(FloatNum x, FloatNum y);
00156 FloatNum add_up (FloatNum x, FloatNum y);
00158 FloatNum sub_down(FloatNum x, FloatNum y);
00160 FloatNum sub_up (FloatNum x, FloatNum y);
00162 FloatNum mul_down(FloatNum x, FloatNum y);
00164 FloatNum mul_up (FloatNum x, FloatNum y);
00166 FloatNum div_down(FloatNum x, FloatNum y);
00168 FloatNum div_up (FloatNum x, FloatNum y);
00170 FloatNum sqrt_down(FloatNum x);
00172 FloatNum sqrt_up (FloatNum x);
00174
00176
00177
00178 FloatNum median(FloatNum x, FloatNum y);
00180 FloatNum int_down(FloatNum x);
00182 FloatNum int_up (FloatNum x);
00184
00185 #ifdef GECODE_HAS_MPFR
00186
00187
00188
00189 GECODE_FLOAT_EXPORT FloatNum exp_down(FloatNum x);
00191 GECODE_FLOAT_EXPORT FloatNum exp_up (FloatNum x);
00193 GECODE_FLOAT_EXPORT FloatNum log_down(FloatNum x);
00195 GECODE_FLOAT_EXPORT FloatNum log_up (FloatNum x);
00197
00199
00200
00201 GECODE_FLOAT_EXPORT FloatNum sin_down(FloatNum x);
00203 GECODE_FLOAT_EXPORT FloatNum sin_up (FloatNum x);
00205 GECODE_FLOAT_EXPORT FloatNum cos_down(FloatNum x);
00207 GECODE_FLOAT_EXPORT FloatNum cos_up (FloatNum x);
00209 GECODE_FLOAT_EXPORT FloatNum tan_down(FloatNum x);
00211 GECODE_FLOAT_EXPORT FloatNum tan_up (FloatNum x);
00213
00215
00216
00217 GECODE_FLOAT_EXPORT FloatNum asin_down(FloatNum x);
00219 GECODE_FLOAT_EXPORT FloatNum asin_up (FloatNum x);
00221 GECODE_FLOAT_EXPORT FloatNum acos_down(FloatNum x);
00223 GECODE_FLOAT_EXPORT FloatNum acos_up (FloatNum x);
00225 GECODE_FLOAT_EXPORT FloatNum atan_down(FloatNum x);
00227 GECODE_FLOAT_EXPORT FloatNum atan_up (FloatNum x);
00229
00231
00232
00233 GECODE_FLOAT_EXPORT FloatNum sinh_down(FloatNum x);
00235 GECODE_FLOAT_EXPORT FloatNum sinh_up (FloatNum x);
00237 GECODE_FLOAT_EXPORT FloatNum cosh_down(FloatNum x);
00239 GECODE_FLOAT_EXPORT FloatNum cosh_up (FloatNum x);
00241 GECODE_FLOAT_EXPORT FloatNum tanh_down(FloatNum x);
00243 GECODE_FLOAT_EXPORT FloatNum tanh_up (FloatNum x);
00245
00247
00248
00249 GECODE_FLOAT_EXPORT FloatNum asinh_down(FloatNum x);
00251 GECODE_FLOAT_EXPORT FloatNum asinh_up (FloatNum x);
00253 GECODE_FLOAT_EXPORT FloatNum acosh_down(FloatNum x);
00255 GECODE_FLOAT_EXPORT FloatNum acosh_up (FloatNum x);
00257 GECODE_FLOAT_EXPORT FloatNum atanh_down(FloatNum x);
00259 GECODE_FLOAT_EXPORT FloatNum atanh_up (FloatNum x);
00261 #endif
00262 };
00263
00264 }}
00265
00266 #include <gecode/float/rounding.hpp>
00267
00268 namespace Gecode { namespace Float {
00269
00274 bool subset(const FloatVal& x, const FloatVal& y);
00279 bool proper_subset(const FloatVal& x, const FloatVal& y);
00284 bool overlap(const FloatVal& x, const FloatVal& y);
00285
00290 FloatVal intersect(const FloatVal& x, const FloatVal& y);
00295 FloatVal hull(const FloatVal& x, const FloatVal& y);
00300 FloatVal hull(const FloatVal& x, const FloatNum& y);
00305 FloatVal hull(const FloatNum& x, const FloatVal& y);
00310 FloatVal hull(const FloatNum& x, const FloatNum& y);
00311
00312 }}
00313
00314 namespace Gecode {
00315
00321 class FloatVal {
00322 friend FloatVal operator +(const FloatVal& x);
00323 friend FloatVal operator -(const FloatVal& x);
00324 friend FloatVal operator +(const FloatVal& x, const FloatVal& y);
00325 friend FloatVal operator +(const FloatVal& x, const FloatNum& y);
00326 friend FloatVal operator +(const FloatNum& x, const FloatVal& y);
00327 friend FloatVal operator -(const FloatVal& x, const FloatVal& y);
00328 friend FloatVal operator -(const FloatVal& x, const FloatNum& y);
00329 friend FloatVal operator -(const FloatNum& x, const FloatVal& y);
00330 friend FloatVal operator *(const FloatVal& x, const FloatVal& y);
00331 friend FloatVal operator *(const FloatVal& x, const FloatNum& y);
00332 friend FloatVal operator *(const FloatNum& x, const FloatVal& y);
00333 friend FloatVal operator /(const FloatVal& x, const FloatVal& y);
00334 friend FloatVal operator /(const FloatVal& x, const FloatNum& y);
00335 friend FloatVal operator /(const FloatNum& x, const FloatVal& y);
00336
00337 friend bool operator <(const FloatVal& x, const FloatVal& y);
00338 friend bool operator <(const FloatVal& x, const FloatNum& y);
00339 friend bool operator <(const FloatNum& x, const FloatVal& y);
00340 friend bool operator <=(const FloatVal& x, const FloatVal& y);
00341 friend bool operator <=(const FloatVal& x, const FloatNum& y);
00342 friend bool operator <=(const FloatNum& x, const FloatVal& y);
00343 friend bool operator >(const FloatVal& x, const FloatVal& y);
00344 friend bool operator >(const FloatVal& x, const FloatNum& y);
00345 friend bool operator >(const FloatNum& x, const FloatVal& y);
00346 friend bool operator >=(const FloatVal& x, const FloatVal& y);
00347 friend bool operator >=(const FloatVal& x, const FloatNum& y);
00348 friend bool operator >=(const FloatNum& x, const FloatVal& y);
00349 friend bool operator ==(const FloatVal& x, const FloatVal& y);
00350 friend bool operator ==(const FloatVal& x, const FloatNum& y);
00351 friend bool operator ==(const FloatNum& x, const FloatVal& y);
00352 friend bool operator !=(const FloatVal& x, const FloatVal& y);
00353 friend bool operator !=(const FloatVal& x, const FloatNum& y);
00354 friend bool operator !=(const FloatNum& x, const FloatVal& y);
00355
00356 template<class Char, class Traits>
00357 friend std::basic_ostream<Char,Traits>&
00358 operator <<(std::basic_ostream<Char,Traits>& os, const FloatVal& x);
00359
00360 friend FloatVal abs(const FloatVal& x);
00361 friend FloatVal sqrt(const FloatVal& x);
00362 friend FloatVal sqr(const FloatVal& x);
00363 friend FloatVal pow(const FloatVal& x, int n);
00364 friend FloatVal nroot(const FloatVal& x, int n);
00365
00366 friend FloatVal max(const FloatVal& x, const FloatVal& y);
00367 friend FloatVal max(const FloatVal& x, const FloatNum& y);
00368 friend FloatVal max(const FloatNum& x, const FloatVal& y);
00369 friend FloatVal min(const FloatVal& x, const FloatVal& y);
00370 friend FloatVal min(const FloatVal& x, const FloatNum& y);
00371 friend FloatVal min(const FloatNum& x, const FloatVal& y);
00372
00373 #ifdef GECODE_HAS_MPFR
00374 friend FloatVal exp(const FloatVal& x);
00375 friend FloatVal log(const FloatVal& x);
00376 friend FloatVal fmod(const FloatVal& x, const FloatVal& y);
00377 friend FloatVal fmod(const FloatVal& x, const FloatNum& y);
00378 friend FloatVal fmod(const FloatNum& x, const FloatVal& y);
00379 friend FloatVal sin(const FloatVal& x);
00380 friend FloatVal cos(const FloatVal& x);
00381 friend FloatVal tan(const FloatVal& x);
00382 friend FloatVal asin(const FloatVal& x);
00383 friend FloatVal acos(const FloatVal& x);
00384 friend FloatVal atan(const FloatVal& x);
00385 friend FloatVal sinh(const FloatVal& x);
00386 friend FloatVal cosh(const FloatVal& x);
00387 friend FloatVal tanh(const FloatVal& x);
00388 friend FloatVal asinh(const FloatVal& x);
00389 friend FloatVal acosh(const FloatVal& x);
00390 friend FloatVal atanh(const FloatVal& x);
00391 #endif
00392
00393 friend bool Float::subset(const FloatVal& x, const FloatVal& y);
00394 friend bool Float::proper_subset(const FloatVal& x, const FloatVal& y);
00395 friend bool Float::overlap(const FloatVal& x, const FloatVal& y);
00396 friend FloatVal Float::intersect(const FloatVal& x, const FloatVal& y);
00397 friend FloatVal Float::hull(const FloatVal& x, const FloatVal& y);
00398 friend FloatVal Float::hull(const FloatVal& x, const FloatNum& y);
00399 friend FloatVal Float::hull(const FloatNum& x, const FloatVal& y);
00400 friend FloatVal Float::hull(const FloatNum& x, const FloatNum& y);
00401 protected:
00403 typedef gecode_boost::numeric::interval_lib::save_state<Float::Rounding> R;
00405 typedef gecode_boost::numeric::interval_lib::checking_strict<FloatNum> P;
00407 typedef gecode_boost::numeric::interval
00408 <FloatNum,
00409 gecode_boost::numeric::interval_lib::policies<R, P> >
00410 FloatValImpType;
00412 FloatValImpType x;
00414 explicit FloatVal(const FloatValImpType& i);
00415 public:
00417
00418
00419 FloatVal(void);
00421 FloatVal(const FloatNum& n);
00423 FloatVal(const FloatNum& l, const FloatNum& u);
00425 FloatVal(const FloatVal& v);
00426
00428 FloatVal& operator =(const FloatNum& n);
00430 FloatVal& operator =(const FloatVal& v);
00431
00433 void assign(FloatNum const &l, FloatNum const &u);
00435
00437
00438
00439 FloatNum min(void) const;
00441 FloatNum max(void) const;
00443 FloatNum size(void) const;
00445 FloatNum med(void) const;
00447
00449
00450
00451 bool tight(void) const;
00453 bool singleton(void) const;
00455 bool in(FloatNum n) const;
00457 bool zero_in(void) const;
00459
00461
00462
00463 static FloatVal hull(FloatNum x, FloatNum y);
00465 static FloatVal pi_half(void);
00467 static FloatVal pi(void);
00469 static FloatVal pi_twice(void);
00471
00473
00474
00475 FloatVal& operator +=(const FloatNum& n);
00477 FloatVal& operator -=(const FloatNum& n);
00479 FloatVal& operator *=(const FloatNum& n);
00481 FloatVal& operator /=(const FloatNum& n);
00483 FloatVal& operator +=(const FloatVal& v);
00485 FloatVal& operator -=(const FloatVal& v);
00487 FloatVal& operator *=(const FloatVal& v);
00489 FloatVal& operator /=(const FloatVal& v);
00491 };
00492
00497 FloatVal operator +(const FloatVal& x);
00502 FloatVal operator -(const FloatVal& x);
00503
00508 FloatVal operator +(const FloatVal& x, const FloatVal& y);
00513 FloatVal operator +(const FloatVal& x, const FloatNum& y);
00518 FloatVal operator +(const FloatNum& x, const FloatVal& y);
00523 FloatVal operator -(const FloatVal& x, const FloatVal& y);
00528 FloatVal operator -(const FloatVal& x, const FloatNum& y);
00533 FloatVal operator -(const FloatNum& x, const FloatVal& y);
00538 FloatVal operator *(const FloatVal& x, const FloatVal& y);
00543 FloatVal operator *(const FloatVal& x, const FloatNum& y);
00548 FloatVal operator *(const FloatNum& x, const FloatVal& y);
00553 FloatVal operator /(const FloatVal& x, const FloatVal& y);
00558 FloatVal operator /(const FloatVal& x, const FloatNum& y);
00563 FloatVal operator /(const FloatNum& r, const FloatVal& x);
00564
00569 bool operator <(const FloatVal& x, const FloatVal& y);
00574 bool operator <(const FloatVal& x, const FloatNum& y);
00579 bool operator <(const FloatNum& x, const FloatVal& y);
00580
00585 bool operator <=(const FloatVal& x, const FloatVal& y);
00590 bool operator <=(const FloatVal& x, const FloatNum& y);
00595 bool operator <=(const FloatNum& x, const FloatVal& y);
00596
00601 bool operator >(const FloatVal& x, const FloatVal& y);
00606 bool operator >(const FloatVal& x, const FloatNum& y);
00611 bool operator >(const FloatNum& x, const FloatVal& y);
00612
00617 bool operator >=(const FloatVal& x, const FloatVal& y);
00622 bool operator >=(const FloatVal& x, const FloatNum& y);
00627 bool operator >=(const FloatNum& x, const FloatVal& y);
00632 bool operator ==(const FloatVal& x, const FloatVal& y);
00637 bool operator ==(const FloatVal& x, const FloatNum& y);
00642 bool operator ==(const FloatNum& x, const FloatVal& y);
00643
00648 bool operator !=(const FloatVal& x, const FloatVal& y);
00653 bool operator !=(const FloatVal& x, const FloatNum& y);
00658 bool operator !=(const FloatNum& x, const FloatVal& y);
00659
00664 template<class Char, class Traits>
00665 std::basic_ostream<Char,Traits>&
00666 operator <<(std::basic_ostream<Char,Traits>& os, const FloatVal& x);
00667
00672 FloatVal abs(const FloatVal& x);
00677 FloatVal sqrt(const FloatVal& x);
00682 FloatVal sqr(const FloatVal& x);
00687 FloatVal pow(const FloatVal& x, int n);
00692 FloatVal nroot(const FloatVal& x, int n);
00693
00698 FloatVal max(const FloatVal& x, const FloatVal& y);
00703 FloatVal max(const FloatVal& x, const FloatNum& y);
00708 FloatVal max(const FloatNum& x, const FloatVal& y);
00713 FloatVal min(const FloatVal& x, const FloatVal& y);
00718 FloatVal min(const FloatVal& x, const FloatNum& y);
00723 FloatVal min(const FloatNum& x, const FloatVal& y);
00724
00725 #ifdef GECODE_HAS_MPFR
00726
00731 FloatVal exp(const FloatVal& x);
00736 FloatVal log(const FloatVal& x);
00737
00742 FloatVal fmod(const FloatVal& x, const FloatVal& y);
00747 FloatVal fmod(const FloatVal& x, const FloatNum& y);
00752 FloatVal fmod(const FloatNum& x, const FloatVal& y);
00753
00758 FloatVal sin(const FloatVal& x);
00763 FloatVal cos(const FloatVal& x);
00768 FloatVal tan(const FloatVal& x);
00773 FloatVal asin(const FloatVal& x);
00778 FloatVal acos(const FloatVal& x);
00783 FloatVal atan(const FloatVal& x);
00784
00789 FloatVal sinh(const FloatVal& x);
00794 FloatVal cosh(const FloatVal& x);
00799 FloatVal tanh(const FloatVal& x);
00804 FloatVal asinh(const FloatVal& x);
00809 FloatVal acosh(const FloatVal& x);
00814 FloatVal atanh(const FloatVal& x);
00815
00816 #endif
00817
00818 }
00819
00820 #include <gecode/float/val.hpp>
00821
00822 namespace Gecode { namespace Float {
00823
00829 namespace Limits {
00831 const FloatNum max = std::numeric_limits<FloatNum>::max();
00833 const FloatNum min = -max;
00835 bool valid(const FloatVal& n);
00837 void check(const FloatVal& n, const char* l);
00838 }
00839
00840 }}
00841
00842 #include <gecode/float/limits.hpp>
00843
00844 #include <gecode/float/var-imp.hpp>
00845
00846 namespace Gecode {
00847
00848 namespace Float {
00849 class FloatView;
00850 }
00851
00857 class FloatVar : public VarImpVar<Float::FloatVarImp> {
00858 friend class FloatVarArray;
00859 friend class FloatVarArgs;
00860 private:
00861 using VarImpVar<Float::FloatVarImp>::x;
00868 void _init(Space& home, FloatNum min, FloatNum max);
00869 public:
00871
00872
00873 FloatVar(void);
00875 FloatVar(const FloatVar& y);
00877 FloatVar(const Float::FloatView& y);
00889 GECODE_FLOAT_EXPORT FloatVar(Space& home, FloatNum min, FloatNum max);
00891
00893
00894
00895 FloatVal domain(void) const;
00897 FloatNum min(void) const;
00899 FloatNum max(void) const;
00901 FloatNum med(void) const;
00903 FloatNum size(void) const;
00911 FloatVal val(void) const;
00912
00914
00916
00917
00918 bool in(const FloatVal& n) const;
00920 };
00921
00926 template<class Char, class Traits>
00927 std::basic_ostream<Char,Traits>&
00928 operator <<(std::basic_ostream<Char,Traits>& os, const FloatVar& x);
00929 }
00930
00931 #include <gecode/float/view.hpp>
00932 #include <gecode/float/array-traits.hpp>
00933
00934 namespace Gecode {
00935
00937 class FloatValArgs : public PrimArgArray<FloatVal> {
00938 public:
00940
00941
00942 FloatValArgs(void);
00944 explicit FloatValArgs(int n);
00946 FloatValArgs(const SharedArray<FloatVal>& x);
00948 FloatValArgs(const std::vector<FloatVal>& x);
00950 template<class InputIterator>
00951 FloatValArgs(InputIterator first, InputIterator last);
00953 GECODE_FLOAT_EXPORT
00954 FloatValArgs(int n, int e0, ...);
00956 FloatValArgs(int n, const FloatVal* e);
00958 FloatValArgs(const PrimArgArray<FloatVal>& a);
00959
00961 static FloatValArgs create(int n, FloatVal start, int inc=1);
00963 };
00964
00966 class FloatVarArgs : public VarArgArray<FloatVar> {
00967 public:
00969
00970
00971 FloatVarArgs(void) {}
00973 explicit FloatVarArgs(int n) : VarArgArray<FloatVar>(n) {}
00975 FloatVarArgs(const FloatVarArgs& a) : VarArgArray<FloatVar>(a) {}
00977 FloatVarArgs(const VarArray<FloatVar>& a) : VarArgArray<FloatVar>(a) {}
00979 FloatVarArgs(const std::vector<FloatVar>& a) : VarArgArray<FloatVar>(a) {}
00981 template<class InputIterator>
00982 FloatVarArgs(InputIterator first, InputIterator last)
00983 : VarArgArray<FloatVar>(first,last) {}
00995 GECODE_FLOAT_EXPORT
00996 FloatVarArgs(Space& home, int n, FloatNum min, FloatNum max);
00998 };
01000
01016 class FloatVarArray : public VarArray<FloatVar> {
01017 public:
01019
01020
01021 FloatVarArray(void);
01023 FloatVarArray(Space& home, int n);
01025 FloatVarArray(const FloatVarArray& a);
01027 FloatVarArray(Space& home, const FloatVarArgs& a);
01039 GECODE_FLOAT_EXPORT
01040 FloatVarArray(Space& home, int n, FloatNum min, FloatNum max);
01042 };
01043
01044 }
01045
01046 #include <gecode/float/array.hpp>
01047
01048 namespace Gecode {
01049
01054 enum FloatRelType {
01055 FRT_EQ,
01056 FRT_NQ,
01057 FRT_LQ,
01058 FRT_LE,
01059 FRT_GQ,
01060 FRT_GR
01061 };
01062
01070
01071 GECODE_FLOAT_EXPORT void
01072 dom(Home home, FloatVar x, FloatVal n);
01074 GECODE_FLOAT_EXPORT void
01075 dom(Home home, const FloatVarArgs& x, FloatVal n);
01077 GECODE_FLOAT_EXPORT void
01078 dom(Home home, FloatVar x, FloatNum l, FloatNum m);
01080 GECODE_FLOAT_EXPORT void
01081 dom(Home home, const FloatVarArgs& x, FloatNum l, FloatNum u);
01083 GECODE_FLOAT_EXPORT void
01084 dom(Home home, FloatVar x, FloatVal n, Reify r);
01086 GECODE_FLOAT_EXPORT void
01087 dom(Home home, FloatVar x, FloatNum l, FloatNum u, Reify r);
01089 GECODE_FLOAT_EXPORT void
01090 dom(Home home, FloatVar x, FloatVar d);
01092 GECODE_FLOAT_EXPORT void
01093 dom(Home home, const FloatVarArgs& x, const FloatVarArgs& d);
01095
01104 GECODE_FLOAT_EXPORT void
01105 rel(Home home, FloatVar x0, FloatRelType frt, FloatVar x1);
01109 GECODE_FLOAT_EXPORT void
01110 rel(Home home, FloatVar x, FloatRelType frt, FloatVal c);
01114 GECODE_FLOAT_EXPORT void
01115 rel(Home home, FloatVar x, FloatRelType frt, FloatVal c, Reify r);
01119 GECODE_FLOAT_EXPORT void
01120 rel(Home home, FloatVar x0, FloatRelType frt, FloatVar x1, Reify r);
01124 GECODE_FLOAT_EXPORT void
01125 rel(Home home, const FloatVarArgs& x, FloatRelType frt, FloatVal c);
01129 GECODE_FLOAT_EXPORT void
01130 rel(Home home, const FloatVarArgs& x, FloatRelType frt, FloatVar y);
01131
01132 }
01133
01134
01135 namespace Gecode {
01136
01145 GECODE_FLOAT_EXPORT void
01146 min(Home home, FloatVar x0, FloatVar x1, FloatVar x2);
01150 GECODE_FLOAT_EXPORT void
01151 min(Home home, const FloatVarArgs& x, FloatVar y);
01154 GECODE_FLOAT_EXPORT void
01155 max(Home home, FloatVar x0, FloatVar x1, FloatVar x2);
01159 GECODE_FLOAT_EXPORT void
01160 max(Home home, const FloatVarArgs& x, FloatVar y);
01161
01164 GECODE_FLOAT_EXPORT void
01165 abs(Home home, FloatVar x0, FloatVar x1);
01166
01169 GECODE_FLOAT_EXPORT void
01170 mult(Home home, FloatVar x0, FloatVar x1, FloatVar x2);
01171
01174 GECODE_FLOAT_EXPORT void
01175 sqr(Home home, FloatVar x0, FloatVar x1);
01176
01179 GECODE_FLOAT_EXPORT void
01180 sqrt(Home home, FloatVar x0, FloatVar x1);
01181
01184 GECODE_FLOAT_EXPORT void
01185 pow(Home home, FloatVar x0, int n, FloatVar x1);
01186
01189 GECODE_FLOAT_EXPORT void
01190 nroot(Home home, FloatVar x0, int n, FloatVar x1);
01191
01194 GECODE_FLOAT_EXPORT void
01195 div(Home home, FloatVar x0, FloatVar x1, FloatVar x2);
01196 #ifdef GECODE_HAS_MPFR
01197
01199 GECODE_FLOAT_EXPORT void
01200 exp(Home home, FloatVar x0, FloatVar x1);
01203 GECODE_FLOAT_EXPORT void
01204 log(Home home, FloatVar x0, FloatVar x1);
01207 GECODE_FLOAT_EXPORT void
01208 pow(Home home, FloatNum base, FloatVar x0, FloatVar x1);
01211 GECODE_FLOAT_EXPORT void
01212 log(Home home, FloatNum base, FloatVar x0, FloatVar x1);
01215 GECODE_FLOAT_EXPORT void
01216 asin(Home home, FloatVar x0, FloatVar x1);
01219 GECODE_FLOAT_EXPORT void
01220 sin(Home home, FloatVar x0, FloatVar x1);
01223 GECODE_FLOAT_EXPORT void
01224 acos(Home home, FloatVar x0, FloatVar x1);
01227 GECODE_FLOAT_EXPORT void
01228 cos(Home home, FloatVar x0, FloatVar x1);
01231 GECODE_FLOAT_EXPORT void
01232 atan(Home home, FloatVar x0, FloatVar x1);
01235 GECODE_FLOAT_EXPORT void
01236 tan(Home home, FloatVar x0, FloatVar x1);
01238 #endif
01239
01247 GECODE_FLOAT_EXPORT void
01248 linear(Home home, const FloatVarArgs& x,
01249 FloatRelType frt, FloatNum c);
01253 GECODE_FLOAT_EXPORT void
01254 linear(Home home, const FloatVarArgs& x,
01255 FloatRelType frt, FloatVar y);
01259 GECODE_FLOAT_EXPORT void
01260 linear(Home home, const FloatVarArgs& x,
01261 FloatRelType frt, FloatNum c, Reify r);
01265 GECODE_FLOAT_EXPORT void
01266 linear(Home home, const FloatVarArgs& x,
01267 FloatRelType frt, FloatVar y, Reify r);
01274 GECODE_FLOAT_EXPORT void
01275 linear(Home home, const FloatValArgs& a, const FloatVarArgs& x,
01276 FloatRelType frt, FloatNum c);
01283 GECODE_FLOAT_EXPORT void
01284 linear(Home home, const FloatValArgs& a, const FloatVarArgs& x,
01285 FloatRelType frt, FloatVar y);
01292 GECODE_FLOAT_EXPORT void
01293 linear(Home home, const FloatValArgs& a, const FloatVarArgs& x,
01294 FloatRelType frt, FloatNum c, Reify r);
01301 GECODE_FLOAT_EXPORT void
01302 linear(Home home, const FloatValArgs& a, const FloatVarArgs& x,
01303 FloatRelType frt, FloatVar y, Reify r);
01304
01305
01311
01312 GECODE_FLOAT_EXPORT void
01313 channel(Home home, FloatVar x0, IntVar x1);
01315 GECODE_FLOAT_EXPORT void
01316 channel(Home home, IntVar x0, FloatVar x1);
01318
01319
01328
01329 GECODE_FLOAT_EXPORT void
01330 wait(Home home, FloatVar x, void (*c)(Space& home));
01332 GECODE_FLOAT_EXPORT void
01333 wait(Home home, const FloatVarArgs& x, void (*c)(Space& home));
01335
01336 }
01337
01338 namespace Gecode {
01339
01353 typedef bool (*FloatBranchFilter)(const Space& home, FloatVar x, int i);
01354
01365 typedef double (*FloatBranchMerit)(const Space& home, FloatVar x, int i);
01366
01372 class FloatNumBranch {
01373 public:
01375 FloatNum n;
01377 bool l;
01378 };
01379
01390 typedef FloatNumBranch (*FloatBranchVal)(const Space& home, FloatVar x, int i);
01391
01403 typedef void (*FloatBranchCommit)(Space& home, unsigned int a,
01404 FloatVar x, int i, FloatNumBranch nl);
01405
01406 }
01407
01408 #include <gecode/float/branch/traits.hpp>
01409
01410 namespace Gecode {
01411
01417 class FloatAFC : public AFC {
01418 public:
01426 FloatAFC(void);
01428 FloatAFC(const FloatAFC& a);
01430 FloatAFC& operator =(const FloatAFC& a);
01432 FloatAFC(Home home, const FloatVarArgs& x, double d=1.0);
01440 void init(Home, const FloatVarArgs& x, double d=1.0);
01441 };
01442
01443 }
01444
01445 #include <gecode/float/branch/afc.hpp>
01446
01447 namespace Gecode {
01448
01454 class FloatActivity : public Activity {
01455 public:
01463 FloatActivity(void);
01465 FloatActivity(const FloatActivity& a);
01467 FloatActivity& operator =(const FloatActivity& a);
01476 GECODE_FLOAT_EXPORT
01477 FloatActivity(Home home, const FloatVarArgs& x, double d=1.0,
01478 FloatBranchMerit bm=NULL);
01490 GECODE_FLOAT_EXPORT void
01491 init(Home, const FloatVarArgs& x, double d=1.0,
01492 FloatBranchMerit bm=NULL);
01493 };
01494
01495 }
01496
01497 #include <gecode/float/branch/activity.hpp>
01498
01499 namespace Gecode {
01500
01502 typedef void (*FloatVarValPrint)(const Space &home, const BrancherHandle& bh,
01503 unsigned int a,
01504 FloatVar x, int i, const FloatNumBranch& n,
01505 std::ostream& o);
01506
01507 }
01508
01509 namespace Gecode {
01510
01516 class FloatVarBranch : public VarBranch {
01517 public:
01519 enum Select {
01520 SEL_NONE = 0,
01521 SEL_RND,
01522 SEL_MERIT_MIN,
01523 SEL_MERIT_MAX,
01524 SEL_DEGREE_MIN,
01525 SEL_DEGREE_MAX,
01526 SEL_AFC_MIN,
01527 SEL_AFC_MAX,
01528 SEL_ACTIVITY_MIN,
01529 SEL_ACTIVITY_MAX,
01530 SEL_MIN_MIN,
01531 SEL_MIN_MAX,
01532 SEL_MAX_MIN,
01533 SEL_MAX_MAX,
01534 SEL_SIZE_MIN,
01535 SEL_SIZE_MAX,
01536 SEL_DEGREE_SIZE_MIN,
01537 SEL_DEGREE_SIZE_MAX,
01538 SEL_AFC_SIZE_MIN,
01539 SEL_AFC_SIZE_MAX,
01540 SEL_ACTIVITY_SIZE_MIN,
01541 SEL_ACTIVITY_SIZE_MAX
01542 };
01543 protected:
01545 Select s;
01546 public:
01548 FloatVarBranch(void);
01550 FloatVarBranch(Rnd r);
01552 FloatVarBranch(Select s, BranchTbl t);
01554 FloatVarBranch(Select s, double, BranchTbl t);
01556 FloatVarBranch(Select s, AFC a, BranchTbl t);
01558 FloatVarBranch(Select s, Activity a, BranchTbl t);
01560 FloatVarBranch(Select s, VoidFunction mf, BranchTbl t);
01562 Select select(void) const;
01564 void expand(Home home, const FloatVarArgs& x);
01565 };
01566
01567
01573
01574 FloatVarBranch FLOAT_VAR_NONE(void);
01576 FloatVarBranch FLOAT_VAR_RND(Rnd r);
01578 FloatVarBranch FLOAT_VAR_MERIT_MIN(FloatBranchMerit bm, BranchTbl tbl=NULL);
01580 FloatVarBranch FLOAT_VAR_MERIT_MAX(FloatBranchMerit bm, BranchTbl tbl=NULL);
01582 FloatVarBranch FLOAT_VAR_DEGREE_MIN(BranchTbl tbl=NULL);
01584 FloatVarBranch FLOAT_VAR_DEGREE_MAX(BranchTbl tbl=NULL);
01586 FloatVarBranch FLOAT_VAR_AFC_MIN(double d=1.0, BranchTbl tbl=NULL);
01588 FloatVarBranch FLOAT_VAR_AFC_MIN(FloatAFC a, BranchTbl tbl=NULL);
01590 FloatVarBranch FLOAT_VAR_AFC_MAX(double d=1.0, BranchTbl tbl=NULL);
01592 FloatVarBranch FLOAT_VAR_AFC_MAX(FloatAFC a, BranchTbl tbl=NULL);
01594 FloatVarBranch FLOAT_VAR_ACTIVITY_MIN(double d=1.0, BranchTbl tbl=NULL);
01596 FloatVarBranch FLOAT_VAR_ACTIVITY_MIN(FloatActivity a, BranchTbl tbl=NULL);
01598 FloatVarBranch FLOAT_VAR_ACTIVITY_MAX(double d=1.0, BranchTbl tbl=NULL);
01600 FloatVarBranch FLOAT_VAR_ACTIVITY_MAX(FloatActivity a, BranchTbl tbl=NULL);
01602 FloatVarBranch FLOAT_VAR_MIN_MIN(BranchTbl tbl=NULL);
01604 FloatVarBranch FLOAT_VAR_MIN_MAX(BranchTbl tbl=NULL);
01606 FloatVarBranch FLOAT_VAR_MAX_MIN(BranchTbl tbl=NULL);
01608 FloatVarBranch FLOAT_VAR_MAX_MAX(BranchTbl tbl=NULL);
01610 FloatVarBranch FLOAT_VAR_SIZE_MIN(BranchTbl tbl=NULL);
01612 FloatVarBranch FLOAT_VAR_SIZE_MAX(BranchTbl tbl=NULL);
01614 FloatVarBranch FLOAT_VAR_DEGREE_SIZE_MIN(BranchTbl tbl=NULL);
01616 FloatVarBranch FLOAT_VAR_DEGREE_SIZE_MAX(BranchTbl tbl=NULL);
01618 FloatVarBranch FLOAT_VAR_AFC_SIZE_MIN(double d=1.0, BranchTbl tbl=NULL);
01620 FloatVarBranch FLOAT_VAR_AFC_SIZE_MIN(FloatAFC a, BranchTbl tbl=NULL);
01622 FloatVarBranch FLOAT_VAR_AFC_SIZE_MAX(double d=1.0, BranchTbl tbl=NULL);
01624 FloatVarBranch FLOAT_VAR_AFC_SIZE_MAX(FloatAFC a, BranchTbl tbl=NULL);
01626 FloatVarBranch FLOAT_VAR_ACTIVITY_SIZE_MIN(double d=1.0, BranchTbl tbl=NULL);
01628 FloatVarBranch FLOAT_VAR_ACTIVITY_SIZE_MIN(FloatActivity a, BranchTbl tbl=NULL);
01630 FloatVarBranch FLOAT_VAR_ACTIVITY_SIZE_MAX(double d=1.0, BranchTbl tbl=NULL);
01632 FloatVarBranch FLOAT_VAR_ACTIVITY_SIZE_MAX(FloatActivity a, BranchTbl tbl=NULL);
01634
01635 }
01636
01637 #include <gecode/float/branch/var.hpp>
01638
01639 namespace Gecode {
01640
01646 class FloatValBranch : public ValBranch {
01647 public:
01649 enum Select {
01650 SEL_SPLIT_MIN,
01651 SEL_SPLIT_MAX,
01652 SEL_SPLIT_RND,
01653 SEL_VAL_COMMIT
01654 };
01655 protected:
01657 Select s;
01658 public:
01660 FloatValBranch(Select s = SEL_SPLIT_MIN);
01662 FloatValBranch(Rnd r);
01664 FloatValBranch(VoidFunction v, VoidFunction c);
01666 Select select(void) const;
01667 };
01668
01674
01675 FloatValBranch FLOAT_VAL_SPLIT_MIN(void);
01677 FloatValBranch FLOAT_VAL_SPLIT_MAX(void);
01679 FloatValBranch FLOAT_VAL_SPLIT_RND(Rnd r);
01686 FloatValBranch FLOAT_VAL(FloatBranchVal v, FloatBranchCommit c=NULL);
01688
01689 }
01690
01691 #include <gecode/float/branch/val.hpp>
01692
01693 namespace Gecode {
01694
01700 class FloatAssign : public ValBranch {
01701 public:
01703 enum Select {
01704 SEL_MIN,
01705 SEL_MAX,
01706 SEL_RND,
01707 SEL_VAL_COMMIT
01708 };
01709 protected:
01711 Select s;
01712 public:
01714 FloatAssign(Select s = SEL_MIN);
01716 FloatAssign(Rnd r);
01718 FloatAssign(VoidFunction v, VoidFunction c);
01720 Select select(void) const;
01721 };
01722
01728
01729 FloatAssign FLOAT_ASSIGN_MIN(void);
01731 FloatAssign FLOAT_ASSIGN_MAX(void);
01733 FloatAssign FLOAT_ASSIGN_RND(Rnd r);
01739 FloatAssign FLOAT_ASSIGN(FloatBranchVal v, FloatBranchCommit c=NULL);
01741
01742 }
01743
01744 #include <gecode/float/branch/assign.hpp>
01745
01746 namespace Gecode {
01747
01753 GECODE_FLOAT_EXPORT BrancherHandle
01754 branch(Home home, const FloatVarArgs& x,
01755 FloatVarBranch vars, FloatValBranch vals,
01756 FloatBranchFilter bf=NULL,
01757 FloatVarValPrint vvp=NULL);
01763 GECODE_FLOAT_EXPORT BrancherHandle
01764 branch(Home home, const FloatVarArgs& x,
01765 TieBreak<FloatVarBranch> vars, FloatValBranch vals,
01766 FloatBranchFilter bf=NULL,
01767 FloatVarValPrint vvp=NULL);
01773 GECODE_FLOAT_EXPORT BrancherHandle
01774 branch(Home home, FloatVar x, FloatValBranch vals,
01775 FloatVarValPrint vvp=NULL);
01776
01782 GECODE_FLOAT_EXPORT BrancherHandle
01783 assign(Home home, const FloatVarArgs& x, FloatAssign vals,
01784 FloatBranchFilter fbf=NULL,
01785 FloatVarValPrint vvp=NULL);
01791 GECODE_FLOAT_EXPORT BrancherHandle
01792 assign(Home home, FloatVar x, FloatAssign vals,
01793 FloatVarValPrint vvp=NULL);
01795
01796 }
01797
01798 #endif
01799
01800
01801
01802