/usr/include/gecode/set/rel-op.hh is in libgecode-dev 4.2.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
* Main authors:
* Guido Tack <tack@gecode.org>
* Christian Schulte <schulte@gecode.org>
*
* Contributing authors:
* Gabor Szokoli <szokoli@gecode.org>
*
* Copyright:
* Guido Tack, 2004
* Christian Schulte, 2004
* Gabor Szokoli, 2004
*
* Last modified:
* $Date: 2009-10-12 17:36:53 +0200 (Mon, 12 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 <gecode/set.hh>
#include <gecode/set/rel.hh>
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 <gecode/set/rel-op.hh> \endcode
* \ingroup FuncSetProp
*/
template<class View0, class View1, class View2>
class SuperOfInter :
public MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
View2,PC_SET_CLUB> {
protected:
using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
View2,PC_SET_CLUB>::x0;
using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
View2,PC_SET_CLUB>::x1;
using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
View2,PC_SET_CLUB>::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 <gecode/set/rel-op.hh> \endcode
* \ingroup FuncSetProp
*/
template<class View0, class View1, class View2>
class SubOfUnion :
public MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
View2,PC_SET_ANY> {
protected:
using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
View2,PC_SET_ANY>::x0;
using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
View2,PC_SET_ANY>::x1;
using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
View2,PC_SET_ANY>::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 <gecode/set/rel-op.hh> \endcode
* \ingroup FuncSetProp
*/
template<class View0, class View1, class View2>
class Intersection:
public MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
View2,PC_SET_ANY> {
protected:
using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
View2,PC_SET_ANY>::x0;
using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
View2,PC_SET_ANY>::x1;
using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
View2,PC_SET_ANY>::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 <gecode/set/rel-op.hh> \endcode
* \ingroup FuncSetProp
*/
template<class View0, class View1, class View2>
class Union:
public MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
View2,PC_SET_ANY> {
protected:
using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
View2,PC_SET_ANY>::x0;
using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
View2,PC_SET_ANY>::x1;
using MixTernaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY,
View2,PC_SET_ANY>::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 <gecode/set/rel-op.hh> \endcode
* \ingroup FuncSetProp
*/
template<class View0, class View1>
class IntersectionN :
public MixNaryOnePropagator<View0,PC_SET_ANY,View1,PC_SET_ANY> {
protected:
using MixNaryOnePropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::x;
using MixNaryOnePropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::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<View0>&, View1);
/// Constructor for posting
IntersectionN(Home home,ViewArray<View0>&, 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<View0>& 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<View0>& y,
const IntSet& z,View1 x);
};
/**
* \brief %Propagator for nary union
*
* Requires \code #include <gecode/set/rel-op.hh> \endcode
* \ingroup FuncSetProp
*/
template<class View0, class View1>
class UnionN : public MixNaryOnePropagator<View0,PC_SET_ANY,
View1,PC_SET_ANY> {
protected:
using MixNaryOnePropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::x;
using MixNaryOnePropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::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<View0>&,View1);
/// Constructor for posting
UnionN(Home home,ViewArray<View0>&,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<View0>& 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<View0>& y,
const IntSet& z,View1 x);
};
/**
* \brief %Propagator for nary partition
*
* Requires \code #include <gecode/set/rel-op.hh> \endcode
* \ingroup FuncSetProp
*/
template<class View0, class View1>
class PartitionN : public MixNaryOnePropagator<View0,PC_SET_ANY,
View1,PC_SET_ANY> {
protected:
using MixNaryOnePropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::x;
using MixNaryOnePropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::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<View0>&, View1);
/// Constructor for posting
PartitionN(Home home,ViewArray<View0>&, 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<View0>& 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<View0>& y,
const IntSet& z,View1 x);
};
}}}
#include <gecode/set/rel-op/common.hpp>
#include <gecode/set/rel-op/superofinter.hpp>
#include <gecode/set/rel-op/subofunion.hpp>
#include <gecode/set/rel-op/inter.hpp>
#include <gecode/set/rel-op/union.hpp>
#include <gecode/set/rel-op/partition.hpp>
#include <gecode/set/rel-op/post.hpp>
#endif
// STATISTICS: set-prop
|