Generated on Fri Oct 19 11:24:56 2018 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  *  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_REL_HH__
00043 #define __GECODE_FLOAT_REL_HH__
00044 
00045 #include <gecode/int.hh>
00046 #include <gecode/float.hh>
00047 
00052 namespace Gecode { namespace Float { namespace Rel {
00053 
00054   /*
00055    * Equality propagators
00056    *
00057    */
00058 
00065   template<class View0, class View1>
00066   class Eq :
00067     public MixBinaryPropagator<View0,PC_FLOAT_BND,View1,PC_FLOAT_BND> {
00068   protected:
00069     using MixBinaryPropagator<View0,PC_FLOAT_BND,View1,PC_FLOAT_BND>::x0;
00070     using MixBinaryPropagator<View0,PC_FLOAT_BND,View1,PC_FLOAT_BND>::x1;
00071 
00073     Eq(Space& home, Eq<View0,View1>& p);
00074   public:
00076     Eq(Home home, View0 x0, View1 x1);
00078     Eq(Space& home, Propagator& p, View0 x0, View1 x1);
00080     virtual Actor* copy(Space& home);
00082     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00084     static  ExecStatus post(Home home, View0 x0, View1 x1);
00085   };
00086 
00093   template<class View>
00094   class NaryEq : public NaryPropagator<View,PC_FLOAT_BND> {
00095   protected:
00096     using NaryPropagator<View,PC_FLOAT_BND>::x;
00097 
00099     NaryEq(Space& home, NaryEq<View>& p);
00101     NaryEq(Home home, ViewArray<View>&);
00102   public:
00104     virtual Actor* copy(Space& home);
00111     virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00113     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00115     static  ExecStatus post(Home home, ViewArray<View>& x);
00116   };
00117 
00124   template<class View, class CtrlView, ReifyMode rm>
00125   class ReEq : public Int::ReBinaryPropagator<View,PC_FLOAT_BND,CtrlView> {
00126   protected:
00127     using Int::ReBinaryPropagator<View,PC_FLOAT_BND,CtrlView>::x0;
00128     using Int::ReBinaryPropagator<View,PC_FLOAT_BND,CtrlView>::x1;
00129     using Int::ReBinaryPropagator<View,PC_FLOAT_BND,CtrlView>::b;
00130 
00132     ReEq(Space& home, ReEq& p);
00134     ReEq(Home home, View x0, View x1, CtrlView b);
00135   public:
00137     virtual Actor*     copy(Space& home);
00139     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00141     static  ExecStatus post(Home home, View x0, View x1, CtrlView b);
00142   };
00143 
00150   template<class View, class CtrlView, ReifyMode rm>
00151   class ReEqFloat : public Int::ReUnaryPropagator<View,PC_FLOAT_BND,CtrlView> {
00152   protected:
00153     using Int::ReUnaryPropagator<View,PC_FLOAT_BND,CtrlView>::x0;
00154     using Int::ReUnaryPropagator<View,PC_FLOAT_BND,CtrlView>::b;
00155 
00157     FloatVal c;
00159     ReEqFloat(Space& home, ReEqFloat& p);
00161     ReEqFloat(Home home, View x, FloatVal c, CtrlView b);
00162   public:
00164     virtual Actor* copy(Space& home);
00166     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00168     static  ExecStatus post(Home home, View x, FloatVal c, CtrlView b);
00169   };
00170 
00171 
00178   template<class View0, class View1>
00179   class Nq :
00180     public MixBinaryPropagator<View0,PC_FLOAT_VAL,View1,PC_FLOAT_VAL> {
00181   protected:
00182     using MixBinaryPropagator<View0,PC_FLOAT_VAL,View1,PC_FLOAT_VAL>::x0;
00183     using MixBinaryPropagator<View0,PC_FLOAT_VAL,View1,PC_FLOAT_VAL>::x1;
00184 
00186     Nq(Space& home, Nq<View0,View1>& p);
00187   public:
00189     Nq(Home home, View0 x0, View1 x1);
00191     Nq(Space& home, Propagator& p, View0 x0, View1 x1);
00193     virtual Actor* copy(Space& home);
00195     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00197     static  ExecStatus post(Home home, View0 x0, View1 x1);
00198   };
00199 
00206   template<class View>
00207   class NqFloat :
00208     public UnaryPropagator<View,PC_FLOAT_VAL> {
00209   protected:
00210     using UnaryPropagator<View,PC_FLOAT_VAL>::x0;
00211 
00213     FloatVal c;
00215     NqFloat(Space& home, NqFloat<View>& p);
00216   public:
00218     NqFloat(Home home, View x, FloatVal c);
00220     virtual Actor* copy(Space& home);
00222     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00224     static  ExecStatus post(Home home, View x0, FloatVal c);
00225   };
00226 
00227 
00228   /*
00229    * Order propagators
00230    *
00231    */
00232 
00240   template<class View>
00241   class Lq : public BinaryPropagator<View,PC_FLOAT_BND> {
00242   protected:
00243     using BinaryPropagator<View,PC_FLOAT_BND>::x0;
00244     using BinaryPropagator<View,PC_FLOAT_BND>::x1;
00245 
00247     Lq(Space& home, Lq& p);
00249     Lq(Home home, View x0, View x1);
00250   public:
00252     virtual Actor*     copy(Space& home);
00254     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00256     static  ExecStatus post(Home home, View x0, View x1);
00257   };
00258 
00266   template<class View>
00267   class Le : public BinaryPropagator<View,PC_FLOAT_BND> {
00268   protected:
00269     using BinaryPropagator<View,PC_FLOAT_BND>::x0;
00270     using BinaryPropagator<View,PC_FLOAT_BND>::x1;
00271 
00273     Le(Space& home, Le& p);
00275     Le(Home home, View x0, View x1);
00276   public:
00278     virtual Actor*     copy(Space& home);
00280     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00282     static  ExecStatus post(Home home, View x0, View x1);
00283   };
00284 
00285   /*
00286    * Reified order propagators
00287    *
00288    */
00289 
00297   template<class View, class CtrlView, ReifyMode rm>
00298   class ReLqFloat : public Int::ReUnaryPropagator<View,PC_FLOAT_BND,CtrlView> {
00299   protected:
00300     using Int::ReUnaryPropagator<View,PC_FLOAT_BND,CtrlView>::x0;
00301     using Int::ReUnaryPropagator<View,PC_FLOAT_BND,CtrlView>::b;
00302 
00304     FloatVal c;
00306     ReLqFloat(Space& home, ReLqFloat& p);
00308     ReLqFloat(Home home, View x, FloatVal c, CtrlView b);
00309   public:
00311     virtual Actor* copy(Space& home);
00313     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00315     static  ExecStatus post(Home home, View x, FloatVal c, CtrlView b);
00316    };
00317 
00325   template<class View, class CtrlView, ReifyMode rm>
00326   class ReLeFloat : public Int::ReUnaryPropagator<View,PC_FLOAT_BND,CtrlView> {
00327   protected:
00328     using Int::ReUnaryPropagator<View,PC_FLOAT_BND,CtrlView>::x0;
00329     using Int::ReUnaryPropagator<View,PC_FLOAT_BND,CtrlView>::b;
00330 
00332     FloatVal c;
00334     ReLeFloat(Space& home, ReLeFloat& p);
00336     ReLeFloat(Home home, View x, FloatVal c, CtrlView b);
00337   public:
00339     virtual Actor* copy(Space& home);
00341     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00343     static  ExecStatus post(Home home, View x, FloatVal c, CtrlView b);
00344    };
00345 
00353   template<class View, class CtrlView, ReifyMode rm>
00354   class ReLq : public Int::ReBinaryPropagator<View,PC_FLOAT_BND,CtrlView> {
00355   protected:
00356     using Int::ReBinaryPropagator<View,PC_FLOAT_BND,CtrlView>::x0;
00357     using Int::ReBinaryPropagator<View,PC_FLOAT_BND,CtrlView>::x1;
00358     using Int::ReBinaryPropagator<View,PC_FLOAT_BND,CtrlView>::b;
00359 
00361     ReLq(Space& home, ReLq& p);
00363     ReLq(Home home, View x0, View x1, CtrlView b);
00364   public:
00366     virtual Actor* copy(Space& home);
00368     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00370     static  ExecStatus post(Home home, View x0, View x1, CtrlView b);
00371   };
00372 
00373 }}}
00374 
00375 #include <gecode/float/rel/eq.hpp>
00376 #include <gecode/float/rel/nq.hpp>
00377 #include <gecode/float/rel/lq-le.hpp>
00378 
00379 #endif
00380 
00381 
00382 // STATISTICS: float-prop
00383