39namespace 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++)
140 for (
int i=
s.
size(); i--; )
147 :
Test(
"BinPacking::"+
str(
m0)+
"::"+
str(s0)+
"::"+(v ?
"+" :
"-"),
148 m0+s0.size(), 0, 100),
171 if ((
x[
m+j] < 0) || (
x[
m+j] >=
m))
176 for (
int i=
s.
size(); i--; )
190 for (
int i=
s.
size(); i--; )
192 binpacking(home,
l,
b,
s);
208 mutable int il[4][8];
214 str(s0)+
"::"+
str(c0), s0.size() /
d0, 0,
m0-1),
226 for (
int i=
x.
size(); i--; )
227 il[k][
x[i]] +=
s[i*
d+k];
238 for (
int j=
m*
d; j--; )
240 binpacking(home,
d,
l,
x,
s,
c);
294 if (home->
status() == SS_FAILED) {
298 if (
static_cast<unsigned int>(
clique.
size()) !=
mc.size()) {
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});
struct Gecode::@603::NNF::@65::@66 b
For binary nodes (and, or, eqv)
struct Gecode::@603::NNF::@65::@67 a
For atomic nodes.
Node * x
Pointer to corresponding Boolean expression node.
int size(void) const
Return size of array (number of elements)
Passing integer arguments.
Value iterator for integer sets.
void init(const IntSet &s)
Initialize with values for s.
Passing integer variables.
int val(void) const
Return current value.
Base class for all tests to be run
static Gecode::Support::RandomGenerator rand
Random number generator.
Base class for assignments
int n
Number of variables.
Test with different bin loads and items
static int total(const Gecode::IntArgs &s)
Compute total size.
virtual Assignment * assignment(void) const
Create assignment.
virtual bool solution(const Assignment &x) const
Test whether x is solution
BPT(int m0, const Gecode::IntArgs &s0, bool v=true)
Create and register test for m bins and item sizes s.
Gecode::IntArgs s
Item sizes.
int il[8]
Array of sufficient size for computing item loads.
bool valid
Whether to generate only valid loads.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
virtual Gecode::Space * copy(void)
Copying member function.
Test for testing the max-clique finding for multi bin-packing.
int n_items
Number of items.
CliqueMBPT(const Gecode::IntArgs &c)
Test for number of items n expected clique c.
Gecode::IntArgs clique
Expected clique.
virtual bool run(void)
Run the actual test.
Help class to create and register tests.
Create(void)
Perform creation and registration.
Generate load and bin assignments.
virtual ~LoadBinAssignment(void)
Destructor.
Gecode::IntSet d_bin
Domain for bin variables.
virtual void operator++(void)
Move to next assignment.
Gecode::IntSetValues * dsv
Iterator for each variable.
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)
int n_bins
Number of bins.
Gecode::IntSet d_load
Domain for load variables.
int n_items
Number of items.
virtual int operator[](int i) const
Return value for variable i.
Test with different bin loads and items
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 bool solution(const Assignment &x) const
Test whether x is solution
Gecode::IntArgs c
Bin capacities.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Gecode::IntArgs s
Item sizes.
int il[4][8]
Array of sufficient size for computing item loads.
virtual bool run(void)
Perform test.
bool testsearch
Whether to perform search test.
bool testfix
Whether to perform fixpoint test.
static std::string str(Gecode::IntPropLevel ipl)
Map integer propagation level to string.
SpaceStatus status(StatusStatistics &stat=unused_status)
Query space status.
const int max
Largest allowed integer value.
Gecode toplevel namespace