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 #include <iostream>
00037
00038 namespace Gecode { namespace Float {
00039
00052 class FloatView : public VarImpView<FloatVar> {
00053 protected:
00054 using VarImpView<FloatVar>::x;
00055 public:
00057
00058
00059 FloatView(void);
00061 FloatView(const FloatVar& y);
00063 FloatView(FloatVarImp* y);
00065
00067
00068
00069 FloatVal domain(void) const;
00071 FloatNum min(void) const;
00073 FloatNum max(void) const;
00075 FloatNum med(void) const;
00083 FloatVal val(void) const;
00084
00086 FloatNum size(void) const;
00088
00090
00091
00092 bool zero_in(void) const;
00094 bool in(FloatNum n) const;
00096 bool in(const FloatVal& n) const;
00098
00100
00101
00102 ModEvent lq(Space& home, int n);
00104 ModEvent lq(Space& home, FloatNum n);
00106 ModEvent lq(Space& home, FloatVal n);
00107
00109 ModEvent gq(Space& home, int n);
00111 ModEvent gq(Space& home, FloatNum n);
00113 ModEvent gq(Space& home, FloatVal n);
00114
00116 ModEvent eq(Space& home, int n);
00118 ModEvent eq(Space& home, FloatNum n);
00120 ModEvent eq(Space& home, const FloatVal& n);
00121
00123
00125
00126
00127 FloatNum min(const Delta& d) const;
00129 FloatNum max(const Delta& d) const;
00131
00133
00134
00135 static ModEventDelta med(ModEvent me);
00137 };
00138
00143 template<class Char, class Traits>
00144 std::basic_ostream<Char,Traits>&
00145 operator <<(std::basic_ostream<Char,Traits>& os, const FloatView& x);
00146
00154 class MinusView : public DerivedView<FloatView> {
00155 protected:
00156 using DerivedView<FloatView>::x;
00157 public:
00159
00160
00161 MinusView(void);
00163 explicit MinusView(const FloatView& y);
00165
00167
00168
00169 FloatVal domain(void) const;
00171 FloatNum min(void) const;
00173 FloatNum max(void) const;
00175 FloatNum med(void) const;
00183 FloatVal val(void) const;
00184
00186 FloatNum size(void) const;
00188
00190
00191
00192 bool zero_in(void) const;
00194 bool in(FloatNum n) const;
00196 bool in(const FloatVal& n) const;
00198
00200
00201
00202 ModEvent lq(Space& home, int n);
00204 ModEvent lq(Space& home, FloatNum n);
00206 ModEvent lq(Space& home, FloatVal n);
00207
00209 ModEvent gq(Space& home, int n);
00211 ModEvent gq(Space& home, FloatNum n);
00213 ModEvent gq(Space& home, FloatVal n);
00214
00216 ModEvent eq(Space& home, int n);
00218 ModEvent eq(Space& home, FloatNum n);
00220 ModEvent eq(Space& home, const FloatVal& n);
00221
00223
00225
00226
00227 FloatNum min(const Delta& d) const;
00229 FloatNum max(const Delta& d) const;
00231
00233
00234
00235 static ModEventDelta med(ModEvent me);
00237 };
00238
00243 template<class Char, class Traits>
00244 std::basic_ostream<Char,Traits>&
00245 operator <<(std::basic_ostream<Char,Traits>& os, const MinusView& x);
00246
00247
00256 class OffsetView : public DerivedView<FloatView> {
00257 protected:
00259 FloatNum c;
00260 using DerivedView<FloatView>::x;
00261 public:
00263
00264
00265 OffsetView(void);
00267 explicit OffsetView(const FloatView& y, FloatNum c);
00269
00271
00272
00273 FloatNum offset(void) const;
00275 void offset(FloatNum n);
00277 FloatVal domain(void) const;
00279 FloatNum min(void) const;
00281 FloatNum max(void) const;
00283 FloatNum med(void) const;
00291 FloatVal val(void) const;
00292
00294 FloatNum size(void) const;
00296
00298
00299
00300 bool zero_in(void) const;
00302 bool in(FloatNum n) const;
00304 bool in(const FloatVal& n) const;
00306
00308
00309
00310 ModEvent lq(Space& home, int n);
00312 ModEvent lq(Space& home, FloatNum n);
00314 ModEvent lq(Space& home, FloatVal n);
00315
00317 ModEvent gq(Space& home, int n);
00319 ModEvent gq(Space& home, FloatNum n);
00321 ModEvent gq(Space& home, FloatVal n);
00322
00324 ModEvent eq(Space& home, int n);
00326 ModEvent eq(Space& home, FloatNum n);
00328 ModEvent eq(Space& home, const FloatVal& n);
00329
00331
00333
00334
00335 FloatNum min(const Delta& d) const;
00337 FloatNum max(const Delta& d) const;
00339
00341
00342
00343 static ModEventDelta med(ModEvent me);
00345
00347
00348 void update(Space& home, OffsetView& y);
00350 };
00351
00356 template<class Char, class Traits>
00357 std::basic_ostream<Char,Traits>&
00358 operator <<(std::basic_ostream<Char,Traits>& os, const OffsetView& x);
00359
00369 class ScaleView : public DerivedView<FloatView> {
00370 protected:
00371 using DerivedView<FloatView>::x;
00373 FloatVal a;
00374
00375 public:
00377
00378
00379 ScaleView(void);
00381 ScaleView(FloatVal b, const FloatView& y);
00383
00385
00386
00387 FloatVal domain(void) const;
00389 FloatVal scale(void) const;
00391 FloatNum min(void) const;
00393 FloatNum max(void) const;
00395 FloatNum med(void) const;
00396
00404 FloatVal val(void) const;
00405
00407 FloatNum size(void) const;
00409
00411
00412
00413 bool zero_in(void) const;
00415 bool in(FloatNum n) const;
00417 bool in(const FloatVal& n) const;
00419
00421
00422
00423 ModEvent lq(Space& home, int n);
00425 ModEvent lq(Space& home, FloatNum n);
00427 ModEvent lq(Space& home, FloatVal n);
00428
00430 ModEvent gq(Space& home, int n);
00432 ModEvent gq(Space& home, FloatNum n);
00434 ModEvent gq(Space& home, FloatVal n);
00435
00437 ModEvent eq(Space& home, int n);
00439 ModEvent eq(Space& home, FloatNum n);
00441 ModEvent eq(Space& home, const FloatVal& n);
00442
00444
00446
00447
00448 FloatNum min(const Delta& d) const;
00450 FloatNum max(const Delta& d) const;
00452
00454
00455
00456 static ModEventDelta med(ModEvent me);
00458
00460
00461 void update(Space& home, ScaleView& y);
00463 };
00464
00469 template<class Char, class Traits>
00470 std::basic_ostream<Char,Traits>&
00471 operator <<(std::basic_ostream<Char,Traits>& os, const ScaleView& x);
00472
00473 } }
00474
00475 #include <gecode/float/var/float.hpp>
00476 #include <gecode/float/view/float.hpp>
00477 #include <gecode/float/view/minus.hpp>
00478 #include <gecode/float/view/offset.hpp>
00479 #include <gecode/float/view/scale.hpp>
00480 #include <gecode/float/view/print.hpp>
00481 #include <gecode/float/var/print.hpp>
00482
00483 namespace Gecode { namespace Float {
00490
00491 enum RelTest {
00492 RT_FALSE = 0,
00493 RT_MAYBE = 1,
00494 RT_TRUE = 2
00495 };
00496
00498 template<class View> RelTest rtest_eq(View x, View y);
00500 template<class View> RelTest rtest_eq(View x, FloatVal n);
00501
00503 template<class View> RelTest rtest_lq(View x, View y);
00505 template<class View> RelTest rtest_lq(View x, FloatVal n);
00506
00508 template<class View> RelTest rtest_le(View x, View y);
00510 template<class View> RelTest rtest_le(View x, FloatVal n);
00511
00513
00514 }}
00515
00516 #include <gecode/float/view/rel-test.hpp>
00517
00518