Return choice
| 267 | } |
| 268 | /// Return choice |
| 269 | virtual Gecode::Choice* choice(Space& home) { |
| 270 | done = true; |
| 271 | Radiotherapy& rt = static_cast<Radiotherapy&>(home); |
| 272 | |
| 273 | std::cout << "*"; |
| 274 | |
| 275 | // Perform nested search for each row |
| 276 | bool fail = false; |
| 277 | for (int i=0; i<rt.rd.m; i++) { |
| 278 | // Create fresh clone for row i |
| 279 | Radiotherapy* row = static_cast<Radiotherapy*>(rt.clone()); |
| 280 | |
| 281 | // Branch over row i |
| 282 | branch(*row, getRow(row, index[i].idx), |
| 283 | INT_VAR_NONE(), INT_VAL_SPLIT_MIN()); |
| 284 | Search::Options o; o.clone = false; |
| 285 | if (Radiotherapy* newSol = dfs(row, o) ) { |
| 286 | // Found a solution for row i, so try to find one for i+1 |
| 287 | delete newSol; |
| 288 | std::cerr << index[i].idx; |
| 289 | } else { |
| 290 | // Found no solution for row i, so back to search the N variables |
| 291 | fail = true; |
| 292 | index[i].weight += 1; |
| 293 | if (i && index[i] < index[i-1]) |
| 294 | std::swap(index[i], index[i-1]); |
| 295 | break; |
| 296 | } |
| 297 | } |
| 298 | |
| 299 | return new Choice(*this, fail); |
| 300 | } |
| 301 | /// Return choice |
| 302 | virtual Choice* choice(const Space&, Archive& e) { |
| 303 | bool fail; e >> fail; |
nothing calls this directly
no test coverage detected