| 559 | |
| 560 | template<class Card> |
| 561 | ExecStatus |
| 562 | Bnd<Card>::pruneCards(Space& home) { |
| 563 | // Remove all values with 0 max occurrence |
| 564 | // and remove corresponding occurrence variables from k |
| 565 | |
| 566 | // The number of zeroes |
| 567 | int n_z = 0; |
| 568 | for (int i=k.size(); i--;) |
| 569 | if (k[i].max() == 0) |
| 570 | n_z++; |
| 571 | |
| 572 | if (n_z > 0) { |
| 573 | Region r; |
| 574 | int* z = r.alloc<int>(n_z); |
| 575 | n_z = 0; |
| 576 | int n_k = 0; |
| 577 | for (int i=0; i<k.size(); i++) |
| 578 | if (k[i].max() == 0) { |
| 579 | z[n_z++] = k[i].card(); |
| 580 | } else { |
| 581 | k[n_k++] = k[i]; |
| 582 | } |
| 583 | k.size(n_k); |
| 584 | Support::quicksort(z,n_z); |
| 585 | for (int i=x.size(); i--;) { |
| 586 | Iter::Values::Array zi(z,n_z); |
| 587 | GECODE_ME_CHECK(x[i].minus_v(home,zi,false)); |
| 588 | } |
| 589 | lps.reinit(); ups.reinit(); |
| 590 | } |
| 591 | return ES_OK; |
| 592 | } |
| 593 | |
| 594 | template<class Card> |
| 595 | ExecStatus |