Post constraint on \a x
| 248 | } |
| 249 | /// Post constraint on \a x |
| 250 | virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) { |
| 251 | using namespace Gecode; |
| 252 | SetVarArgs s(home,8,IntSet::empty,1,1); |
| 253 | Gecode::rel(home, (singleton(1) == s[0]) == (x[0] != x[2])); |
| 254 | Gecode::rel(home, (singleton(1) == s[1]) == (x[1] == 1)); |
| 255 | Gecode::rel(home, (singleton(1) == s[2]) == (x[2] > 0)); |
| 256 | Gecode::rel(home, (singleton(1) == s[3]) == (x[3] == 1)); |
| 257 | |
| 258 | Gecode::rel(home, (singleton(1) == s[4]) == (x[4] != x[6])); |
| 259 | Gecode::rel(home, (singleton(1) == s[5]) == (x[5] == 1)); |
| 260 | Gecode::rel(home, (singleton(1) == s[6]) == (x[6] > 0)); |
| 261 | Gecode::rel(home, (singleton(1) == s[7]) == (x[7] == 1)); |
| 262 | |
| 263 | Gecode::SetExpr reg0[4] = {s[0],s[1],s[2],s[3]}; |
| 264 | Gecode::SetExpr e0 = eval(bis0,reg0); |
| 265 | |
| 266 | Gecode::SetExpr reg1[4] = {s[4],s[5],s[6],s[7]}; |
| 267 | Gecode::SetExpr e1 = eval(bis1,reg1); |
| 268 | |
| 269 | switch (srt) { |
| 270 | case Gecode::SRT_EQ: Gecode::rel(home, e0 == e1); break; |
| 271 | case Gecode::SRT_NQ: Gecode::rel(home, e0 != e1); break; |
| 272 | case Gecode::SRT_SUB: Gecode::rel(home, e0 <= e1); break; |
| 273 | case Gecode::SRT_SUP: Gecode::rel(home, e0 >= e1); break; |
| 274 | case Gecode::SRT_DISJ: Gecode::rel(home, e0 || e1); break; |
| 275 | case Gecode::SRT_CMPL: Gecode::rel(home, e0 == -e1); break; |
| 276 | default: GECODE_NEVER; |
| 277 | } |
| 278 | } |
| 279 | /// Post reified constraint on \a x |
| 280 | virtual void post(Gecode::Space& home, Gecode::IntVarArray& x, |
| 281 | Gecode::Reify r) { |