Generated on Fri Mar 20 15:55:59 2015 for Gecode by doxygen 1.6.3

linear.hh

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  *     Guido Tack <tack@gecode.org>
00006  *     Vincent Barichard <Vincent.Barichard@univ-angers.fr>
00007  *
00008  *  Copyright:
00009  *     Christian Schulte, 2002
00010  *     Guido Tack, 2004
00011  *     Vincent Barichard, 2012
00012  *
00013  *  Last modified:
00014  *     $Date: 2013-01-24 19:28:06 +0100 (Thu, 24 Jan 2013) $ by $Author: schulte $
00015  *     $Revision: 13235 $
00016  *
00017  *  This file is part of Gecode, the generic constraint
00018  *  development environment:
00019  *     http://www.gecode.org
00020  *
00021  *  Permission is hereby granted, free of charge, to any person obtaining
00022  *  a copy of this software and associated documentation files (the
00023  *  "Software"), to deal in the Software without restriction, including
00024  *  without limitation the rights to use, copy, modify, merge, publish,
00025  *  distribute, sublicense, and/or sell copies of the Software, and to
00026  *  permit persons to whom the Software is furnished to do so, subject to
00027  *  the following conditions:
00028  *
00029  *  The above copyright notice and this permission notice shall be
00030  *  included in all copies or substantial portions of the Software.
00031  *
00032  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00033  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00034  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00035  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00036  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00037  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00038  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00039  *
00040  */
00041 
00042 #ifndef __GECODE_FLOAT_LINEAR_HH__
00043 #define __GECODE_FLOAT_LINEAR_HH__
00044 
00045 #include <gecode/int.hh>
00046 #include <gecode/float.hh>
00047 
00053 namespace Gecode { namespace Float { namespace Linear {
00054 
00060   template<class P, class N, PropCond pc>
00061   class Lin : public Propagator {
00062   protected:
00064     ViewArray<P> x;
00066     ViewArray<N> y;
00068     FloatVal c;
00069 
00071     Lin(Space& home, bool share, Lin<P,N,pc>& p);
00073     Lin(Home home, ViewArray<P>& x, ViewArray<N>& y, FloatVal c);
00074   public:
00076     virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00078     virtual size_t dispose(Space& home);
00079   };
00080 
00086   template<class View>
00087   void bounds_p(ModEventDelta med, ViewArray<View>& x,
00088                 FloatVal& c, FloatNum& sl, FloatNum& su);
00089 
00095   template<class View>
00096   void bounds_n(ModEventDelta med, ViewArray<View>& y,
00097                 FloatVal& c, FloatNum& sl, FloatNum& su);
00098 
00107   template<class P, class N>
00108   class Eq : public Lin<P,N,PC_FLOAT_BND> {
00109   protected:
00110     using Lin<P,N,PC_FLOAT_BND>::x;
00111     using Lin<P,N,PC_FLOAT_BND>::y;
00112     using Lin<P,N,PC_FLOAT_BND>::c;
00113 
00115     Eq(Space& home, bool share, Eq& p);
00116   public:
00118     Eq(Home home, ViewArray<P>& x, ViewArray<N>& y, FloatVal c);
00120     virtual Actor* copy(Space& home, bool share);
00122     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00124     static ExecStatus
00125     post(Home home, ViewArray<P>& x, ViewArray<N>& y, FloatVal c);
00126   };
00127 
00128 
00137   template<class P, class N>
00138   class Lq : public Lin<P,N,PC_FLOAT_BND> {
00139   protected:
00140     using Lin<P,N,PC_FLOAT_BND>::x;
00141     using Lin<P,N,PC_FLOAT_BND>::y;
00142     using Lin<P,N,PC_FLOAT_BND>::c;
00143 
00145     Lq(Space& home, bool share, Lq& p);
00146   public:
00148     Lq(Home home, ViewArray<P>& x, ViewArray<N>& y, FloatVal c);
00150     virtual Actor* copy(Space& home, bool share);
00152     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00154     static ExecStatus
00155     post(Home home, ViewArray<P>& x, ViewArray<N>& y, FloatVal c);
00156   };
00157 
00158 }}}
00159 
00160 #include <gecode/float/linear/nary.hpp>
00161 
00162 namespace Gecode { namespace Float { namespace Linear {
00163 
00168   class Term {
00169   public:
00171     FloatVal a;
00173     FloatView x;
00174   };
00175 
00190   GECODE_FLOAT_EXPORT void 
00191   estimate(Term* t, int n, FloatVal c, FloatNum& l, FloatNum& u);
00192 
00209   GECODE_FLOAT_EXPORT void
00210   post(Home home, Term* t, int n, FloatRelType frt, FloatVal c);
00211 
00229   GECODE_FLOAT_EXPORT void
00230   post(Home home, Term* t, int n, FloatRelType frt, FloatVal c, Reify r);
00231 
00232 }}}
00233 
00234 #endif
00235 
00236 // STATISTICS: float-prop