/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */ /* * Main authors: * Guido Tack * Christian Schulte * * Contributing authors: * Gabor Szokoli * * Copyright: * Guido Tack, 2004 * Christian Schulte, 2004 * Gabor Szokoli, 2004 * * Last modified: * $Date: 2009-10-13 02:36:53 +1100 (Tue, 13 Oct 2009) $ by $Author: schulte $ * $Revision: 9878 $ * * This file is part of Gecode, the generic constraint * development environment: * http://www.gecode.org * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ #ifndef __GECODE_SET_RELOP_HH__ #define __GECODE_SET_RELOP_HH__ #include #include namespace Gecode { namespace Set { namespace RelOp { /** * \namespace Gecode::Set::RelOp * \brief Standard set operation propagators */ /** * \brief %Propagator for the superset of intersection * * Requires \code #include \endcode * \ingroup FuncSetProp */ template class SuperOfInter : public MixTernaryPropagator { protected: using MixTernaryPropagator::x0; using MixTernaryPropagator::x1; using MixTernaryPropagator::x2; /// Constructor for cloning \a p SuperOfInter(Space& home, bool share,SuperOfInter& p); /// Constructor for posting SuperOfInter(Home home,View0, View1, View2); public: /// Copy propagator during cloning virtual Actor* copy(Space& home,bool); /// Perform propagation virtual ExecStatus propagate(Space& home, const ModEventDelta& med); /// Post propagator \f$ z \supseteq x \cap y\f$ static ExecStatus post(Home home, View0 x, View1 y, View2 z); }; /** * \brief %Propagator for the subset of union * * Requires \code #include \endcode * \ingroup FuncSetProp */ template class SubOfUnion : public MixTernaryPropagator { protected: using MixTernaryPropagator::x0; using MixTernaryPropagator::x1; using MixTernaryPropagator::x2; /// Constructor for cloning \a p SubOfUnion(Space& home, bool share,SubOfUnion& p); /// Constructor for posting SubOfUnion(Home home,View0, View1, View2); public: /// Copy propagator during cloning virtual Actor* copy(Space& home,bool); /// Perform propagation virtual ExecStatus propagate(Space& home, const ModEventDelta& med); /// Post propagator \f$ z \subseteq x \cap y\f$ static ExecStatus post(Home home,View0 x,View1 y,View2 z); }; /** * \brief %Propagator for ternary intersection * * Requires \code #include \endcode * \ingroup FuncSetProp */ template class Intersection: public MixTernaryPropagator { protected: using MixTernaryPropagator::x0; using MixTernaryPropagator::x1; using MixTernaryPropagator::x2; /// Constructor for cloning \a p Intersection(Space& home, bool share,Intersection& p); /// Constructor for posting Intersection(Home home,View0,View1,View2); public: /// Copy propagator during cloning virtual Actor* copy(Space& home,bool); /// Perform propagation virtual ExecStatus propagate(Space& home, const ModEventDelta& med); /// Post propagator \f$ z=x\cap y\f$ static ExecStatus post(Home home,View0 x,View1 y,View2 z); }; /** * \brief %Propagator for ternary union * * Requires \code #include \endcode * \ingroup FuncSetProp */ template class Union: public MixTernaryPropagator { protected: using MixTernaryPropagator::x0; using MixTernaryPropagator::x1; using MixTernaryPropagator::x2; /// Constructor for cloning \a p Union(Space& home, bool share,Union& p); /// Constructor for posting Union(Home home,View0,View1,View2); public: /// Copy propagator during cloning virtual Actor* copy(Space& home,bool); /// Perform propagation virtual ExecStatus propagate(Space& home, const ModEventDelta& med); /// Post propagator \f$ z=x\cup y\f$ static ExecStatus post(Home home,View0 x,View1 y,View2 z); }; /** * \brief %Propagator for nary intersection * * Requires \code #include \endcode * \ingroup FuncSetProp */ template class IntersectionN : public MixNaryOnePropagator { protected: using MixNaryOnePropagator::x; using MixNaryOnePropagator::y; /// Whether the any views share a variable implementation bool shared; /// Intersection of the determined \f$x_i\f$ (which are dropped) LUBndSet intOfDets; /// Constructor for cloning \a p IntersectionN(Space& home, bool share,IntersectionN& p); /// Constructor for posting IntersectionN(Home home,ViewArray&, View1); /// Constructor for posting IntersectionN(Home home,ViewArray&, const IntSet&, View1); public: virtual PropCost cost(const Space& home, const ModEventDelta& med) const; /// Copy propagator during cloning virtual Actor* copy(Space& home,bool); /// Perform propagation virtual ExecStatus propagate(Space& home, const ModEventDelta& med); /// Post propagator \f$ x = \bigcap_{i\in\{0,\dots,n-1\}} y_i \f$ static ExecStatus post(Home home,ViewArray& y,View1 x); /// Post propagator \f$ x = z\cap\bigcap_{i\in\{0,\dots,n-1\}} y_i \f$ static ExecStatus post(Home home,ViewArray& y, const IntSet& z,View1 x); }; /** * \brief %Propagator for nary union * * Requires \code #include \endcode * \ingroup FuncSetProp */ template class UnionN : public MixNaryOnePropagator { protected: using MixNaryOnePropagator::x; using MixNaryOnePropagator::y; /// Whether the any views share a variable implementation bool shared; /// Union of the determined \f$x_i\f$ (which are dropped) GLBndSet unionOfDets; /// Constructor for cloning \a p UnionN(Space& home, bool share,UnionN& p); /// Constructor for posting UnionN(Home home,ViewArray&,View1); /// Constructor for posting UnionN(Home home,ViewArray&,const IntSet&,View1); public: /// Copy propagator during cloning virtual Actor* copy(Space& home, bool); /// Perform propagation virtual ExecStatus propagate(Space& home, const ModEventDelta& med); virtual PropCost cost(const Space& home, const ModEventDelta& med) const; /// Post propagator \f$ x = \bigcup_{i\in\{0,\dots,n-1\}} y_i \f$ static ExecStatus post(Home home,ViewArray& y,View1 x); /// Post propagator \f$ x = z\cup\bigcup_{i\in\{0,\dots,n-1\}} y_i \f$ static ExecStatus post(Home home,ViewArray& y, const IntSet& z,View1 x); }; /** * \brief %Propagator for nary partition * * Requires \code #include \endcode * \ingroup FuncSetProp */ template class PartitionN : public MixNaryOnePropagator { protected: using MixNaryOnePropagator::x; using MixNaryOnePropagator::y; /// Whether the any views share a variable implementation bool shared; /// Union of the determined \f$x_i\f$ (which are dropped) GLBndSet unionOfDets; /// Constructor for cloning \a p PartitionN(Space& home, bool share,PartitionN& p); /// Constructor for posting PartitionN(Home home,ViewArray&, View1); /// Constructor for posting PartitionN(Home home,ViewArray&, const IntSet&, View1); public: /// Copy propagator during cloning virtual Actor* copy(Space& home,bool); /// Perform propagation virtual ExecStatus propagate(Space& home, const ModEventDelta& med); virtual PropCost cost(const Space& home, const ModEventDelta& med) const; /// Post propagator \f$ x = \biguplus_{i\in\{0,\dots,n-1\}} y_i \f$ static ExecStatus post(Home home,ViewArray& y,View1 x); /// Post propagator \f$ x = z\uplus\biguplus_{i\in\{0,\dots,n-1\}} y_i \f$ static ExecStatus post(Home home,ViewArray& y, const IntSet& z,View1 x); }; }}} #include #include #include #include #include #include #include #endif // STATISTICS: set-prop