/usr/include/gecode/set/rel-op/post.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 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 | /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
* Main authors:
* Guido Tack <tack@gecode.org>
*
* Contributing authors:
* Gabor Szokoli <szokoli@gecode.org>
*
* Copyright:
* Guido Tack, 2004, 2005
*
* Last modified:
* $Date: 2011-08-24 16:34:16 +0200 (Wed, 24 Aug 2011) $ by $Author: tack $
* $Revision: 12346 $
*
* 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.
*
*/
#include <gecode/set.hh>
#include <gecode/set/rel.hh>
#include <gecode/set/rel-op.hh>
namespace Gecode { namespace Set { namespace RelOp {
template<class View0, class View1, class Res>
forceinline void
rel_eq(Home home, View0 x0, SetOpType op, View1 x1, Res x2) {
switch(op) {
case SOT_DUNION:
{
EmptyView emptyset;
GECODE_ES_FAIL((SuperOfInter<View0,View1,EmptyView>
::post(home, x0, x1, emptyset)));
// fall through to SOT_UNION
}
case SOT_UNION:
{
GECODE_ES_FAIL(
(Union<View0,View1,Res>
::post(home, x0, x1, x2)));
}
break;
case SOT_INTER:
{
GECODE_ES_FAIL((Intersection<View0,View1,Res>
::post(home, x0,x1,x2)));
}
break;
case SOT_MINUS:
{
ComplementView<View1> cx1(x1);
GECODE_ES_FAIL(
(Intersection<View0,
ComplementView<View1>,Res>
::post(home,x0,cx1,x2)));
}
break;
}
}
template<class View0, class View1, class View2>
forceinline void
rel_sub(Home home, View0 x0, SetOpType op, View1 x1, View2 x2) {
switch(op) {
case SOT_DUNION:
{
EmptyView emptyset;
GECODE_ES_FAIL((SuperOfInter<View0,View1,EmptyView>
::post(home, x0, x1, emptyset)));
// fall through to SOT_UNION
}
case SOT_UNION:
{
SetVar tmp(home);
GECODE_ES_FAIL(
(Rel::Subset<SetView,View2>::post(home,tmp,x2)));
GECODE_ES_FAIL(
(Union<View0,View1,SetView>
::post(home, x0, x1, tmp)));
}
break;
case SOT_INTER:
{
GECODE_ES_FAIL((SuperOfInter<View0,View1,View2>
::post(home, x0,x1,x2)));
}
break;
case SOT_MINUS:
{
ComplementView<View1> cx1(x1);
GECODE_ES_FAIL(
(SuperOfInter<View0,
ComplementView<View1>,View2>
::post(home,x0,cx1,x2)));
}
break;
}
}
template<class View0, class View1, class View2>
forceinline void
rel_sup(Home home, View0 x0, SetOpType op, View1 x1, View2 x2) {
switch(op) {
case SOT_DUNION:
{
EmptyView emptyset;
GECODE_ES_FAIL((SuperOfInter<View0,View1,EmptyView>
::post(home, x0, x1, emptyset)));
// fall through to SOT_UNION
}
case SOT_UNION:
{
GECODE_ES_FAIL(
(SubOfUnion<View0,View1,View2>
::post(home, x0, x1, x2)));
}
break;
case SOT_INTER:
{
SetVar tmp(home);
GECODE_ES_FAIL(
(Rel::Subset<View2,SetView>::post(home,x2,tmp)));
GECODE_ES_FAIL((Intersection<View0,View1,SetView>
::post(home, x0,x1,tmp)));
}
break;
case SOT_MINUS:
{
SetVar tmp(home);
GECODE_ES_FAIL(
(Rel::Subset<View2,SetView>::post(home,x2,tmp)));
ComplementView<View1> cx1(x1);
GECODE_ES_FAIL(
(Intersection<View0,
ComplementView<View1>,SetView>
::post(home,x0,cx1,tmp)));
}
break;
}
}
template<class View>
forceinline void
rel_op_post_lex(Home home, SetView x0, SetRelType r, View x1) {
switch (r) {
case SRT_LQ:
GECODE_ES_FAIL((Rel::Lq<SetView,View,false>::post(home,x0,x1)));
break;
case SRT_LE:
GECODE_ES_FAIL((Rel::Lq<SetView,View,true>::post(home,x0,x1)));
break;
case SRT_GQ:
GECODE_ES_FAIL((Rel::Lq<View,SetView,false>::post(home,x1,x0)));
break;
case SRT_GR:
GECODE_ES_FAIL((Rel::Lq<View,SetView,true>::post(home,x1,x0)));
break;
default:
throw UnknownRelation("Set::rel");
}
}
template<class View0, class View1, class View2>
forceinline void
rel_op_post_nocompl(Home home, View0 x, SetOpType op, View1 y,
SetRelType r, View2 z) {
if (home.failed()) return;
switch(r) {
case SRT_EQ:
rel_eq<View0,View1,View2>(home, x, op, y, z);
break;
case SRT_LQ: case SRT_LE: case SRT_GQ: case SRT_GR:
{
SetVar tmp(home,IntSet::empty,Set::Limits::min,Set::Limits::max);
rel_eq<View0,View1,SetView>(home, x, op, y, tmp);
rel_op_post_lex<View2>(home,tmp,r,z);
}
break;
case SRT_NQ:
{
SetVar tmp(home);
GECODE_ES_FAIL(
(Rel::Distinct<SetView,View2>
::post(home,tmp,z)));
rel_eq<View0,View1,SetView>(home, x, op, y, tmp);
}
break;
case SRT_SUB:
rel_sub<View0,View1,View2>(home, x, op, y, z);
break;
case SRT_SUP:
rel_sup<View0,View1,View2>(home, x, op, y, z);
break;
case SRT_DISJ:
{
SetVar tmp(home);
EmptyView emptyset;
GECODE_ES_FAIL((SuperOfInter<View2,SetView,EmptyView>
::post(home, z, tmp, emptyset)));
rel_eq<View0,View1,SetView>(home, x, op, y, tmp);
}
break;
default:
GECODE_NEVER;
}
}
GECODE_SET_EXPORT void
post_nocompl(Home home, SetView x, SetOpType op, SetView y,
SetRelType r, SetView z);
GECODE_SET_EXPORT void
post_nocompl(Home home, ConstSetView x, SetOpType op, SetView y,
SetRelType r, SetView z);
GECODE_SET_EXPORT void
post_nocompl(Home home, SetView x, SetOpType op, SetView y,
SetRelType r, ConstSetView z);
GECODE_SET_EXPORT void
post_nocompl(Home home, ConstSetView x, SetOpType op, SetView y,
SetRelType r, ConstSetView z);
GECODE_SET_EXPORT void
post_compl(Home home, SetView x, SetOpType op, SetView y, SetView z);
GECODE_SET_EXPORT void
post_compl(Home home, ConstSetView x, SetOpType op, SetView y, SetView z);
GECODE_SET_EXPORT void
post_compl(Home home, SetView x, SetOpType op, SetView y, ConstSetView z);
GECODE_SET_EXPORT void
post_compl(Home home, ConstSetView x, SetOpType op, SetView y,
ConstSetView z);
}}}
// STATISTICS: set-prop
|