MCPcopy Create free account
hub / github.com/Gecode/gecode / TupleSetTestSize

Method TupleSetTestSize

test/int/extensional.cpp:616–640  ·  view source on GitHub ↗

Perform creation and registration

Source from the content-addressed store, hash-verified

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) {

Callers

nothing calls this directly

Calls 6

IntSetClass · 0.85
tuplesMethod · 0.80
has_moreMethod · 0.45
addMethod · 0.45
nextMethod · 0.45
finalizeMethod · 0.45

Tested by

no test coverage detected