Generated on Mon Aug 25 11:35:43 2008 for Gecode by doxygen 1.5.6

propagator.hh

Go to the documentation of this file.
00001 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
00002 /*
00003  *  Main authors:
00004  *     Guido Tack <tack@gecode.org>
00005  *
00006  *  Copyright:
00007  *     Guido Tack, 2006
00008  *
00009  *  Last modified:
00010  *     $Date: 2008-01-29 13:37:51 +0100 (Tue, 29 Jan 2008) $ by $Author: tack $
00011  *     $Revision: 5993 $
00012  *
00013  *  This file is part of Gecode, the generic constraint
00014  *  development environment:
00015  *     http://www.gecode.org
00016  *
00017  *  Permission is hereby granted, free of charge, to any person obtaining
00018  *  a copy of this software and associated documentation files (the
00019  *  "Software"), to deal in the Software without restriction, including
00020  *  without limitation the rights to use, copy, modify, merge, publish,
00021  *  distribute, sublicense, and/or sell copies of the Software, and to
00022  *  permit persons to whom the Software is furnished to do so, subject to
00023  *  the following conditions:
00024  *
00025  *  The above copyright notice and this permission notice shall be
00026  *  included in all copies or substantial portions of the Software.
00027  *
00028  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00029  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00030  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00031  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00032  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00033  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00034  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00035  *
00036  */
00037 
00038 #ifndef __GECODE_GENERATOR_PROJECOTRS_HH
00039 #define __GECODE_GENERATOR_PROJECTORS_HH
00040 
00041 #include "gecode/set/projectors.hh"
00042 
00048 namespace Gecode { namespace Set { namespace Projection {
00049 
00053   template <bool negated>
00054   class NaryProjection : public Propagator {
00055   protected:
00057     ViewArray<SetView> x;
00059     SharedArray<PropCond> pc;
00061     ProjectorSet ps;
00063     NaryProjection(Space* home, bool share, NaryProjection& p);
00065     NaryProjection(Space* home, ViewArray<SetView>& x, ProjectorSet& ps);
00066   public:
00068     virtual PropCost cost(ModEventDelta med) const;
00070     virtual size_t dispose(Space* home);
00072     virtual Actor*      copy(Space* home,bool);
00074     virtual ExecStatus propagate(Space* home, ModEventDelta med);
00076     GECODE_SET_EXPORT
00077     virtual Reflection::ActorSpec spec(const Space* home,
00078                                         Reflection::VarMap& m) const;
00080     static Support::Symbol ati(void);
00081     static  ExecStatus post(Space* home, ViewArray<SetView>& x,
00082                             ProjectorSet& ps);
00083   };
00084 
00088   class ReNaryProjection : public Propagator {
00089   protected:
00091     ViewArray<SetView> x;
00093     Gecode::Int::BoolView b;
00095     ProjectorSet ps;
00097     ReNaryProjection(Space* home, bool share, ReNaryProjection& p);
00099     ReNaryProjection(Space* home,ViewArray<SetView>& x,
00100                      Gecode::Int::BoolView,
00101                      ProjectorSet& ps);
00102   public:
00104     virtual PropCost cost(ModEventDelta med) const;
00106     GECODE_SET_EXPORT virtual size_t dispose(Space* home);
00108     GECODE_SET_EXPORT virtual Actor* copy(Space* home,bool);
00110     GECODE_SET_EXPORT virtual ExecStatus propagate(Space* home, ModEventDelta med);
00112     GECODE_SET_EXPORT
00113     virtual Reflection::ActorSpec spec(const Space* home,
00114                                         Reflection::VarMap& m) const;
00116     static Support::Symbol ati(void);
00117     GECODE_SET_EXPORT static  ExecStatus post(Space* home,
00118                                               ViewArray<SetView>& x,
00119                                               Gecode::Int::BoolView b,
00120                                               ProjectorSet& ps);
00121   };
00122 
00126   class CardProjection : public Propagator {
00127   protected:
00129     ViewArray<SetView> x;
00131     Gecode::Int::IntView i;
00133     SharedArray<PropCond> pc;
00135     Projector proj;
00137     CardProjection(Space* home, bool share, CardProjection& p);
00139     CardProjection(Space* home, ViewArray<SetView>& x,
00140                    Gecode::Int::IntView i, Projector& ps);
00141   public:
00143     virtual PropCost cost(ModEventDelta med) const;
00145     virtual size_t dispose(Space* home);
00147     virtual Actor*      copy(Space* home,bool);
00149     virtual ExecStatus propagate(Space* home, ModEventDelta med);
00151     GECODE_SET_EXPORT
00152     virtual Reflection::ActorSpec spec(const Space* home,
00153                                         Reflection::VarMap& m) const;
00155     static Support::Symbol ati(void);
00156     static  ExecStatus post(Space* home, ViewArray<SetView>& x,
00157                             Gecode::Int::IntView i, Projector& p);
00158   };
00159   
00160 }}}
00161 
00162 #include "gecode/set/projectors/propagator/nary.icc"
00163 #include "gecode/set/projectors/propagator/re-nary.icc"
00164 #include "gecode/set/projectors/propagator/card.icc"
00165   
00166 #endif
00167 
00168 // STATISTICS: set-prop