Generated on Tue May 22 09:39:50 2018 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  *  This file is part of Gecode, the generic constraint
00012  *  development environment:
00013  *     http://www.gecode.org
00014  *
00015  *  Permission is hereby granted, free of charge, to any person obtaining
00016  *  a copy of this software and associated documentation files (the
00017  *  "Software"), to deal in the Software without restriction, including
00018  *  without limitation the rights to use, copy, modify, merge, publish,
00019  *  distribute, sublicense, and/or sell copies of the Software, and to
00020  *  permit persons to whom the Software is furnished to do so, subject to
00021  *  the following conditions:
00022  *
00023  *  The above copyright notice and this permission notice shall be
00024  *  included in all copies or substantial portions of the Software.
00025  *
00026  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00027  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00028  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00029  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00030  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00031  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00032  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
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 // STATISTICS: float-var