/usr/include/gecode/int/no-overlap.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 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
* Main authors:
* Christian Schulte <schulte@gecode.org>
*
* Copyright:
* Christian Schulte, 2011
*
* Last modified:
* $Date: 2012-09-10 19:36:08 +0200 (Mon, 10 Sep 2012) $ by $Author: schulte $
* $Revision: 13072 $
*
* 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_INT_NO_OVERLAP_HH__
#define __GECODE_INT_NO_OVERLAP_HH__
#include <gecode/int.hh>
/**
* \namespace Gecode::Int::NoOverlap
* \brief %No-overlap propagators
*/
namespace Gecode { namespace Int { namespace NoOverlap {
/**
* \brief Dimension combining coordinate and integer size information
*/
class FixDim {
protected:
/// Coordinate
IntView c;
/// Size
int s;
/// Modify smallest start coordinate
ExecStatus ssc(Space& home, int n);
/// Modify largest end coordinate
ExecStatus lec(Space& home, int n);
/// Dimension must not overlap with coordinates \a n to \a m
ExecStatus nooverlap(Space& home, int n, int m);
public:
/// Default constructor
FixDim(void);
/// Constructor
FixDim(IntView c, int s);
/// Return smallest start coordinate
int ssc(void) const;
/// Return largest start coordinate
int lsc(void) const;
/// Return smallest end coordinate
int sec(void) const;
/// Return largest end coordinate
int lec(void) const;
/// Dimension must not overlap with \a d
ExecStatus nooverlap(Space& home, FixDim& d);
/// Update dimension during cloning
void update(Space& home, bool share, FixDim& d);
/// Subscribe propagator \a p to dimension
void subscribe(Space& home, Propagator& p);
/// Cancel propagator \a p from dimension
void cancel(Space& home, Propagator& p);
};
/**
* \brief Dimension combining coordinate and integer view size information
*/
class FlexDim {
protected:
/// Start coordinate
IntView c0;
/// Size
IntView s;
/// End coordinate
IntView c1;
/// Modify smallest start coordinate
ExecStatus ssc(Space& home, int n);
/// Modify largest end coordinate
ExecStatus lec(Space& home, int n);
/// Dimension must not overlap with coordinates \a n to \a m
ExecStatus nooverlap(Space& home, int n, int m);
public:
/// Default constructor
FlexDim(void);
/// Constructor
FlexDim(IntView c0, IntView s, IntView c1);
/// Return smallest start coordinate
int ssc(void) const;
/// Return largest start coordinate
int lsc(void) const;
/// Return smallest end coordinate
int sec(void) const;
/// Return largest end coordinate
int lec(void) const;
/// Dimension must not overlap with \a d
ExecStatus nooverlap(Space& home, FlexDim& d);
/// Update dimension during cloning
void update(Space& home, bool share, FlexDim& d);
/// Subscribe propagator \a p to dimension
void subscribe(Space& home, Propagator& p);
/// Cancel propagator \a p from dimension
void cancel(Space& home, Propagator& p);
};
}}}
#include <gecode/int/no-overlap/dim.hpp>
namespace Gecode { namespace Int { namespace NoOverlap {
/**
* \brief Mandatory box class
*/
template<class Dim, int n>
class ManBox {
protected:
/// Dimensions
Dim d[n];
public:
/// Access to dimension \a i
const Dim& operator [](int i) const;
/// Access to dimension \a i
Dim& operator [](int i);
/// Return number of dimensions
static int dim(void);
/// Whether box is mandatory
bool mandatory(void) const;
/// Whether box is optional
bool optional(void) const;
/// Whether box is excluded
bool excluded(void) const;
/// Exclude box
ExecStatus exclude(Space& home);
/// Check whether this box does not any longer overlap with \a b
bool nooverlap(const ManBox<Dim,n>& b) const;
/// Check whether this box overlaps with \a b
bool overlap(const ManBox<Dim,n>& b) const;
/// Propagate that this box does not overlap with \a b
ExecStatus nooverlap(Space& home, ManBox<Dim,n>& b);
/// Update box during cloning
void update(Space& home, bool share, ManBox<Dim,n>& r);
/// Subscribe propagator \a p to box
void subscribe(Space& home, Propagator& p);
/// Cancel propagator \a p from box
void cancel(Space& home, Propagator& p);
};
/**
* \brief Optional box class
*/
template<class Dim, int n>
class OptBox : public ManBox<Dim,n> {
protected:
using ManBox<Dim,n>::d;
/// Whether box is optional or not
BoolView o;
public:
/// Set Boolean view to \a o
void optional(BoolView o);
/// Whether box is mandatory
bool mandatory(void) const;
/// Whether box is optional
bool optional(void) const;
/// Whether box is excluded
bool excluded(void) const;
/// Exclude box
ExecStatus exclude(Space& home);
/// Update box during cloning
void update(Space& home, bool share, OptBox<Dim,n>& r);
/// Subscribe propagator \a p to box
void subscribe(Space& home, Propagator& p);
/// Cancel propagator \a p from box
void cancel(Space& home, Propagator& p);
};
}}}
#include <gecode/int/no-overlap/box.hpp>
namespace Gecode { namespace Int { namespace NoOverlap {
/**
* \brief Base class for no-overlap propagator
*
* Requires \code #include <gecode/int/no-overlap.hh> \endcode
*
* \ingroup FuncIntProp
*/
template<class Box>
class Base : public Propagator {
protected:
/// Boxes
Box* b;
/// Number of mandatory boxes: b[0] ... b[n-1]
int n;
/// Constructor for posting with \a n mandatory boxes
Base(Home home, Box* b, int n);
/// Constructor for cloning \a p with \a m boxes
Base(Space& home, bool share, Base<Box>& p, int m);
/**
* \brief Partition \a n boxes \a b starting at position \a i
*
* Returns the number of mandatory boxes at the front of \a b.
*/
static int partition(Box* b, int i, int n);
public:
/// Cost function
virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
/// Destructor
virtual size_t dispose(Space& home);
};
/**
* \brief No-overlap propagator for mandatory boxes
*
* Requires \code #include <gecode/int/no-overlap.hh> \endcode
*
* \ingroup FuncIntProp
*/
template<class Box>
class ManProp : public Base<Box> {
protected:
using Base<Box>::b;
using Base<Box>::n;
/// Constructor for posting
ManProp(Home home, Box* b, int n);
/// Constructor for cloning \a p
ManProp(Space& home, bool share, ManProp<Box>& p);
public:
/// Post propagator for boxes \a b
static ExecStatus post(Home home, Box* b, int n);
/// Perform propagation
virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
/// Copy propagator during cloning
virtual Actor* copy(Space& home, bool share);
/// Destructor
virtual size_t dispose(Space& home);
};
/**
* \brief No-overlap propagator for optional boxes
*
* Requires \code #include <gecode/int/no-overlap.hh> \endcode
*
* \ingroup FuncIntProp
*/
template<class Box>
class OptProp : public Base<Box> {
protected:
using Base<Box>::b;
using Base<Box>::n;
/// Number of optional boxes: b[n] ... b[n+m-1]
int m;
/// Constructor for posting
OptProp(Home home, Box* b, int n, int m);
/// Constructor for cloning \a p
OptProp(Space& home, bool share, OptProp<Box>& p);
public:
/// Post propagator for boxes \a b
static ExecStatus post(Home home, Box* b, int n);
/// Perform propagation
virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
/// Copy propagator during cloning
virtual Actor* copy(Space& home, bool share);
/// Destructor
virtual size_t dispose(Space& home);
};
}}}
#include <gecode/int/no-overlap/base.hpp>
#include <gecode/int/no-overlap/man.hpp>
#include <gecode/int/no-overlap/opt.hpp>
#endif
// STATISTICS: int-prop
|