Generated on Thu Mar 22 10:39:38 2012 for Gecode by doxygen 1.6.3

gcc.hh

Go to the documentation of this file.
00001 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
00002 /*
00003  *  Main authors:
00004  *     Patrick Pekczynski <pekczynski@ps.uni-sb.de>
00005  *
00006  *  Contributing authors:
00007  *     Christian Schulte <schulte@gecode.org>
00008  *     Guido Tack <tack@gecode.org>
00009  *
00010  *  Copyright:
00011  *     Patrick Pekczynski, 2004/2005
00012  *     Christian Schulte, 2009
00013  *     Guido Tack, 2009
00014  *
00015  *  Last modified:
00016  *     $Date: 2009-10-12 17:36:53 +0200 (Mon, 12 Oct 2009) $ by $Author: schulte $
00017  *     $Revision: 9878 $
00018  *
00019  *  This file is part of Gecode, the generic constraint
00020  *  development environment:
00021  *     http://www.gecode.org
00022  *
00023  *  Permission is hereby granted, free of charge, to any person obtaining
00024  *  a copy of this software and associated documentation files (the
00025  *  "Software"), to deal in the Software without restriction, including
00026  *  without limitation the rights to use, copy, modify, merge, publish,
00027  *  distribute, sublicense, and/or sell copies of the Software, and to
00028  *  permit persons to whom the Software is furnished to do so, subject to
00029  *  the following conditions:
00030  *
00031  *  The above copyright notice and this permission notice shall be
00032  *  included in all copies or substantial portions of the Software.
00033  *
00034  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00035  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00036  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00037  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00038  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00039  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00040  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00041  *
00042  */
00043 
00044 #ifndef __GECODE_INT_GCC_HH__
00045 #define __GECODE_INT_GCC_HH__
00046 
00047 #include <gecode/int.hh>
00048 
00054 #include <gecode/int/gcc/view.hpp>
00055 #include <gecode/int/gcc/bnd-sup.hpp>
00056 #include <gecode/int/gcc/dom-sup.hpp>
00057 
00058 namespace Gecode { namespace Int { namespace GCC {
00059 
00066   template<class Card>
00067   class Val : public Propagator {
00068   protected:
00070     ViewArray<IntView> x;
00072     ViewArray<Card> k;
00074     Val(Home home, ViewArray<IntView>& x, ViewArray<Card>& k);
00076     Val(Space& home, bool share, Val<Card>& p);
00077   public:
00079     virtual Actor* copy(Space& home, bool share);
00081     virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00083     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00085     virtual size_t dispose(Space& home);
00087     static ExecStatus post(Home home,
00088                            ViewArray<IntView>& x, ViewArray<Card>& k);
00089   };
00090 
00114   template<class Card>
00115   class Bnd : public Propagator {
00116   protected:
00118     ViewArray<IntView> x;
00120     ViewArray<IntView> y;
00122     ViewArray<Card> k;
00128     PartialSum<Card> lps;
00130     PartialSum<Card> ups;
00137     bool card_fixed;
00143     bool skip_lbc;
00145     Bnd(Space& home, bool share, Bnd<Card>& p);
00146 
00148     ExecStatus pruneCards(Space& home);
00149 
00168     ExecStatus lbc(Space& home, int& nb, HallInfo hall[], Rank rank[],
00169                    int mu[], int nu[]);
00170 
00189     ExecStatus ubc(Space& home, int& nb, HallInfo hall[], Rank rank[],
00190                    int mu[], int nu[]);
00192     Bnd(Home home, ViewArray<IntView>&, ViewArray<Card>&, bool, bool);
00193   public:
00195     virtual Actor* copy(Space& home, bool share);
00197     virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00199     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00201     virtual size_t dispose(Space& home);
00203     static ExecStatus post(Home home,
00204                            ViewArray<IntView>& x, ViewArray<Card>& k);
00205   };
00206 
00218   template<class Card>
00219   class Dom : public Propagator {
00220   protected:
00222     ViewArray<IntView> x;
00227     ViewArray<IntView> y;
00229     ViewArray<Card> k;
00231     VarValGraph<Card>* vvg;
00238     bool card_fixed;
00240     Dom(Space& home, bool share, Dom<Card>& p);
00242     Dom(Home home, ViewArray<IntView>&, ViewArray<Card>&, bool);
00243   public:
00245     virtual Actor* copy(Space& home, bool share);
00247     virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00249     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00251     virtual size_t dispose(Space& home);
00253     static ExecStatus post(Home home,
00254                            ViewArray<IntView>& x, ViewArray<Card>& k);
00255   };
00256 
00257 }}}
00258 
00259 #include <gecode/int/gcc/post.hpp>
00260 #include <gecode/int/gcc/val.hpp>
00261 #include <gecode/int/gcc/bnd.hpp>
00262 #include <gecode/int/gcc/dom.hpp>
00263 
00264 #endif
00265 
00266 
00267 // STATISTICS: int-prop
00268