* \brief Scale float view * * A scale float view \f$s\f$ for a float view \f$x\f$ and * a non-negative float \f$a\f$ provides operations such that \f$s\f$ * behaves as \f$a\cdot x\f$. * * \ingroup TaskActorFloatView */
| 393 | * \ingroup TaskActorFloatView |
| 394 | */ |
| 395 | class ScaleView : public DerivedView<FloatView> { |
| 396 | protected: |
| 397 | using DerivedView<FloatView>::x; |
| 398 | /// Scale factor |
| 399 | FloatVal a; |
| 400 | |
| 401 | public: |
| 402 | /// \name Constructors and initialization |
| 403 | //@{ |
| 404 | /// Default constructor |
| 405 | ScaleView(void); |
| 406 | /// Initialize as \f$b\cdot y\f$ |
| 407 | ScaleView(FloatVal b, const FloatView& y); |
| 408 | //@} |
| 409 | |
| 410 | /// \name Value access |
| 411 | //@{ |
| 412 | /// Return domain |
| 413 | FloatVal domain(void) const; |
| 414 | /// Return scale factor of scale view |
| 415 | FloatVal scale(void) const; |
| 416 | /// Return minimum of domain |
| 417 | FloatNum min(void) const; |
| 418 | /// Return maximum of domain |
| 419 | FloatNum max(void) const; |
| 420 | /// Return median of domain (closest representation) |
| 421 | FloatNum med(void) const; |
| 422 | |
| 423 | /** |
| 424 | * \brief Return assigned value |
| 425 | * |
| 426 | * Throws an exception of type Float::ValOfUnassignedVar if variable |
| 427 | * is not yet assigned. |
| 428 | * |
| 429 | */ |
| 430 | FloatVal val(void) const; |
| 431 | |
| 432 | /// Return size of domain (distance between maximum and minimum) |
| 433 | FloatNum size(void) const; |
| 434 | //@} |
| 435 | |
| 436 | /// \name Domain tests |
| 437 | //@{ |
| 438 | /// Test whether 0 is contained in domain |
| 439 | bool zero_in(void) const; |
| 440 | /// Test whether \a n is contained in domain |
| 441 | bool in(FloatNum n) const; |
| 442 | /// Test whether \a n is contained in domain |
| 443 | bool in(const FloatVal& n) const; |
| 444 | //@} |
| 445 | |
| 446 | /// \name Domain update by value |
| 447 | //@{ |
| 448 | /// Restrict domain values to be less or equal than \a n |
| 449 | ModEvent lq(Space& home, int n); |
| 450 | /// Restrict domain values to be less or equal than \a n |
| 451 | ModEvent lq(Space& home, FloatNum n); |
| 452 | /// Restrict domain values to be less or equal than \a n |