Go to the documentation of this file.
39 namespace Test {
namespace Int {
71 dsv(new
Gecode::IntSetValues[static_cast<unsigned int>(m+
n)]) {
99 if (
dsv[
i]() || (
i == 0)) {
102 for (
int k=0;k<
n_bins; k++)
147 :
Test(
"BinPacking::"+
str(m0)+
"::"+
str(s0)+
"::"+(
v ?
"+" :
"-"),
148 m0+s0.
size(), 0, 100),
171 if ((
x[
m+j] < 0) || (
x[
m+j] >=
m))
208 mutable int il[4][8];
213 :
Test(
"MultiBinPacking::"+
str(d0)+
"::"+
str(m0)+
"::"+
214 str(s0)+
"::"+
str(c0), s0.
size() / d0, 0, m0-1),
215 d(d0),
m(m0),
s(s0),
c(c0) {
226 for (
int i=
x.size();
i--; )
238 for (
int j=
m*
d; j--; )
264 :
Base(
"Int::MultiBinPacking::Clique::"+
Test::
str(
c)), clique(
c) {}
277 int n_items = clique[clique.
size()-1] + 1;
282 for (
int i=2*n_items;
i--; )
285 for (
int i=clique.
size()-1;
i--; )
286 s[
rand(n_items)*2+0]=2;
288 for (
int i=clique.
size();
i--; )
298 if (static_cast<unsigned int>(clique.
size()) != mc.
size()) {
302 for (
int i=clique.
size();
i--; )
303 if (!mc.
in(clique[
i])) {
331 for (
int m=1;
m<4;
m++) {
332 (void)
new BPT(
m, s0);
333 (void)
new BPT(
m, s1);
334 (void)
new BPT(
m, s2);
335 (void)
new BPT(
m, s3);
336 (void)
new BPT(
m, s4);
337 (void)
new BPT(
m, s5);
338 (void)
new BPT(
m, s6);
339 (void)
new BPT(
m, s7);
340 (void)
new BPT(
m, s8);
341 (void)
new BPT(
m, s9);
342 (void)
new BPT(
m, s1,
false);
347 IntArgs s1({1,2, 2,1, 1,2, 2,1});
349 (void)
new MBPT(2, 4, s1, c1);
350 (void)
new MBPT(2, 6, s1, c1);
354 (void)
new MBPT(2, 6, s2, c21);
355 (void)
new MBPT(2, 6, s2, c22);
356 IntArgs s3({1,2,3, 3,2,1, 2,1,3, 1,3,2});
360 (void)
new MBPT(3, 4, s3, c31);
361 (void)
new MBPT(3, 4, s3, c32);
362 (void)
new MBPT(3, 4, s3, c33);
363 (void)
new MBPT(3, 5, s3, c31);
364 (void)
new MBPT(3, 5, s3, c32);
365 (void)
new MBPT(3, 5, s3, c33);
371 IntArgs c3({1,3,7,10,15,22,27,97});
372 IntArgs c41({1,2,3,4,5,6,7,14});
373 IntArgs c42({1,2,3,4,5,6,7,15});
374 IntArgs c43({1,2,3,4,5,6,7,16});
375 IntArgs c44({1,2,3,4,5,6,7,30});
376 IntArgs c45({1,2,3,4,5,6,7,31});
377 IntArgs c46({1,2,3,4,5,6,7,32});
378 IntArgs c47({1,2,3,4,5,6,7,62});
379 IntArgs c48({1,2,3,4,5,6,7,63});
380 IntArgs c49({1,2,3,4,5,6,7,64});
virtual Assignment * assignment(void) const
Create assignment.
struct Gecode::@602::NNF::@65::@66 b
For binary nodes (and, or, eqv)
virtual bool solution(const Assignment &x) const
Test whether x is solution
Gecode::IntSet d_bin
Domain for bin variables.
Gecode::IntSet d_load
Domain for load variables.
bool in(int n) const
Return whether n is included in the set.
virtual bool run(void)
Run the actual test.
bool testsearch
Whether to perform search test.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
virtual ~LoadBinAssignment(void)
Destructor.
Passing integer variables.
unsigned int size(I &i)
Size of all ranges of range iterator i.
int n_bins
Number of bins.
int n
Number of variables.
Generate load and bin assignments.
virtual Gecode::Space * copy(void)
Copying member function.
Create(void)
Perform creation and registration.
static Gecode::Support::RandomGenerator rand
Random number generator.
int val(void) const
Return current value.
unsigned int size(void) const
Return size (cardinality) of set.
Test with different bin loads and items
virtual bool solution(const Assignment &x) const
Test whether x is solution
Gecode toplevel namespace
bool testfix
Whether to perform fixpoint test.
Base class for all tests to be run
int load
Load to generate (unless -1)
struct Gecode::@602::NNF::@65::@67 a
For atomic nodes.
Node * x
Pointer to corresponding Boolean expression node.
Gecode::IntArgs c
Bin capacities.
virtual bool operator()(void) const
Test whether all assignments have been iterated.
Gecode::IntArgs s
Item sizes.
bool valid
Whether to generate only valid loads.
LoadBinAssignment(int m, const Gecode::IntSet &d_m, int n, const Gecode::IntSet &d_n, int l)
Initialize assignments for load and bin variables.
CliqueMBPT(const Gecode::IntArgs &c)
Test for number of items n expected clique c.
Gecode::IntArgs s
Item sizes.
void init(const IntSet &s)
Initialize with values for s.
Test with different bin loads and items
Help class to create and register tests.
const int max
Largest allowed integer value.
Gecode::IntSetValues * dsv
Iterator for each variable.
MBPT(int d0, int m0, const Gecode::IntArgs &s0, const Gecode::IntArgs &c0)
Create and register test for d0 dimensions, m0 bins, item sizes s0, and capacities c0.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
SpaceStatus status(StatusStatistics &stat=unused_status)
Query space status.
int n_items
Number of items.
Base class for assignments
Test for testing the max-clique finding for multi bin-packing.
int size(void) const
Return size of array (number of elements)
Gecode::IntArgs clique
Expected clique.
IntSet binpacking(Home home, int d, const IntVarArgs &l, const IntVarArgs &b, const IntArgs &s, const IntArgs &c, IntPropLevel)
virtual int operator[](int i) const
Return value for variable i.
BPT(int m0, const Gecode::IntArgs &s0, bool v=true)
Create and register test for m bins and item sizes s.
virtual void operator++(void)
Move to next assignment.
static int total(const Gecode::IntArgs &s)
Compute total size.
int il[8]
Array of sufficient size for computing item loads.
int n_items
Number of items.
Passing integer arguments.
Value iterator for integer sets.
Gecode::IntArgs i({1, 2, 3, 4})
static std::string str(Gecode::IntPropLevel ipl)
Map integer propagation level to string.