| 121 | } |
| 122 | |
| 123 | void |
| 124 | path(Home home, int offset, const IntVarArgs& x, IntVar s, IntVar e, |
| 125 | IntPropLevel ipl) { |
| 126 | Int::Limits::nonnegative(offset,"Int::path"); |
| 127 | int n=x.size(); |
| 128 | if (n == 0) |
| 129 | throw Int::TooFewArguments("Int::path"); |
| 130 | if (same(x)) |
| 131 | throw Int::ArgumentSame("Int::path"); |
| 132 | GECODE_POST; |
| 133 | ViewArray<Int::IntView> xv(home,n+1); |
| 134 | for (int i=0; i<n; i++) |
| 135 | xv[i] = Int::IntView(x[i]); |
| 136 | xv[n] = s; |
| 137 | |
| 138 | if (offset == 0) { |
| 139 | element(home, x, e, n); |
| 140 | typedef Int::NoOffset<Int::IntView> NOV; |
| 141 | NOV no; |
| 142 | if (vbd(ipl) == IPL_DOM) { |
| 143 | GECODE_ES_FAIL((Int::Circuit::Dom<Int::IntView,NOV> |
| 144 | ::post(home,xv,no))); |
| 145 | } else { |
| 146 | GECODE_ES_FAIL((Int::Circuit::Val<Int::IntView,NOV> |
| 147 | ::post(home,xv,no))); |
| 148 | } |
| 149 | } else { |
| 150 | IntVarArgs ox(n+offset); |
| 151 | IntVar y(home, -1,-1); |
| 152 | for (int i=0; i<offset; i++) |
| 153 | ox[i] = y; |
| 154 | for (int i=0; i<n; i++) |
| 155 | ox[offset + i] = x[i]; |
| 156 | element(home, ox, e, offset+n); |
| 157 | typedef Int::Offset OV; |
| 158 | OV off(-offset); |
| 159 | if (vbd(ipl) == IPL_DOM) { |
| 160 | GECODE_ES_FAIL((Int::Circuit::Dom<Int::IntView,OV> |
| 161 | ::post(home,xv,off))); |
| 162 | } else { |
| 163 | GECODE_ES_FAIL((Int::Circuit::Val<Int::IntView,OV> |
| 164 | ::post(home,xv,off))); |
| 165 | } |
| 166 | } |
| 167 | } |
| 168 | void |
| 169 | path(Home home, const IntVarArgs& x, IntVar s, IntVar e, |
| 170 | IntPropLevel ipl) { |