Replace by fresh yet equal integer variables
| 54 | |
| 55 | /// Replace by fresh yet equal integer variables |
| 56 | forceinline void |
| 57 | link(Home home, IntVar** x, int n, IntPropLevel ipl) { |
| 58 | if (home.failed()) { |
| 59 | for (int i=1; i<n; i++) |
| 60 | *x[i]=IntVar(home,x[0]->min(),x[0]->min()); |
| 61 | } else if (n > 2) { |
| 62 | ViewArray<IntView> y(home,n); |
| 63 | y[0]=*x[0]; |
| 64 | for (int i=1; i<n; i++) |
| 65 | y[i]=*x[i]=IntVar(home,x[0]->min(),x[0]->max()); |
| 66 | if ((ipl == IPL_DOM) || (ipl == IPL_DEF)) { |
| 67 | ExecStatus es = Rel::NaryEqDom<IntView>::post(home,y); |
| 68 | (void) es; assert(es == ES_OK); |
| 69 | } else { |
| 70 | ExecStatus es = Rel::NaryEqBnd<IntView>::post(home,y); |
| 71 | (void) es; assert(es == ES_OK); |
| 72 | } |
| 73 | } else if (n == 2) { |
| 74 | *x[1]=IntVar(home,x[0]->min(),x[0]->max()); |
| 75 | if ((ipl == IPL_DOM) || (ipl == IPL_DEF)) { |
| 76 | ExecStatus es = Rel::EqDom<IntView,IntView>::post(home,*x[0],*x[1]); |
| 77 | (void) es; assert(es == ES_OK); |
| 78 | } else { |
| 79 | ExecStatus es = Rel::EqBnd<IntView,IntView>::post(home,*x[0],*x[1]); |
| 80 | (void) es; assert(es == ES_OK); |
| 81 | } |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | /// Replace by fresh yet equal Boolean variables |
| 86 | forceinline void |