Generated on Tue Apr 18 10:21:43 2017 for Gecode by doxygen 1.6.3

view.hpp

Go to the documentation of this file.
00001 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
00002 /*
00003  *  Main authors:
00004  *     Christian Schulte <schulte@gecode.org>
00005  *     Vincent Barichard <Vincent.Barichard@univ-angers.fr>
00006  *
00007  *  Copyright:
00008  *     Christian Schulte, 2005
00009  *     Vincent Barichard, 2012
00010  *
00011  *  Last modified:
00012  *     $Date: 2016-04-19 17:19:45 +0200 (Tue, 19 Apr 2016) $ by $Author: schulte $
00013  *     $Revision: 14967 $
00014  *
00015  *  This file is part of Gecode, the generic constraint
00016  *  development environment:
00017  *     http://www.gecode.org
00018  *
00019  *  Permission is hereby granted, free of charge, to any person obtaining
00020  *  a copy of this software and associated documentation files (the
00021  *  "Software"), to deal in the Software without restriction, including
00022  *  without limitation the rights to use, copy, modify, merge, publish,
00023  *  distribute, sublicense, and/or sell copies of the Software, and to
00024  *  permit persons to whom the Software is furnished to do so, subject to
00025  *  the following conditions:
00026  *
00027  *  The above copyright notice and this permission notice shall be
00028  *  included in all copies or substantial portions of the Software.
00029  *
00030  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00031  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00032  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00033  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00034  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00035  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00036  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00037  *
00038  */
00039 
00040 #include <iostream>
00041 
00042 namespace Gecode { namespace Float {
00043 
00056   class FloatView : public VarImpView<FloatVar> {
00057   protected:
00058     using VarImpView<FloatVar>::x;
00059   public:
00061 
00062 
00063     FloatView(void);
00065     FloatView(const FloatVar& y);
00067     FloatView(FloatVarImp* y);
00069 
00071 
00072 
00073     FloatVal domain(void) const;
00075     FloatNum min(void) const;
00077     FloatNum max(void) const;
00079     FloatNum med(void) const;
00087     FloatVal val(void) const;
00088 
00090     FloatNum size(void) const;
00092 
00094 
00095 
00096     bool zero_in(void) const;
00098     bool in(FloatNum n) const;
00100     bool in(const FloatVal& n) const;
00102 
00104 
00105 
00106     ModEvent lq(Space& home, int n);
00108     ModEvent lq(Space& home, FloatNum n);
00110     ModEvent lq(Space& home, FloatVal n);
00111 
00113     ModEvent gq(Space& home, int n);
00115     ModEvent gq(Space& home, FloatNum n);
00117     ModEvent gq(Space& home, FloatVal n);
00118 
00120     ModEvent eq(Space& home, int n);
00122     ModEvent eq(Space& home, FloatNum n);
00124     ModEvent eq(Space& home, const FloatVal& n);
00125 
00127 
00129 
00130 
00131     FloatNum min(const Delta& d) const;
00133     FloatNum max(const Delta& d) const;
00135 
00137 
00138 
00139     static ModEventDelta med(ModEvent me);
00141   };
00142 
00147   template<class Char, class Traits>
00148   std::basic_ostream<Char,Traits>&
00149   operator <<(std::basic_ostream<Char,Traits>& os, const FloatView& x);
00150 
00158   class MinusView : public DerivedView<FloatView> {
00159   protected:
00160     using DerivedView<FloatView>::x;
00161   public:
00163 
00164 
00165     MinusView(void);
00167     explicit MinusView(const FloatView& y);
00169 
00171 
00172 
00173     FloatVal domain(void) const;
00175     FloatNum min(void) const;
00177     FloatNum max(void) const;
00179     FloatNum med(void) const;
00187     FloatVal val(void) const;
00188 
00190     FloatNum size(void) const;
00192 
00194 
00195 
00196     bool zero_in(void) const;
00198     bool in(FloatNum n) const;
00200     bool in(const FloatVal& n) const;
00202 
00204 
00205 
00206     ModEvent lq(Space& home, int n);
00208     ModEvent lq(Space& home, FloatNum n);
00210     ModEvent lq(Space& home, FloatVal n);
00211 
00213     ModEvent gq(Space& home, int n);
00215     ModEvent gq(Space& home, FloatNum n);
00217     ModEvent gq(Space& home, FloatVal n);
00218 
00220     ModEvent eq(Space& home, int n);
00222     ModEvent eq(Space& home, FloatNum n);
00224     ModEvent eq(Space& home, const FloatVal& n);
00225 
00227 
00229 
00230 
00231     FloatNum min(const Delta& d) const;
00233     FloatNum max(const Delta& d) const;
00235 
00237 
00238 
00239     static ModEventDelta med(ModEvent me);
00241   };
00242 
00247   template<class Char, class Traits>
00248   std::basic_ostream<Char,Traits>&
00249   operator <<(std::basic_ostream<Char,Traits>& os, const MinusView& x);
00250 
00251 
00260   class OffsetView : public DerivedView<FloatView> {
00261   protected:
00263     FloatNum c;
00264     using DerivedView<FloatView>::x;
00265   public:
00267 
00268 
00269     OffsetView(void);
00271     explicit OffsetView(const FloatView& y, FloatNum c);
00273 
00275 
00276 
00277     FloatNum offset(void) const;
00279     void offset(FloatNum n);
00281     FloatVal domain(void) const;
00283     FloatNum min(void) const;
00285     FloatNum max(void) const;
00287     FloatNum med(void) const;
00295     FloatVal val(void) const;
00296 
00298     FloatNum size(void) const;
00300 
00302 
00303 
00304     bool zero_in(void) const;
00306     bool in(FloatNum n) const;
00308     bool in(const FloatVal& n) const;
00310 
00312 
00313 
00314     ModEvent lq(Space& home, int n);
00316     ModEvent lq(Space& home, FloatNum n);
00318     ModEvent lq(Space& home, FloatVal n);
00319 
00321     ModEvent gq(Space& home, int n);
00323     ModEvent gq(Space& home, FloatNum n);
00325     ModEvent gq(Space& home, FloatVal n);
00326 
00328     ModEvent eq(Space& home, int n);
00330     ModEvent eq(Space& home, FloatNum n);
00332     ModEvent eq(Space& home, const FloatVal& n);
00333 
00335 
00337 
00338 
00339     FloatNum min(const Delta& d) const;
00341     FloatNum max(const Delta& d) const;
00343 
00345 
00346 
00347     static ModEventDelta med(ModEvent me);
00349 
00351 
00352     void update(Space& home, bool share, OffsetView& y);
00354   };
00355 
00360   template<class Char, class Traits>
00361   std::basic_ostream<Char,Traits>&
00362   operator <<(std::basic_ostream<Char,Traits>& os, const OffsetView& x);
00363 
00373   class ScaleView : public DerivedView<FloatView> {
00374   protected:
00375     using DerivedView<FloatView>::x;
00377     FloatVal a;
00378 
00379   public:
00381 
00382 
00383     ScaleView(void);
00385     ScaleView(FloatVal b, const FloatView& y);
00387 
00389 
00390 
00391     FloatVal domain(void) const;
00393     FloatVal scale(void) const;
00395     FloatNum min(void) const;
00397     FloatNum max(void) const;
00399     FloatNum med(void) const;
00400 
00408     FloatVal val(void) const;
00409 
00411     FloatNum size(void) const;
00413 
00415 
00416 
00417     bool zero_in(void) const;
00419     bool in(FloatNum n) const;
00421     bool in(const FloatVal& n) const;
00423 
00425 
00426 
00427     ModEvent lq(Space& home, int n);
00429     ModEvent lq(Space& home, FloatNum n);
00431     ModEvent lq(Space& home, FloatVal n);
00432 
00434     ModEvent gq(Space& home, int n);
00436     ModEvent gq(Space& home, FloatNum n);
00438     ModEvent gq(Space& home, FloatVal n);
00439 
00441     ModEvent eq(Space& home, int n);
00443     ModEvent eq(Space& home, FloatNum n);
00445     ModEvent eq(Space& home, const FloatVal& n);
00446 
00448 
00450 
00451 
00452     FloatNum min(const Delta& d) const;
00454     FloatNum max(const Delta& d) const;
00456 
00458 
00459 
00460     static ModEventDelta med(ModEvent me);
00462 
00464 
00465     void update(Space& home, bool share, ScaleView& y);
00467   };
00468 
00473   template<class Char, class Traits>
00474   std::basic_ostream<Char,Traits>&
00475   operator <<(std::basic_ostream<Char,Traits>& os, const ScaleView& x);
00476 
00477 } }
00478 
00479 #include <gecode/float/var/float.hpp>
00480 #include <gecode/float/view/float.hpp>
00481 #include <gecode/float/view/minus.hpp>
00482 #include <gecode/float/view/offset.hpp>
00483 #include <gecode/float/view/scale.hpp>
00484 #include <gecode/float/view/print.hpp>
00485 #include <gecode/float/var/print.hpp>
00486 
00487 namespace Gecode { namespace Float {
00494 
00495   enum RelTest {
00496     RT_FALSE = 0, 
00497     RT_MAYBE = 1, 
00498     RT_TRUE  = 2  
00499   };
00500 
00502   template<class View> RelTest rtest_eq(View x, View y);
00504   template<class View> RelTest rtest_eq(View x, FloatVal n);
00505 
00507   template<class View> RelTest rtest_lq(View x, View y);
00509   template<class View> RelTest rtest_lq(View x, FloatVal n);
00510 
00512   template<class View> RelTest rtest_le(View x, View y);
00514   template<class View> RelTest rtest_le(View x, FloatVal n);
00515 
00517 
00518 }}
00519 
00520 #include <gecode/float/view/rel-test.hpp>
00521 
00522 // STATISTICS: float-var