Generated on Thu Apr 11 13:59:12 2019 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  *  This file is part of Gecode, the generic constraint
00010  *  development environment:
00011  *     http://www.gecode.org
00012  *
00013  *  Permission is hereby granted, free of charge, to any person obtaining
00014  *  a copy of this software and associated documentation files (the
00015  *  "Software"), to deal in the Software without restriction, including
00016  *  without limitation the rights to use, copy, modify, merge, publish,
00017  *  distribute, sublicense, and/or sell copies of the Software, and to
00018  *  permit persons to whom the Software is furnished to do so, subject to
00019  *  the following conditions:
00020  *
00021  *  The above copyright notice and this permission notice shall be
00022  *  included in all copies or substantial portions of the Software.
00023  *
00024  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00025  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00026  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00027  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00028  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00029  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00030  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00031  *
00032  */
00033 
00034 #ifndef __GECODE_INT_SEQUENCE_HH__
00035 #define __GECODE_INT_SEQUENCE_HH__
00036 
00037 #include <gecode/int.hh>
00038 #include <gecode/int/rel.hh>
00039 
00040 namespace Gecode { namespace Int { namespace Sequence {
00041 
00054   template<class View>
00055   class SupportAdvisor;
00056 
00057   template<class View,class Val,bool iss>
00058   class ViewValSupport;
00059 
00064   template<class View, class Val,bool iss>
00065   class ViewValSupportArray {
00066   private:
00068     ViewValSupport<View,Val,iss>* xs;
00070     int n;
00071   public:
00073     ViewValSupportArray(void);
00075     ViewValSupportArray(const ViewValSupportArray<View,Val,iss>&);
00077     ViewValSupportArray(Space& home, ViewArray<View>&, Val s, int q);
00079     ViewValSupportArray(Space& home, int n);
00081     int size(void) const;
00083     ViewValSupport<View,Val,iss>& operator [](int n);
00085     const ViewValSupport<View,Val,iss>& operator [](int) const;
00087     void update(Space& home, ViewValSupportArray<View,Val,iss>& x);
00089     ExecStatus propagate(Space& home,ViewArray<View>& a,Val s,int q,int l,int u);
00091     ExecStatus advise(Space& home,ViewArray<View>& a,Val s,int q,int j,const Delta& d);
00092   };
00093 
00100   template<class View, class Val>
00101   class Sequence : public Propagator {
00102   protected:
00104     Sequence(Space& home, Sequence& p);
00106     Sequence(Home home, ViewArray<View>& x, Val s, int q, int l, int u);
00107   public:
00109     virtual Actor* copy(Space& home);
00111     ExecStatus advise(Space& home, Advisor& _a, const Delta& d);
00113     virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00115     virtual void reschedule(Space& home);
00117     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00119     static  ExecStatus post(Home home, ViewArray<View>& x, Val s, int q, int l, int u);
00121     static  ExecStatus check(ViewArray<View>& x, Val s, int q, int l, int u);
00123     virtual size_t dispose(Space& home);
00124   private:
00126     ViewArray<View> x;
00128     Val  s;
00130     int  q;
00132     int  l;
00134     int  u;
00136     ViewValSupportArray<View,Val,true>  vvsamax;
00138     ViewValSupportArray<View,Val,false> vvsamin;
00140     Council<SupportAdvisor<View> > ac;
00142     bool tofail;
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