Perform creation and registration
| 614 | public: |
| 615 | /// Perform creation and registration |
| 616 | TupleSetTestSize(int size, bool pos, Gecode::Support::RandomGenerator& rand) { |
| 617 | using namespace Gecode; |
| 618 | /// Find the arity needed for creating sufficient number of tuples |
| 619 | int arity = 2; |
| 620 | int n_tuples = 5*5; |
| 621 | while (n_tuples < size) { |
| 622 | arity++; |
| 623 | n_tuples*=5; |
| 624 | } |
| 625 | /// Build TupleSet |
| 626 | TupleSet ts(arity); |
| 627 | CpltAssignment ass(arity, IntSet(0, 4)); |
| 628 | for (int i = size; i--; ) { |
| 629 | assert(ass.has_more()); |
| 630 | IntArgs tuple(arity); |
| 631 | for (int j = arity; j--; ) tuple[j] = ass[j]; |
| 632 | ts.add(tuple); |
| 633 | ass.next(rand); |
| 634 | } |
| 635 | ts.finalize(); |
| 636 | assert(ts.tuples() == size); |
| 637 | // Create and register test |
| 638 | (void) new TupleSetTest(std::to_string(size),pos,IntSet(0,4),ts, |
| 639 | size <= 128); |
| 640 | } |
| 641 | }; |
| 642 | |
| 643 | Gecode::TupleSet randomTupleSet(int n, int min, int max, double prob, Gecode::Support::RandomGenerator& rand) { |