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
00251
00252 bool operator ==(const MinusView& x, const MinusView& y);
00254 bool operator !=(const MinusView& x, const MinusView& y);
00256
00257
00266 class OffsetView : public DerivedView<FloatView> {
00267 protected:
00269 FloatNum c;
00270 using DerivedView<FloatView>::x;
00271 public:
00273
00274
00275 OffsetView(void);
00277 explicit OffsetView(const FloatView& y, FloatNum c);
00279
00281
00282
00283 FloatNum offset(void) const;
00285 void offset(FloatNum n);
00287 FloatVal domain(void) const;
00289 FloatNum min(void) const;
00291 FloatNum max(void) const;
00293 FloatNum med(void) const;
00301 FloatVal val(void) const;
00302
00304 FloatNum size(void) const;
00306
00308
00309
00310 bool zero_in(void) const;
00312 bool in(FloatNum n) const;
00314 bool in(const FloatVal& n) const;
00316
00318
00319
00320 ModEvent lq(Space& home, int n);
00322 ModEvent lq(Space& home, FloatNum n);
00324 ModEvent lq(Space& home, FloatVal n);
00325
00327 ModEvent gq(Space& home, int n);
00329 ModEvent gq(Space& home, FloatNum n);
00331 ModEvent gq(Space& home, FloatVal n);
00332
00334 ModEvent eq(Space& home, int n);
00336 ModEvent eq(Space& home, FloatNum n);
00338 ModEvent eq(Space& home, const FloatVal& n);
00339
00341
00343
00344
00345 FloatNum min(const Delta& d) const;
00347 FloatNum max(const Delta& d) const;
00349
00351
00352
00353 static ModEventDelta med(ModEvent me);
00355
00357
00358 void update(Space& home, OffsetView& y);
00360
00362
00363
00364 bool operator <(const OffsetView& y) const;
00366 };
00367
00372 template<class Char, class Traits>
00373 std::basic_ostream<Char,Traits>&
00374 operator <<(std::basic_ostream<Char,Traits>& os, const OffsetView& x);
00375
00380
00381 bool operator ==(const OffsetView& x, const OffsetView& y);
00383 bool operator !=(const OffsetView& x, const OffsetView& y);
00385
00395 class ScaleView : public DerivedView<FloatView> {
00396 protected:
00397 using DerivedView<FloatView>::x;
00399 FloatVal a;
00400
00401 public:
00403
00404
00405 ScaleView(void);
00407 ScaleView(FloatVal b, const FloatView& y);
00409
00411
00412
00413 FloatVal domain(void) const;
00415 FloatVal scale(void) const;
00417 FloatNum min(void) const;
00419 FloatNum max(void) const;
00421 FloatNum med(void) const;
00422
00430 FloatVal val(void) const;
00431
00433 FloatNum size(void) const;
00435
00437
00438
00439 bool zero_in(void) const;
00441 bool in(FloatNum n) const;
00443 bool in(const FloatVal& n) const;
00445
00447
00448
00449 ModEvent lq(Space& home, int n);
00451 ModEvent lq(Space& home, FloatNum n);
00453 ModEvent lq(Space& home, FloatVal n);
00454
00456 ModEvent gq(Space& home, int n);
00458 ModEvent gq(Space& home, FloatNum n);
00460 ModEvent gq(Space& home, FloatVal n);
00461
00463 ModEvent eq(Space& home, int n);
00465 ModEvent eq(Space& home, FloatNum n);
00467 ModEvent eq(Space& home, const FloatVal& n);
00468
00470
00472
00473
00474 FloatNum min(const Delta& d) const;
00476 FloatNum max(const Delta& d) const;
00478
00480
00481
00482 static ModEventDelta med(ModEvent me);
00484
00486
00487 void update(Space& home, ScaleView& y);
00489
00491
00492
00493 bool operator <(const ScaleView& y) const;
00495 };
00496
00501 template<class Char, class Traits>
00502 std::basic_ostream<Char,Traits>&
00503 operator <<(std::basic_ostream<Char,Traits>& os, const ScaleView& x);
00504
00509
00510 bool operator ==(const ScaleView& x, const ScaleView& y);
00512 bool operator !=(const ScaleView& x, const ScaleView& y);
00514
00515 }}
00516
00517 #include <gecode/float/var/float.hpp>
00518 #include <gecode/float/view/float.hpp>
00519 #include <gecode/float/view/minus.hpp>
00520 #include <gecode/float/view/offset.hpp>
00521 #include <gecode/float/view/scale.hpp>
00522 #include <gecode/float/view/print.hpp>
00523 #include <gecode/float/var/print.hpp>
00524
00525 namespace Gecode { namespace Float {
00532
00533 enum RelTest {
00534 RT_FALSE = 0,
00535 RT_MAYBE = 1,
00536 RT_TRUE = 2
00537 };
00538
00540 template<class View> RelTest rtest_eq(View x, View y);
00542 template<class View> RelTest rtest_eq(View x, FloatVal n);
00543
00545 template<class View> RelTest rtest_lq(View x, View y);
00547 template<class View> RelTest rtest_lq(View x, FloatVal n);
00548
00550 template<class View> RelTest rtest_le(View x, View y);
00552 template<class View> RelTest rtest_le(View x, FloatVal n);
00553
00555
00556 }}
00557
00558 #include <gecode/float/view/rel-test.hpp>
00559
00560