Generated on Thu Apr 11 13:59:05 2019 for Gecode by doxygen 1.6.3

circuit.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  *
00006  *  Copyright:
00007  *     Christian Schulte, 2006
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_CIRCUIT_HH__
00035 #define __GECODE_INT_CIRCUIT_HH__
00036 
00037 #include <gecode/int.hh>
00038 #include <gecode/int/distinct.hh>
00039 
00045 namespace Gecode { namespace Int { namespace Circuit {
00046 
00054   template<class View, class Offset>
00055   class Base : public NaryPropagator<View,Int::PC_INT_DOM> {
00056   protected:
00057     using NaryPropagator<View,Int::PC_INT_DOM>::x;
00059     int start;
00061     ViewArray<View> y;
00063     Offset o;
00065     Base(Space& home, Base& p);
00067     Base(Home home, ViewArray<View>& x, Offset& o);
00069     ExecStatus connected(Space& home);
00071     ExecStatus path(Space& home);
00072   public:
00074     virtual size_t dispose(Space& home);
00075   };
00076 
00087   template<class View, class Offset>
00088   class Val : public Base<View,Offset> {
00089   protected:
00090     using Base<View,Offset>::x;
00091     using Base<View,Offset>::y;
00092     using Base<View,Offset>::connected;
00093     using Base<View,Offset>::path;
00094     using Base<View,Offset>::o;
00096     Val(Space& home, Val& p);
00098     Val(Home home, ViewArray<View>& x, Offset& o);
00099   public:
00101     virtual Actor* copy(Space& home);
00103     virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00105     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00107     static  ExecStatus post(Home home, ViewArray<View>& x, Offset& o);
00108   };
00109 
00120   template<class View, class Offset>
00121   class Dom : public Base<View,Offset> {
00122   protected:
00123     using Base<View,Offset>::x;
00124     using Base<View,Offset>::y;
00125     using Base<View,Offset>::connected;
00126     using Base<View,Offset>::path;
00127     using Base<View,Offset>::o;
00129     Int::Distinct::DomCtrl<View> dc;
00131     Dom(Space& home, Dom& p);
00133     Dom(Home home, ViewArray<View>& x, Offset& o);
00134   public:
00136     virtual Actor* copy(Space& home);
00143     virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00145     virtual void reschedule(Space& home);
00147     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00149     static  ExecStatus post(Home home, ViewArray<View>& x, Offset& o);
00150   };
00151 
00152 }}}
00153 
00154 #include <gecode/int/circuit/base.hpp>
00155 #include <gecode/int/circuit/val.hpp>
00156 #include <gecode/int/circuit/dom.hpp>
00157 
00158 #endif
00159 
00160 // STATISTICS: int-prop