46 namespace Test {
namespace Set {
51 static_cast<unsigned int>(pow(static_cast<double>(2.0),
64 static_cast<unsigned int>(pow(static_cast<double>(2.0),
73 : n(n0), dsv(new
CountableSet[n]), ir(_withInt, d0), done(false), lub(d0),
112 for (
int i=0;
i<n;
i++) {
115 os << icsv << ((i!=n-1) ?
"," :
"}");
122 namespace Test {
namespace Set {
126 :
d(d0), x(*this, n, Gecode::IntSet::empty,
d), y(*this, i,
d),
127 withInt(i),
b(*this, 0, 1), reified(r), test(t) {
129 olog <<
ind(2) <<
"Initial: x[]=" <<
x;
130 olog <<
" y[]=" <<
y;
138 : Gecode::Space(share,s),
d(s.
d), withInt(s.withInt),
139 reified(s.reified), test(s.test) {
155 olog <<
ind(3) <<
"Posting reified propagator" << std::endl;
159 olog <<
ind(3) <<
"Posting propagator" << std::endl;
166 olog <<
ind(3) <<
"Fixpoint: x[]=" <<
x
167 <<
" y[]=" <<
y << std::endl;
170 <<
" y[]=" <<
y << std::endl;
180 olog <<
ind(4) <<
"x[" << i <<
"] ";
193 olog << is << std::endl;
201 olog <<
ind(4) << cmin <<
" <= #(x[" << i <<
"]) <= " << cmax
210 olog <<
ind(4) <<
"y[" << i <<
"] ";
219 olog <<
" " << n << std::endl;
229 olog <<
ind(4) <<
"b = " << n << std::endl;
235 for (
int i=a.
size();
i--; ) {
262 using namespace Gecode;
269 for (
int j=0; j<
v; j++, ++diffV) {}
275 using namespace Gecode;
282 for (
int j=0; j<
v; j++, ++interV) {}
292 olog <<
ind(3) <<
"Testing fixpoint on copy" << std::endl;
295 delete c;
return false;
299 if (
x[
i].glbSize() != c->
x[
i].glbSize() ||
300 x[
i].lubSize() != c->
x[
i].lubSize() ||
301 x[
i].cardMin() != c->
x[
i].cardMin() ||
302 x[
i].cardMax() != c->
x[
i].cardMax()) {
308 delete c;
return false;
311 delete c;
return false;
314 olog <<
ind(3) <<
"Finished testing fixpoint on copy" << std::endl;
321 using namespace Gecode;
322 bool setsAssigned =
true;
323 for (
int j=
x.
size(); j--; )
325 setsAssigned =
false;
328 bool intsAssigned =
true;
329 for (
int j=
y.
size(); j--; )
331 intsAssigned =
false;
339 }
else if (setsAssigned) {
345 if (setsAssigned ||
i>=
x.
size()) {
356 if (a.
ints()[
i] <
y[
i].max()) {
359 assert((v > a.
ints()[
i]) && (v <=
y[
i].
max()));
364 if (a.
ints()[
i] >
y[
i].min()) {
367 assert((v < a.
ints()[
i]) && (v >=
y[
i].
min()));
376 if (it.
width() > skip) {
378 if (v == a.
ints()[
i]) {
379 if (it.
width() == 1) {
381 }
else if (v < it.
max()) {
426 if (
x[i].cardMin() < aisize) {
427 unsigned int newc =
x[
i].cardMin() + 1 +
429 assert( newc >
x[i].cardMin() );
430 assert( newc <= aisize );
435 if (
x[i].cardMax() > aisize) {
436 unsigned int newc =
x[
i].cardMax() - 1 -
438 assert( newc <
x[i].cardMax() );
439 assert( newc >= aisize );
457 #define CHECK_TEST(T,M) \
459 olog << ind(3) << "Check: " << (M) << std::endl; \
461 problem = (M); delete s; goto failed; \
465 #define START_TEST(T) \
468 olog << ind(2) << "Testing: " << (T) << std::endl; \
474 const char*
test =
"NONE";
475 const char* problem =
"NONE";
480 bool is_sol = solution(a);
482 olog <<
ind(1) <<
"Assignment: " << a
483 << (is_sol ?
" (solution)" :
" (no solution)")
494 olog <<
ind(3) <<
"No copy" << std::endl;
500 olog <<
ind(3) <<
"Unshared copy" << std::endl;
509 olog <<
ind(3) <<
"Unshared copy" << std::endl;
516 default: assert(
false);
541 START_TEST(
"Assignment reified (before posting)");
556 START_TEST(
"Assignment reified (after posting)");
576 problem =
"No fixpoint";
595 problem =
"No fixpoint";
615 olog <<
"FAILURE" << std::endl
616 <<
ind(1) <<
"Test: " << test << std::endl
617 <<
ind(1) <<
"Problem: " << problem << std::endl;
619 olog <<
ind(1) <<
"Assignment: " << a << std::endl;