| 135 | using namespace Set::LDSB; |
| 136 | |
| 137 | void |
| 138 | branch(Home home, const SetVarArgs& x, |
| 139 | SetVarBranch vars, SetValBranch vals, |
| 140 | const Symmetries& syms, |
| 141 | SetBranchFilter bf, |
| 142 | SetVarValPrint vvp) { |
| 143 | using namespace Set; |
| 144 | if (home.failed()) return; |
| 145 | vars.expand(home,x); |
| 146 | ViewArray<SetView> xv(home,x); |
| 147 | ViewSel<SetView>* vs[1] = { |
| 148 | Branch::viewsel(home,vars) |
| 149 | }; |
| 150 | |
| 151 | // Construct mapping from each variable in the array to its index |
| 152 | // in the array. |
| 153 | VariableMap variableMap; |
| 154 | for (int i = 0 ; i < x.size() ; i++) |
| 155 | variableMap[x[i].varimp()] = i; |
| 156 | |
| 157 | // Convert the modelling-level Symmetries object into an array of |
| 158 | // SymmetryImp objects. |
| 159 | int n = syms.size(); |
| 160 | SymmetryImp<SetView>** array = |
| 161 | static_cast<Space&>(home).alloc<SymmetryImp<SetView>* >(n); |
| 162 | for (int i = 0 ; i < n ; i++) { |
| 163 | array[i] = createSetSym(home, syms[i], variableMap); |
| 164 | } |
| 165 | |
| 166 | postldsbsetbrancher<SetView,1,int,2> |
| 167 | (home,xv,vs,Branch::valselcommit(home,vals),array,n,bf,vvp); |
| 168 | } |
| 169 | |
| 170 | void |
| 171 | branch(Home home, const SetVarArgs& x, |