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

sequence.hh

Go to the documentation of this file.
00001 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
00002 /*
00003  *  Main authors:
00004  *     David Rijsman <David.Rijsman@quintiq.com>
00005  *
00006  *  Copyright:
00007  *     David Rijsman, 2009
00008  *
00009  *  Last modified:
00010  *     $Date: 2010-04-08 12:35:31 +0200 (Thu, 08 Apr 2010) $
00011  *     $Revision: 10684 $
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_INT_SEQUENCE_HH__
00039 #define __GECODE_INT_SEQUENCE_HH__
00040 
00041 #include <gecode/int.hh>
00042 #include <gecode/int/rel.hh>
00043 
00044 namespace Gecode { namespace Int { namespace Sequence {
00045 
00058   template<class View> 
00059   class SupportAdvisor;
00060 
00061   template<class View,class Val,bool iss> 
00062   class ViewValSupport;
00063 
00068   template<class View, class Val,bool iss>
00069   class ViewValSupportArray {
00070   private:
00072     ViewValSupport<View,Val,iss>* xs;
00074     int n;
00075   public:
00077     ViewValSupportArray(void);
00079     ViewValSupportArray(const ViewValSupportArray<View,Val,iss>&);
00081     ViewValSupportArray(Space& home, ViewArray<View>&, Val s, int q);
00083     ViewValSupportArray(Space& home, int n);
00085     int size(void) const;
00087     ViewValSupport<View,Val,iss>& operator [](int n);
00089     const ViewValSupport<View,Val,iss>& operator [](int) const;
00091     void update(Space& home, bool share, ViewValSupportArray<View,Val,iss>& x);
00093     ExecStatus propagate(Space& home,ViewArray<View>& a,Val s,int q,int l,int u);
00095     ExecStatus advise(Space& home,ViewArray<View>& a,Val s,int q,int j,const Delta& d);
00096   };
00097 
00104   template<class View, class Val>
00105   class Sequence : public Propagator {
00106   protected:
00108     Sequence(Space& home, bool shared, Sequence& p);
00110     Sequence(Home home, ViewArray<View>& x, Val s, int q, int l, int u);
00111   public:
00113     virtual Actor* copy(Space& home, bool share);
00115     ExecStatus advise(Space& home, Advisor& _a, const Delta& d);
00117     virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00119     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00121     static  ExecStatus post(Home home, ViewArray<View>& x, Val s, int q, int l, int u);
00123     static  ExecStatus check(Space& home, ViewArray<View>& x, Val s, int q, int l, int u);
00125     virtual size_t dispose(Space& home);
00126   private:
00128     ViewArray<View> x;
00130     Val  s;
00132     int  q;
00134     int  l;
00136     int  u;
00138     ViewValSupportArray<View,Val,true>  vvsamax;
00140     ViewValSupportArray<View,Val,false> vvsamin;
00142     Council<SupportAdvisor<View> > ac;
00143   };
00144 
00145 }}}
00146 
00147 #include <gecode/int/sequence/set-op.hpp>
00148 #include <gecode/int/sequence/violations.hpp>
00149 #include <gecode/int/sequence/int.hpp>
00150 #include <gecode/int/sequence/view.hpp>
00151 
00152 #endif
00153 
00154 // STATISTICS: int-prop