43 namespace Test {
namespace Int {
75 dsv(new
Gecode::IntSetValues[static_cast<unsigned int>(m+
n)]) {
103 if (
dsv[
i]() || (
i == 0)) {
106 for (
int k=0;k<
n_bins; k++)
151 :
Test(
"BinPacking::"+
str(m0)+
"::"+
str(s0)+
"::"+(
v ?
"+" :
"-"),
152 m0+s0.
size(), 0, 100),
175 if ((
x[
m+j] < 0) || (
x[
m+j] >=
m))
212 mutable int il[4][8];
217 :
Test(
"MultiBinPacking::"+
str(d0)+
"::"+
str(m0)+
"::"+
218 str(s0)+
"::"+
str(c0), s0.
size() / d0, 0, m0-1),
219 d(d0),
m(m0),
s(s0),
c(c0) {
230 for (
int i=
x.size();
i--; )
242 for (
int j=
m*
d; j--; )
268 :
Base(
"Int::MultiBinPacking::Clique::"+
Test::
str(
c)), clique(
c) {}
281 int n_items = clique[clique.
size()-1] + 1;
286 for (
int i=2*n_items;
i--; )
289 for (
int i=clique.
size()-1;
i--; )
290 s[
rand(n_items)*2+0]=2;
292 for (
int i=clique.
size();
i--; )
306 for (
int i=clique.
size();
i--; )
307 if (!mc.
in(clique[
i])) {
335 for (
int m=1;
m<4;
m++) {
336 (void)
new BPT(
m, s0);
337 (void)
new BPT(
m, s1);
338 (void)
new BPT(
m, s2);
339 (void)
new BPT(
m, s3);
340 (void)
new BPT(
m, s4);
341 (void)
new BPT(
m, s5);
342 (void)
new BPT(
m, s6);
343 (void)
new BPT(
m, s7);
344 (void)
new BPT(
m, s8);
345 (void)
new BPT(
m, s9);
346 (void)
new BPT(
m, s1,
false);
351 IntArgs s1(2*4, 1,2, 2,1, 1,2, 2,1);
353 (void)
new MBPT(2, 4, s1, c1);
354 (void)
new MBPT(2, 6, s1, c1);
355 IntArgs s2(2*3, 1,1, 1,1, 1,1);
358 (void)
new MBPT(2, 6, s2, c21);
359 (void)
new MBPT(2, 6, s2, c22);
360 IntArgs s3(3*4, 1,2,3, 3,2,1, 2,1,3, 1,3,2);
364 (void)
new MBPT(3, 4, s3, c31);
365 (void)
new MBPT(3, 4, s3, c32);
366 (void)
new MBPT(3, 4, s3, c33);
367 (void)
new MBPT(3, 5, s3, c31);
368 (void)
new MBPT(3, 5, s3, c32);
369 (void)
new MBPT(3, 5, s3, c33);
374 IntArgs c2(8, 1,2,3,4,5,6,7,8);
375 IntArgs c3(8, 1,3,7,10,15,22,27,97);
376 IntArgs c41(8, 1,2,3,4,5,6,7,14);
377 IntArgs c42(8, 1,2,3,4,5,6,7,15);
378 IntArgs c43(8, 1,2,3,4,5,6,7,16);
379 IntArgs c44(8, 1,2,3,4,5,6,7,30);
380 IntArgs c45(8, 1,2,3,4,5,6,7,31);
381 IntArgs c46(8, 1,2,3,4,5,6,7,32);
382 IntArgs c47(8, 1,2,3,4,5,6,7,62);
383 IntArgs c48(8, 1,2,3,4,5,6,7,63);
384 IntArgs c49(8, 1,2,3,4,5,6,7,64);
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
static std::string str(Gecode::IntPropLevel ipl)
Map integer propagation level to string.
int n_items
Number of items.
int size(void) const
Return size of array (number of elements)
IntSet binpacking(Home home, int d, const IntVarArgs &l, const IntVarArgs &b, const IntArgs &s, const IntArgs &c, IntPropLevel)
static Gecode::Support::RandomGenerator rand
Random number generator.
Create(void)
Perform creation and registration.
void init(const IntSet &s)
Initialize with values for s.
int n_items
Number of items.
Gecode::IntArgs s
Item sizes.
Gecode::IntArgs c
Bin capacities.
bool valid
Whether to generate only valid loads.
virtual ~LoadBinAssignment(void)
Destructor.
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...
Gecode::IntSet d_bin
Domain for bin variables.
const int max
Largest allowed integer value.
static int total(const Gecode::IntArgs &s)
Compute total size.
virtual void operator++(void)
Move to next assignment.
int val(void) const
Return current value.
int n
Number of variables.
int n_bins
Number of bins.
struct Gecode::@579::NNF::@61::@63 a
For atomic nodes.
Test with different bin loads and items
Gecode::IntArgs i(4, 1, 2, 3, 4)
Gecode::IntArgs clique
Expected clique.
Help class to create and register tests.
Gecode::IntSetValues * dsv
Iterator for each variable.
virtual int operator[](int i) const
Return value for variable i.
unsigned int size(void) const
Return size (cardinality) of set.
unsigned int size(I &i)
Size of all ranges of range iterator i.
struct Gecode::@579::NNF::@61::@62 b
For binary nodes (and, or, eqv)
Base class for all tests to be run
virtual Assignment * assignment(void) const
Create assignment.
virtual bool solution(const Assignment &x) const
Test whether x is solution
CliqueMBPT(const Gecode::IntArgs &c)
Test for number of items n expected clique c.
Passing integer variables.
Passing integer arguments.
Generate load and bin assignments.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
bool testfix
Whether to perform fixpoint test.
Node * x
Pointer to corresponding Boolean expression node.
Test with different bin loads and items
Gecode::IntSet d_load
Domain for load variables.
bool testsearch
Whether to perform search test.
Base class for assignments
virtual Gecode::Space * copy(bool)
Copying member function.
Value iterator for integer sets.
Test for testing the max-clique finding for multi bin-packing.
SpaceStatus status(StatusStatistics &stat=unused_status)
Query space status.
int il[8]
Array of sufficient size for computing item loads.
Gecode toplevel namespace
BPT(int m0, const Gecode::IntArgs &s0, bool v=true)
Create and register test for m bins and item sizes s.
virtual bool run(void)
Run the actual test.
bool in(int n) const
Return whether n is included in the set.
Gecode::IntArgs s
Item sizes.
virtual bool solution(const Assignment &x) const
Test whether x is solution
virtual bool operator()(void) const
Test whether all assignments have been iterated.
LoadBinAssignment(int m, const Gecode::IntSet &d_m, int n, const Gecode::IntSet &d_n, int l)
Initialize assignments for load and bin variables.
int load
Load to generate (unless -1)