/usr/include/gecode/set/rel/nq.hpp is in libgecode-dev 5.1.0-2build1.
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 | /* -*- 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: 2010-06-07 14:18:14 +0200 (Mon, 07 Jun 2010) $ by $Author: tack $
* $Revision: 11048 $
*
* 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.
*
*/
namespace Gecode { namespace Set { namespace Rel {
template<class View0, class View1>
forceinline
Distinct<View0,View1>::Distinct(Home home, View0 x, View1 y)
: MixBinaryPropagator<View0, PC_SET_VAL, View1, PC_SET_VAL>(home,x,y) {}
template<class View0, class View1>
forceinline
Distinct<View0,View1>::Distinct(Space& home, bool share, Distinct& p)
: MixBinaryPropagator<View0, PC_SET_VAL, View1, PC_SET_VAL>
(home,share,p) {}
template<class View0, class View1>
ExecStatus
Distinct<View0,View1>::post(Home home, View0 x, View1 y) {
if (x.assigned()) {
GlbRanges<View0> xr(x);
IntSet xs(xr);
ConstSetView cv(home, xs);
GECODE_ES_CHECK((DistinctDoit<View1>::post(home,y,cv)));
}
if (y.assigned()) {
GlbRanges<View1> yr(y);
IntSet ys(yr);
ConstSetView cv(home, ys);
GECODE_ES_CHECK((DistinctDoit<View0>::post(home,x,cv)));
}
(void) new (home) Distinct<View0,View1>(home,x,y);
return ES_OK;
}
template<class View0, class View1>
Actor*
Distinct<View0,View1>::copy(Space& home, bool share) {
return new (home) Distinct<View0,View1>(home,share,*this);
}
template<class View0, class View1>
ExecStatus
Distinct<View0,View1>::propagate(Space& home, const ModEventDelta&) {
assert(x0.assigned()||x1.assigned());
if (x0.assigned()) {
GlbRanges<View0> xr(x0);
IntSet xs(xr);
ConstSetView cv(home, xs);
GECODE_REWRITE(*this,(DistinctDoit<View1>::post(home(*this),x1,cv)));
} else {
GlbRanges<View1> yr(x1);
IntSet ys(yr);
ConstSetView cv(home, ys);
GECODE_REWRITE(*this,(DistinctDoit<View0>::post(home(*this),x0,cv)));
}
}
template<class View0>
ExecStatus
DistinctDoit<View0>::post(Home home, View0 x, ConstSetView y) {
(void) new (home) DistinctDoit<View0>(home,x,y);
return ES_OK;
}
template<class View0>
Actor*
DistinctDoit<View0>::copy(Space& home, bool share) {
return new (home) DistinctDoit<View0>(home,share,*this);
}
template<class View0>
ExecStatus
DistinctDoit<View0>::propagate(Space& home, const ModEventDelta&) {
if (x0.assigned()) {
GlbRanges<View0> xi(x0);
GlbRanges<ConstSetView> yi(y);
if (Iter::Ranges::equal(xi,yi)) { return ES_FAILED; }
else { return home.ES_SUBSUMED(*this); }
}
assert(x0.lubSize()-x0.glbSize() >0);
if (x0.cardMin()>y.cardMax()) { return home.ES_SUBSUMED(*this); }
if (x0.cardMax()<y.cardMin()) { return home.ES_SUBSUMED(*this); }
//These tests are too expensive, we should only do them
//in the 1 unknown left case.
GlbRanges<View0> xi1(x0);
LubRanges<ConstSetView> yi1(y);
if (!Iter::Ranges::subset(xi1,yi1)){ return home.ES_SUBSUMED(*this); }
LubRanges<View0> xi2(x0);
GlbRanges<ConstSetView> yi2(y);
if (!Iter::Ranges::subset(yi2,xi2)){ return home.ES_SUBSUMED(*this); }
// from here, we know y\subseteq lub(x) and glb(x)\subseteq y
if (x0.lubSize() == y.cardMin() && x0.lubSize() > 0) {
GECODE_ME_CHECK(x0.cardMax(home, x0.lubSize() - 1));
return home.ES_SUBSUMED(*this);
}
if (x0.glbSize() == y.cardMin()) {
GECODE_ME_CHECK(x0.cardMin(home, x0.glbSize() + 1));
return home.ES_SUBSUMED(*this);
}
return ES_FIX;
}
template<class View0>
forceinline
DistinctDoit<View0>::DistinctDoit(Home home, View0 _x, ConstSetView _y)
: UnaryPropagator<View0, PC_SET_ANY>(home,_x), y(_y) {}
template<class View0>
forceinline
DistinctDoit<View0>::DistinctDoit(Space& home, bool share,
DistinctDoit<View0>& p)
: UnaryPropagator<View0, PC_SET_ANY>(home,share,p) {
y.update(home,share,p.y);
}
}}}
// STATISTICS: set-prop
|