Post path constraint on \a x
| 124 | } |
| 125 | /// Post path constraint on \a x |
| 126 | virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) { |
| 127 | int n = x.size() - 2; |
| 128 | Gecode::IntVarArgs xx(n); |
| 129 | if (offset > 0) { |
| 130 | for (int i=n; i--;) |
| 131 | xx[i] = Gecode::expr(home, x[i]+offset); |
| 132 | Gecode::path(home, offset, xx, |
| 133 | Gecode::expr(home, x[n]+offset), |
| 134 | Gecode::expr(home, x[n+1]+offset),ipl); |
| 135 | } else { |
| 136 | for (int i=n; i--;) |
| 137 | xx[i] = x[i]; |
| 138 | Gecode::path(home, xx, x[n], x[n+1], ipl); |
| 139 | } |
| 140 | } |
| 141 | }; |
| 142 | |
| 143 | /// Simple test for circuit constraint with total cost |