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

rel.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  *  Contributing authors:
00009  *     Gabor Szokoli <szokoli@gecode.org>
00010  *
00011  *  Copyright:
00012  *     Christian Schulte, 2002
00013  *     Guido Tack, 2004
00014  *     Gabor Szokoli, 2003
00015  *     Vincent Barichard, 2012
00016  *
00017  *  Last modified:
00018  *     $Date: 2012-12-13 16:02:59 +0100 (Thu, 13 Dec 2012) $ by $Author: vbarichard $
00019  *     $Revision: 13202 $
00020  *
00021  *  This file is part of Gecode, the generic constraint
00022  *  development environment:
00023  *     http://www.gecode.org
00024  *
00025  *  Permission is hereby granted, free of charge, to any person obtaining
00026  *  a copy of this software and associated documentation files (the
00027  *  "Software"), to deal in the Software without restriction, including
00028  *  without limitation the rights to use, copy, modify, merge, publish,
00029  *  distribute, sublicense, and/or sell copies of the Software, and to
00030  *  permit persons to whom the Software is furnished to do so, subject to
00031  *  the following conditions:
00032  *
00033  *  The above copyright notice and this permission notice shall be
00034  *  included in all copies or substantial portions of the Software.
00035  *
00036  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00037  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00038  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00039  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00040  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00041  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00042  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00043  *
00044  */
00045 
00046 #ifndef __GECODE_FLOAT_REL_HH__
00047 #define __GECODE_FLOAT_REL_HH__
00048 
00049 #include <gecode/int.hh>
00050 #include <gecode/float.hh>
00051 
00056 namespace Gecode { namespace Float { namespace Rel {
00057 
00058   /*
00059    * Equality propagators
00060    *
00061    */
00062 
00069   template<class View0, class View1>
00070   class Eq :
00071     public MixBinaryPropagator<View0,PC_FLOAT_BND,View1,PC_FLOAT_BND> {
00072   protected:
00073     using MixBinaryPropagator<View0,PC_FLOAT_BND,View1,PC_FLOAT_BND>::x0;
00074     using MixBinaryPropagator<View0,PC_FLOAT_BND,View1,PC_FLOAT_BND>::x1;
00075 
00077     Eq(Space& home, bool share, Eq<View0,View1>& p);
00078   public:
00080     Eq(Home home, View0 x0, View1 x1);
00082     Eq(Space& home, bool share, Propagator& p, View0 x0, View1 x1);
00084     virtual Actor* copy(Space& home, bool share);
00086     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00088     static  ExecStatus post(Home home, View0 x0, View1 x1);
00089   };
00090 
00097   template<class View>
00098   class NaryEq : public NaryPropagator<View,PC_FLOAT_BND> {
00099   protected:
00100     using NaryPropagator<View,PC_FLOAT_BND>::x;
00101 
00103     NaryEq(Space& home, bool share, NaryEq<View>& p);
00105     NaryEq(Home home, ViewArray<View>&);
00106   public:
00108     virtual Actor* copy(Space& home, bool share);
00115     virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00117     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00119     static  ExecStatus post(Home home, ViewArray<View>& x);
00120   };
00121 
00128   template<class View, class CtrlView, ReifyMode rm>
00129   class ReEq : public Int::ReBinaryPropagator<View,PC_FLOAT_BND,CtrlView> {
00130   protected:
00131     using Int::ReBinaryPropagator<View,PC_FLOAT_BND,CtrlView>::x0;
00132     using Int::ReBinaryPropagator<View,PC_FLOAT_BND,CtrlView>::x1;
00133     using Int::ReBinaryPropagator<View,PC_FLOAT_BND,CtrlView>::b;
00134 
00136     ReEq(Space& home, bool share, ReEq& p);
00138     ReEq(Home home, View x0, View x1, CtrlView b);
00139   public:
00141     virtual Actor*     copy(Space& home, bool share);
00143     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00145     static  ExecStatus post(Home home, View x0, View x1, CtrlView b);
00146   };
00147 
00154   template<class View, class CtrlView, ReifyMode rm>
00155   class ReEqFloat : public Int::ReUnaryPropagator<View,PC_FLOAT_BND,CtrlView> {
00156   protected:
00157     using Int::ReUnaryPropagator<View,PC_FLOAT_BND,CtrlView>::x0;
00158     using Int::ReUnaryPropagator<View,PC_FLOAT_BND,CtrlView>::b;
00159 
00161     FloatVal c;
00163     ReEqFloat(Space& home, bool share, ReEqFloat& p);
00165     ReEqFloat(Home home, View x, FloatVal c, CtrlView b);
00166   public:
00168     virtual Actor* copy(Space& home, bool share);
00170     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00172     static  ExecStatus post(Home home, View x, FloatVal c, CtrlView b);
00173   };
00174 
00175 
00182   template<class View0, class View1>
00183   class Nq :
00184     public MixBinaryPropagator<View0,PC_FLOAT_VAL,View1,PC_FLOAT_VAL> {
00185   protected:
00186     using MixBinaryPropagator<View0,PC_FLOAT_VAL,View1,PC_FLOAT_VAL>::x0;
00187     using MixBinaryPropagator<View0,PC_FLOAT_VAL,View1,PC_FLOAT_VAL>::x1;
00188 
00190     Nq(Space& home, bool share, Nq<View0,View1>& p);
00191   public:
00193     Nq(Home home, View0 x0, View1 x1);
00195     Nq(Space& home, bool share, Propagator& p, View0 x0, View1 x1);
00197     virtual Actor* copy(Space& home, bool share);
00199     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00201     static  ExecStatus post(Home home, View0 x0, View1 x1);
00202   };
00203 
00210   template<class View>
00211   class NqFloat :
00212     public UnaryPropagator<View,PC_FLOAT_VAL> {
00213   protected:
00214     using UnaryPropagator<View,PC_FLOAT_VAL>::x0;
00215 
00217     FloatVal c;
00219     NqFloat(Space& home, bool share, NqFloat<View>& p);
00220   public:
00222     NqFloat(Home home, View x, FloatVal c);
00224     virtual Actor* copy(Space& home, bool share);
00226     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00228     static  ExecStatus post(Home home, View x0, FloatVal c);
00229   };
00230 
00231 
00232   /*
00233    * Order propagators
00234    *
00235    */
00236 
00244   template<class View>
00245   class Lq : public BinaryPropagator<View,PC_FLOAT_BND> {
00246   protected:
00247     using BinaryPropagator<View,PC_FLOAT_BND>::x0;
00248     using BinaryPropagator<View,PC_FLOAT_BND>::x1;
00249 
00251     Lq(Space& home, bool share, Lq& p);
00253     Lq(Home home, View x0, View x1);
00254   public:
00256     virtual Actor*     copy(Space& home, bool share);
00258     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00260     static  ExecStatus post(Home home, View x0, View x1);
00261   };
00262 
00270   template<class View>
00271   class Le : public BinaryPropagator<View,PC_FLOAT_BND> {
00272   protected:
00273     using BinaryPropagator<View,PC_FLOAT_BND>::x0;
00274     using BinaryPropagator<View,PC_FLOAT_BND>::x1;
00275 
00277     Le(Space& home, bool share, Le& p);
00279     Le(Home home, View x0, View x1);
00280   public:
00282     virtual Actor*     copy(Space& home, bool share);
00284     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00286     static  ExecStatus post(Home home, View x0, View x1);
00287   };
00288 
00289   /*
00290    * Reified order propagators
00291    *
00292    */
00293 
00301   template<class View, class CtrlView, ReifyMode rm>
00302   class ReLqFloat : public Int::ReUnaryPropagator<View,PC_FLOAT_BND,CtrlView> {
00303   protected:
00304     using Int::ReUnaryPropagator<View,PC_FLOAT_BND,CtrlView>::x0;
00305     using Int::ReUnaryPropagator<View,PC_FLOAT_BND,CtrlView>::b;
00306 
00308     FloatVal c;
00310     ReLqFloat(Space& home, bool share, ReLqFloat& p);
00312     ReLqFloat(Home home, View x, FloatVal c, CtrlView b);
00313   public:
00315     virtual Actor* copy(Space& home, bool share);
00317     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00319     static  ExecStatus post(Home home, View x, FloatVal c, CtrlView b);
00320    };
00321 
00329   template<class View, class CtrlView, ReifyMode rm>
00330   class ReLeFloat : public Int::ReUnaryPropagator<View,PC_FLOAT_BND,CtrlView> {
00331   protected:
00332     using Int::ReUnaryPropagator<View,PC_FLOAT_BND,CtrlView>::x0;
00333     using Int::ReUnaryPropagator<View,PC_FLOAT_BND,CtrlView>::b;
00334 
00336     FloatVal c;
00338     ReLeFloat(Space& home, bool share, ReLeFloat& p);
00340     ReLeFloat(Home home, View x, FloatVal c, CtrlView b);
00341   public:
00343     virtual Actor* copy(Space& home, bool share);
00345     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00347     static  ExecStatus post(Home home, View x, FloatVal c, CtrlView b);
00348    };
00349 
00357   template<class View, class CtrlView, ReifyMode rm>
00358   class ReLq : public Int::ReBinaryPropagator<View,PC_FLOAT_BND,CtrlView> {
00359   protected:
00360     using Int::ReBinaryPropagator<View,PC_FLOAT_BND,CtrlView>::x0;
00361     using Int::ReBinaryPropagator<View,PC_FLOAT_BND,CtrlView>::x1;
00362     using Int::ReBinaryPropagator<View,PC_FLOAT_BND,CtrlView>::b;
00363 
00365     ReLq(Space& home, bool share, ReLq& p);
00367     ReLq(Home home, View x0, View x1, CtrlView b);
00368   public:
00370     virtual Actor* copy(Space& home, bool share);
00372     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00374     static  ExecStatus post(Home home, View x0, View x1, CtrlView b);
00375   };
00376 
00377 }}}
00378 
00379 #include <gecode/float/rel/eq.hpp>
00380 #include <gecode/float/rel/nq.hpp>
00381 #include <gecode/float/rel/lq-le.hpp>
00382 
00383 #endif
00384 
00385 
00386 // STATISTICS: float-prop
00387