38#ifdef GECODE_HAS_SET_VARS
62 if (a.
size() != b.
size())
return false;
63 for (
int i = 0 ; i < a.
size() ; ++i)
69#ifdef GECODE_HAS_SET_VARS
74 if (a.
size() != b.
size())
return false;
75 for (
int i = 0 ; i < a.
size() ; ++i) {
78 if (a[i].size() != b[i].size())
return false;
82 if (
x.val() !=
y.val())
return false;
100 template <
class T,
class VarArgsType>
103 int nexpected = expected.size();
104 for (
int i = 0 ; i < nexpected ; ++i) {
108 olog <<
"Expected a solution but there are no more solutions." << std::endl;
109 olog <<
"(Expected " << nexpected <<
" but only found " << i <<
")" << std::endl;
110 olog <<
"Expected: " << expected[i] << std::endl;
114 if (!
equal(s->solution(), expected[i])) {
116 olog <<
"Solution does not match expected." << std::endl;
117 olog <<
"Solution: " << s->solution() << std::endl;
118 olog <<
"Expected: " << expected[i] << std::endl;
127 olog <<
"More solutions than expected:" << std::endl;
128 olog <<
"(Expected only " << nexpected <<
")" << std::endl;
129 olog << s->solution() << std::endl;
149 xs.update(*
this,s.
xs);
158 for (
int i = 0 ; i < a.
size() ; ++i)
166#ifdef GECODE_HAS_SET_VARS
177 xs.update(*
this,s.
xs);
186 for (
int i = 0 ; i < a.
size() ; ++i) {
206 LDSB(std::string label,
unsigned int c=0,
unsigned int a=0)
217 bool r =
check(e, T::expectedSolutions());
223#ifdef GECODE_HAS_SET_VARS
233 LDSBSet(std::string label,
unsigned int c=0,
unsigned int a=0)
244 bool r =
check(e, T::expectedSolutions());
257 static const int n = 4;
259 static const int l = 0;
261 static const int u = 3;
272 static std::vector<IntArgs> expected;
274 expected.push_back(
IntArgs({0,1,2,3}));
283 static const int n = 4;
285 static const int l = 0;
287 static const int u = 3;
297 static std::vector<IntArgs> expected;
299 expected.push_back(
IntArgs({0,1,2,3}));
308 static const int n = 4;
310 static const int l = 0;
312 static const int u = 3;
322 static std::vector<IntArgs> expected;
324 expected.push_back(
IntArgs({0,0,0,0}));
325 expected.push_back(
IntArgs({0,0,0,1}));
326 expected.push_back(
IntArgs({0,0,0,2}));
327 expected.push_back(
IntArgs({0,0,0,3}));
328 expected.push_back(
IntArgs({0,0,1,1}));
329 expected.push_back(
IntArgs({0,0,1,2}));
330 expected.push_back(
IntArgs({0,0,1,3}));
331 expected.push_back(
IntArgs({0,0,2,2}));
332 expected.push_back(
IntArgs({0,0,2,3}));
333 expected.push_back(
IntArgs({0,0,3,3}));
334 expected.push_back(
IntArgs({0,1,1,1}));
335 expected.push_back(
IntArgs({0,1,1,2}));
336 expected.push_back(
IntArgs({0,1,1,3}));
337 expected.push_back(
IntArgs({0,1,2,2}));
338 expected.push_back(
IntArgs({0,1,2,3}));
339 expected.push_back(
IntArgs({0,1,3,3}));
340 expected.push_back(
IntArgs({0,2,2,2}));
341 expected.push_back(
IntArgs({0,2,2,3}));
342 expected.push_back(
IntArgs({0,2,3,3}));
343 expected.push_back(
IntArgs({0,3,3,3}));
344 expected.push_back(
IntArgs({1,1,1,1}));
345 expected.push_back(
IntArgs({1,1,1,2}));
346 expected.push_back(
IntArgs({1,1,1,3}));
347 expected.push_back(
IntArgs({1,1,2,2}));
348 expected.push_back(
IntArgs({1,1,2,3}));
349 expected.push_back(
IntArgs({1,1,3,3}));
350 expected.push_back(
IntArgs({1,2,2,2}));
351 expected.push_back(
IntArgs({1,2,2,3}));
352 expected.push_back(
IntArgs({1,2,3,3}));
353 expected.push_back(
IntArgs({1,3,3,3}));
354 expected.push_back(
IntArgs({2,2,2,2}));
355 expected.push_back(
IntArgs({2,2,2,3}));
356 expected.push_back(
IntArgs({2,2,3,3}));
357 expected.push_back(
IntArgs({2,3,3,3}));
358 expected.push_back(
IntArgs({3,3,3,3}));
367 static const int n = 4;
369 static const int l = 0;
371 static const int u = 3;
381 static std::vector<IntArgs> expected;
383 expected.push_back(
IntArgs({0,1,2,3}));
384 expected.push_back(
IntArgs({0,1,3,2}));
385 expected.push_back(
IntArgs({0,2,1,3}));
386 expected.push_back(
IntArgs({0,2,3,1}));
387 expected.push_back(
IntArgs({0,3,1,2}));
388 expected.push_back(
IntArgs({0,3,2,1}));
389 expected.push_back(
IntArgs({1,2,0,3}));
390 expected.push_back(
IntArgs({1,2,3,0}));
391 expected.push_back(
IntArgs({1,3,0,2}));
392 expected.push_back(
IntArgs({1,3,2,0}));
393 expected.push_back(
IntArgs({2,3,0,1}));
394 expected.push_back(
IntArgs({2,3,1,0}));
403 static const int n = 3;
405 static const int l = 0;
407 static const int u = 2;
419 static std::vector<IntArgs> expected;
421 expected.push_back(
IntArgs({0,1,2}));
422 expected.push_back(
IntArgs({0,2,1}));
423 expected.push_back(
IntArgs({1,0,2}));
424 expected.push_back(
IntArgs({1,2,0}));
425 expected.push_back(
IntArgs({2,0,1}));
426 expected.push_back(
IntArgs({2,1,0}));
435 static const int n = 4;
437 static const int l = 0;
439 static const int u = 3;
451 static std::vector<IntArgs> expected;
453 expected.push_back(
IntArgs({0,1,2,3}));
454 expected.push_back(
IntArgs({0,2,1,3}));
455 expected.push_back(
IntArgs({0,3,1,2}));
456 expected.push_back(
IntArgs({1,2,0,3}));
457 expected.push_back(
IntArgs({1,3,0,2}));
458 expected.push_back(
IntArgs({2,3,0,1}));
467 static const int n = 6;
469 static const int l = 0;
471 static const int u = 1;
481 static std::vector<IntArgs> expected;
483 expected.push_back(
IntArgs({0,0, 0,0, 0,0}));
484 expected.push_back(
IntArgs({0,0, 0,0, 0,1}));
485 expected.push_back(
IntArgs({0,0, 0,0, 1,0}));
486 expected.push_back(
IntArgs({0,0, 0,0, 1,1}));
487 expected.push_back(
IntArgs({0,0, 0,1, 0,0}));
488 expected.push_back(
IntArgs({0,0, 0,1, 0,1}));
489 expected.push_back(
IntArgs({0,0, 0,1, 1,0}));
490 expected.push_back(
IntArgs({0,0, 0,1, 1,1}));
491 expected.push_back(
IntArgs({0,0, 1,0, 1,0}));
492 expected.push_back(
IntArgs({0,0, 1,0, 1,1}));
493 expected.push_back(
IntArgs({0,0, 1,1, 1,1}));
494 expected.push_back(
IntArgs({0,1, 0,0, 0,0}));
495 expected.push_back(
IntArgs({0,1, 0,0, 0,1}));
496 expected.push_back(
IntArgs({0,1, 0,0, 1,0}));
497 expected.push_back(
IntArgs({0,1, 0,0, 1,1}));
498 expected.push_back(
IntArgs({0,1, 0,1, 0,0}));
499 expected.push_back(
IntArgs({0,1, 0,1, 0,1}));
500 expected.push_back(
IntArgs({0,1, 0,1, 1,0}));
501 expected.push_back(
IntArgs({0,1, 0,1, 1,1}));
502 expected.push_back(
IntArgs({0,1, 1,0, 1,0}));
503 expected.push_back(
IntArgs({0,1, 1,0, 1,1}));
504 expected.push_back(
IntArgs({0,1, 1,1, 1,1}));
505 expected.push_back(
IntArgs({1,0, 1,0, 1,0}));
506 expected.push_back(
IntArgs({1,0, 1,0, 1,1}));
507 expected.push_back(
IntArgs({1,0, 1,1, 1,1}));
508 expected.push_back(
IntArgs({1,1, 1,1, 1,1}));
517 static const int n = 6;
519 static const int l = 0;
521 static const int u = 1;
531 static std::vector<IntArgs> expected;
533 expected.push_back(
IntArgs({0,0, 0,0, 0,0}));
534 expected.push_back(
IntArgs({0,0, 0,0, 0,1}));
535 expected.push_back(
IntArgs({0,0, 0,0, 1,1}));
536 expected.push_back(
IntArgs({0,0, 0,1, 0,0}));
537 expected.push_back(
IntArgs({0,0, 0,1, 0,1}));
538 expected.push_back(
IntArgs({0,0, 0,1, 1,0}));
539 expected.push_back(
IntArgs({0,0, 0,1, 1,1}));
540 expected.push_back(
IntArgs({0,0, 1,1, 0,0}));
541 expected.push_back(
IntArgs({0,0, 1,1, 0,1}));
542 expected.push_back(
IntArgs({0,0, 1,1, 1,1}));
543 expected.push_back(
IntArgs({0,1, 0,0, 0,0}));
544 expected.push_back(
IntArgs({0,1, 0,0, 0,1}));
545 expected.push_back(
IntArgs({0,1, 0,0, 1,0}));
546 expected.push_back(
IntArgs({0,1, 0,0, 1,1}));
547 expected.push_back(
IntArgs({0,1, 0,1, 0,0}));
548 expected.push_back(
IntArgs({0,1, 0,1, 0,1}));
549 expected.push_back(
IntArgs({0,1, 0,1, 1,0}));
550 expected.push_back(
IntArgs({0,1, 0,1, 1,1}));
551 expected.push_back(
IntArgs({0,1, 1,0, 0,0}));
552 expected.push_back(
IntArgs({0,1, 1,0, 0,1}));
553 expected.push_back(
IntArgs({0,1, 1,0, 1,0}));
554 expected.push_back(
IntArgs({0,1, 1,0, 1,1}));
555 expected.push_back(
IntArgs({0,1, 1,1, 0,0}));
556 expected.push_back(
IntArgs({0,1, 1,1, 0,1}));
557 expected.push_back(
IntArgs({0,1, 1,1, 1,0}));
558 expected.push_back(
IntArgs({0,1, 1,1, 1,1}));
559 expected.push_back(
IntArgs({1,1, 0,0, 0,0}));
560 expected.push_back(
IntArgs({1,1, 0,0, 0,1}));
561 expected.push_back(
IntArgs({1,1, 0,0, 1,1}));
562 expected.push_back(
IntArgs({1,1, 0,1, 0,0}));
563 expected.push_back(
IntArgs({1,1, 0,1, 0,1}));
564 expected.push_back(
IntArgs({1,1, 0,1, 1,0}));
565 expected.push_back(
IntArgs({1,1, 0,1, 1,1}));
566 expected.push_back(
IntArgs({1,1, 1,1, 0,0}));
567 expected.push_back(
IntArgs({1,1, 1,1, 0,1}));
568 expected.push_back(
IntArgs({1,1, 1,1, 1,1}));
577 static const int n = 6;
579 static const int l = 0;
581 static const int u = 1;
592 static std::vector<IntArgs> expected;
594 expected.push_back(
IntArgs({0,0, 0,0, 0,0}));
595 expected.push_back(
IntArgs({0,0, 0,0, 0,1}));
596 expected.push_back(
IntArgs({0,0, 0,0, 1,1}));
597 expected.push_back(
IntArgs({0,0, 0,1, 0,0}));
598 expected.push_back(
IntArgs({0,0, 0,1, 0,1}));
599 expected.push_back(
IntArgs({0,0, 0,1, 1,0}));
600 expected.push_back(
IntArgs({0,0, 0,1, 1,1}));
601 expected.push_back(
IntArgs({0,0, 1,1, 1,1}));
602 expected.push_back(
IntArgs({0,1, 0,0, 0,0}));
603 expected.push_back(
IntArgs({0,1, 0,0, 0,1}));
604 expected.push_back(
IntArgs({0,1, 0,0, 1,0}));
605 expected.push_back(
IntArgs({0,1, 0,0, 1,1}));
606 expected.push_back(
IntArgs({0,1, 0,1, 0,0}));
607 expected.push_back(
IntArgs({0,1, 0,1, 0,1}));
608 expected.push_back(
IntArgs({0,1, 0,1, 1,0}));
609 expected.push_back(
IntArgs({0,1, 0,1, 1,1}));
610 expected.push_back(
IntArgs({0,1, 1,0, 1,0}));
611 expected.push_back(
IntArgs({0,1, 1,0, 1,1}));
612 expected.push_back(
IntArgs({0,1, 1,1, 1,1}));
613 expected.push_back(
IntArgs({1,1, 1,1, 1,1}));
622 static const int n = 4;
624 static const int l = 0;
626 static const int u = 1;
636 static std::vector<IntArgs> expected;
638 expected.push_back(
IntArgs({0, 0, 0, 0}));
639 expected.push_back(
IntArgs({0, 0, 0, 1}));
640 expected.push_back(
IntArgs({0, 0, 1, 0}));
641 expected.push_back(
IntArgs({0, 0, 1, 1}));
642 expected.push_back(
IntArgs({0, 1, 0, 0}));
643 expected.push_back(
IntArgs({0, 1, 0, 1}));
644 expected.push_back(
IntArgs({0, 1, 1, 0}));
645 expected.push_back(
IntArgs({0, 1, 1, 1}));
646 expected.push_back(
IntArgs({1, 0, 0, 1}));
647 expected.push_back(
IntArgs({1, 0, 1, 1}));
648 expected.push_back(
IntArgs({1, 1, 1, 1}));
657 static const int n = 12;
659 static const int l = 0;
661 static const int u = 3;
668 for (
int i = 0 ; i < 4 ; ++i)
678 static std::vector<IntArgs> expected;
680 expected.push_back(
IntArgs({0,0,3, 1,0,2, 2,0,1, 3,0,0}));
681 expected.push_back(
IntArgs({0,0,3, 1,0,2, 2,1,0, 3,0,0}));
682 expected.push_back(
IntArgs({0,0,3, 1,1,1, 2,0,1, 3,0,0}));
683 expected.push_back(
IntArgs({0,0,3, 1,1,1, 2,1,0, 3,0,0}));
684 expected.push_back(
IntArgs({0,0,3, 1,2,0, 2,0,1, 3,0,0}));
685 expected.push_back(
IntArgs({0,0,3, 1,2,0, 2,1,0, 3,0,0}));
686 expected.push_back(
IntArgs({0,1,2, 1,0,2, 2,0,1, 3,0,0}));
687 expected.push_back(
IntArgs({0,1,2, 1,0,2, 2,1,0, 3,0,0}));
688 expected.push_back(
IntArgs({0,1,2, 1,1,1, 2,0,1, 3,0,0}));
689 expected.push_back(
IntArgs({0,1,2, 1,1,1, 2,1,0, 3,0,0}));
690 expected.push_back(
IntArgs({0,1,2, 1,2,0, 2,0,1, 3,0,0}));
691 expected.push_back(
IntArgs({0,1,2, 1,2,0, 2,1,0, 3,0,0}));
692 expected.push_back(
IntArgs({0,2,1, 1,0,2, 2,0,1, 3,0,0}));
693 expected.push_back(
IntArgs({0,2,1, 1,0,2, 2,1,0, 3,0,0}));
694 expected.push_back(
IntArgs({0,2,1, 1,1,1, 2,0,1, 3,0,0}));
695 expected.push_back(
IntArgs({0,2,1, 1,1,1, 2,1,0, 3,0,0}));
696 expected.push_back(
IntArgs({0,2,1, 1,2,0, 2,0,1, 3,0,0}));
697 expected.push_back(
IntArgs({0,2,1, 1,2,0, 2,1,0, 3,0,0}));
698 expected.push_back(
IntArgs({0,3,0, 1,0,2, 2,0,1, 3,0,0}));
699 expected.push_back(
IntArgs({0,3,0, 1,0,2, 2,1,0, 3,0,0}));
700 expected.push_back(
IntArgs({0,3,0, 1,1,1, 2,0,1, 3,0,0}));
701 expected.push_back(
IntArgs({0,3,0, 1,1,1, 2,1,0, 3,0,0}));
702 expected.push_back(
IntArgs({0,3,0, 1,2,0, 2,0,1, 3,0,0}));
703 expected.push_back(
IntArgs({0,3,0, 1,2,0, 2,1,0, 3,0,0}));
711 static const int nrows = 4;
713 static const int ncols = 3;
716 static const int n = nrows*ncols;
718 static const int l = 0;
720 static const int u = 3;
727 for (
int i = 0 ; i < nrows ; ++i)
737 for (
int i = 0 ; i < nrows ; i++) {
739 symvars << m(1,i) << m(2,i);
746 static std::vector<IntArgs> expected;
748 expected.push_back(
IntArgs({0,0,3, 1,0,2, 2,0,1, 3,0,0}));
749 expected.push_back(
IntArgs({0,0,3, 1,1,1, 2,0,1, 3,0,0}));
750 expected.push_back(
IntArgs({0,1,2, 1,0,2, 2,0,1, 3,0,0}));
751 expected.push_back(
IntArgs({0,1,2, 1,1,1, 2,0,1, 3,0,0}));
760 static const int n = 2;
762 static const int l = 0;
764 static const int u = 6;
767 rel(home, xs[0] + xs[1] == 6);
776 static std::vector<IntArgs> expected;
778 expected.push_back(
IntArgs({0,6}));
779 expected.push_back(
IntArgs({1,5}));
780 expected.push_back(
IntArgs({2,4}));
781 expected.push_back(
IntArgs({3,3}));
790 static const int n = 3;
792 static const int l = 0;
794 static const int u = 8;
798 tuples.
add({1,1,1}).add({4,4,4}).add({7,7,7})
799 .add({0,1,5}).add({0,1,8}).add({3,4,2})
800 .add({3,4,8}).add({6,7,2}).add({6,7,5})
812 static std::vector<IntArgs> expected;
814 expected.push_back(
IntArgs({0,1,5}));
815 expected.push_back(
IntArgs({1,1,1}));
824 static const int n = 2;
826 static const int l = 0;
828 static const int u = 6;
831 rel(home, xs[0] + xs[1] == 6);
839 static std::vector<IntArgs> expected;
841 expected.push_back(
IntArgs({3,3}));
842 expected.push_back(
IntArgs({2,4}));
843 expected.push_back(
IntArgs({1,5}));
844 expected.push_back(
IntArgs({0,6}));
853 static const int n = 4;
855 static const int l = 0;
857 static const int u = 3;
868 static std::vector<IntArgs> expected;
870 expected.push_back(
IntArgs({0,1,2,3}));
879 static const int n = 4;
881 static const int l = 0;
883 static const int u = 3;
893 static std::vector<IntArgs> expected;
895 expected.push_back(
IntArgs({0,1,2,3}));
904 static const int n = 4;
906 static const int l = 0;
908 static const int u = 3;
918 static std::vector<IntArgs> expected;
920 expected.push_back(
IntArgs({3,2,1,0}));
929 static const int n = 4;
931 static const int l = 0;
933 static const int u = 3;
943 static std::vector<IntArgs> expected;
945 expected.push_back(
IntArgs({0,0,0,0}));
946 expected.push_back(
IntArgs({0,0,0,1}));
947 expected.push_back(
IntArgs({0,0,1,0}));
948 expected.push_back(
IntArgs({0,0,1,1}));
949 expected.push_back(
IntArgs({0,0,1,2}));
950 expected.push_back(
IntArgs({0,1,0,0}));
951 expected.push_back(
IntArgs({0,1,0,1}));
952 expected.push_back(
IntArgs({0,1,0,2}));
953 expected.push_back(
IntArgs({0,1,1,0}));
954 expected.push_back(
IntArgs({0,1,1,1}));
955 expected.push_back(
IntArgs({0,1,1,2}));
956 expected.push_back(
IntArgs({0,1,2,0}));
957 expected.push_back(
IntArgs({0,1,2,1}));
958 expected.push_back(
IntArgs({0,1,2,2}));
959 expected.push_back(
IntArgs({0,1,2,3}));
968 static const int n = 4;
970 static const int l = 0;
972 static const int u = 3;
981 static std::vector<IntArgs> expected;
983 expected.push_back(
IntArgs({0,0,0,0}));
984 expected.push_back(
IntArgs({0,0,0,1}));
985 expected.push_back(
IntArgs({0,0,1,0}));
986 expected.push_back(
IntArgs({0,0,1,1}));
987 expected.push_back(
IntArgs({0,0,1,2}));
988 expected.push_back(
IntArgs({0,1,0,0}));
989 expected.push_back(
IntArgs({0,1,0,1}));
990 expected.push_back(
IntArgs({0,1,0,2}));
991 expected.push_back(
IntArgs({0,1,1,0}));
992 expected.push_back(
IntArgs({0,1,1,1}));
993 expected.push_back(
IntArgs({0,1,1,2}));
994 expected.push_back(
IntArgs({0,1,2,0}));
995 expected.push_back(
IntArgs({0,1,2,1}));
996 expected.push_back(
IntArgs({0,1,2,2}));
997 expected.push_back(
IntArgs({0,1,2,3}));
1006 static const int n = 4;
1008 static const int l = 0;
1010 static const int u = 3;
1021 static std::vector<IntArgs> expected;
1023 expected.push_back(
IntArgs({0,1,2,3}));
1024 expected.push_back(
IntArgs({0,1,3,2}));
1025 expected.push_back(
IntArgs({0,2,1,3}));
1026 expected.push_back(
IntArgs({0,2,3,1}));
1027 expected.push_back(
IntArgs({0,3,1,2}));
1028 expected.push_back(
IntArgs({0,3,2,1}));
1029 expected.push_back(
IntArgs({2,0,1,3}));
1030 expected.push_back(
IntArgs({2,0,3,1}));
1031 expected.push_back(
IntArgs({2,3,0,1}));
1032 expected.push_back(
IntArgs({3,0,1,2}));
1033 expected.push_back(
IntArgs({3,0,2,1}));
1034 expected.push_back(
IntArgs({3,2,0,1}));
1043 static const int n = 3;
1045 static const int l = 0;
1047 static const int u = 2;
1058 static std::vector<IntArgs> expected;
1060 expected.push_back(
IntArgs({0,1,2}));
1061 expected.push_back(
IntArgs({0,2,1}));
1062 expected.push_back(
IntArgs({1,0,2}));
1063 expected.push_back(
IntArgs({1,2,0}));
1064 expected.push_back(
IntArgs({2,0,1}));
1065 expected.push_back(
IntArgs({2,1,0}));
1074 static const int n = 4;
1076 static const int l = 0;
1078 static const int u = 3;
1091 static std::vector<IntArgs> expected;
1093 expected.push_back(
IntArgs({0,1,2,3}));
1094 expected.push_back(
IntArgs({0,2,1,3}));
1095 expected.push_back(
IntArgs({0,2,3,1}));
1096 expected.push_back(
IntArgs({2,0,1,3}));
1097 expected.push_back(
IntArgs({2,0,3,1}));
1098 expected.push_back(
IntArgs({2,3,0,1}));
1107 static const int n = 4;
1109 static const int l = 0;
1111 static const int u = 3;
1121 static std::vector<IntArgs> expected;
1123 expected.push_back(
IntArgs({0,0,0,0}));
1124 expected.push_back(
IntArgs({0,0,0,1}));
1125 expected.push_back(
IntArgs({0,0,1,1}));
1126 expected.push_back(
IntArgs({0,0,1,2}));
1127 expected.push_back(
IntArgs({0,1,1,1}));
1128 expected.push_back(
IntArgs({0,1,1,2}));
1129 expected.push_back(
IntArgs({0,1,2,2}));
1130 expected.push_back(
IntArgs({0,1,2,3}));
1145 for (
int i = 0 ; i < n ; i++) {
1157 {
xs.update(*
this, s.
xs); }
1159 {
return new Latin(*
this); }
1162 for (
int i = 0 ; i < a.
size() ; ++i)
1169 static std::vector<IntArgs> expected;
1171 expected.push_back(
IntArgs({1,2,3,4, 2,1,4,3, 3,4,1,2, 4,3,2,1}));
1172 expected.push_back(
IntArgs({1,2,3,4, 2,1,4,3, 3,4,2,1, 4,3,1,2}));
1173 expected.push_back(
IntArgs({1,2,3,4, 2,3,4,1, 3,4,1,2, 4,1,2,3}));
1174 expected.push_back(
IntArgs({1,2,3,4, 2,4,1,3, 3,1,4,2, 4,3,2,1}));
1223 static const int n = 4;
1225 static const int l = 0;
1227 static const int u = 1;
1231 t.
add({0,0}).add({1,1}).finalize();
1233 va << xs[0] << xs[2];
1241 static std::vector<IntArgs> expected;
1243 expected.push_back(
IntArgs({0,0,0,0}));
1244 expected.push_back(
IntArgs({0,0,0,1}));
1257 expected.push_back(
IntArgs({0,1,0,1}));
1259 expected.push_back(
IntArgs({1,0,1,0}));
1260 expected.push_back(
IntArgs({1,0,1,1}));
1261 expected.push_back(
IntArgs({1,1,1,1}));
1276 static const int n = 4;
1278 static const int l = 0;
1280 static const int u = 3;
1289 rel(home, xs[1] != xs[2]);
1300 static std::vector<IntArgs> expected;
1302 expected.push_back(
IntArgs({3,2,0,1}));
1307#ifdef GECODE_HAS_SET_VARS
1316 int x = va_arg(args,
int);
1333 static const int n = 2;
1335 static const int l = 0;
1337 static const int u = 1;
1346 static std::vector<IntSetArgs> expected;
1348 expected.push_back(
ISA(2, 0,1,-1, 0,1,-1));
1349 expected.push_back(
ISA(2, 0,1,-1, 0, -1));
1350 expected.push_back(
ISA(2, 0,1,-1, 1,-1));
1351 expected.push_back(
ISA(2, 0,1,-1, -1));
1352 expected.push_back(
ISA(2, 0, -1, 0,1,-1));
1353 expected.push_back(
ISA(2, 0, -1, 0, -1));
1354 expected.push_back(
ISA(2, 0, -1, 1,-1));
1355 expected.push_back(
ISA(2, 0, -1, -1));
1358 expected.push_back(
ISA(2, 1,-1, 1,-1));
1359 expected.push_back(
ISA(2, 1,-1, -1));
1363 expected.push_back(
ISA(2, -1, -1));
1383 static const int n = 2;
1385 static const int l = 0;
1387 static const int u = 1;
1396 static std::vector<IntSetArgs> expected;
1398 expected.push_back(
ISA(2, 0,1,-1, 0,1,-1));
1399 expected.push_back(
ISA(2, 0,1,-1, 0, -1));
1401 expected.push_back(
ISA(2, 0,1,-1, -1));
1402 expected.push_back(
ISA(2, 0, -1, 0,1,-1));
1403 expected.push_back(
ISA(2, 0, -1, 0, -1));
1404 expected.push_back(
ISA(2, 0, -1, 1,-1));
1405 expected.push_back(
ISA(2, 0, -1, -1));
1410 expected.push_back(
ISA(2, -1, 0,1,-1));
1411 expected.push_back(
ISA(2, -1, 0, -1));
1413 expected.push_back(
ISA(2, -1, -1));
1422 static const int n = 3;
1424 static const int l = 1;
1426 static const int u = 4;
1431 for (
int i = 0 ; i < 3 ; i++)
1437 static std::vector<IntSetArgs> expected;
1439 expected.push_back(
ISA(3, 1,-1, 1,-1, 1,-1));
1440 expected.push_back(
ISA(3, 1,-1, 1,-1, 2,-1));
1441 expected.push_back(
ISA(3, 1,-1, 2,-1, 1,-1));
1442 expected.push_back(
ISA(3, 1,-1, 2,-1, 2,-1));
1443 expected.push_back(
ISA(3, 1,-1, 2,-1, 3,-1));
1452 static const int n = 4;
1454 static const int l = 0;
1456 static const int u = 1;
1463 for (
int i = 0 ; i < 4 ; i++)
1469 static std::vector<IntSetArgs> expected;
1471 expected.push_back(
ISA(4, 0,-1, 1,-1, 0,-1, 1,-1));
1472 expected.push_back(
ISA(4, 0,-1, 1,-1, 1,-1, 0,-1));
1474 expected.push_back(
ISA(4, 1,-1, 0,-1, 1,-1, 0,-1));
1483 static const int n = 4;
1485 static const int l = 0;
1487 static const int u = 0;
1497 static std::vector<IntSetArgs> expected;
1501 expected.push_back(
ISA(4, 0, -1,0,-1,0,-1,0,-1));
1502 expected.push_back(
ISA(4, 0, -1,0,-1,0,-1, -1));
1506 expected.push_back(
ISA(4, 0, -1, -1,0,-1, -1));
1511 expected.push_back(
ISA(4, -1,0,-1, -1,0,-1));
1512 expected.push_back(
ISA(4, -1,0,-1, -1, -1));
1516 expected.push_back(
ISA(4, -1, -1, -1, -1));
1526 static const int n = 6;
1528 static const int l = 0;
1530 static const int u = 6;
1536 rel(home,
abs(m(0,0)-m(1,0))==1);
1537 rel(home,
abs(m(0,1)-m(1,1))==1);
1538 rel(home,
abs(m(1,0)-m(2,0))==1);
1539 rel(home,
abs(m(1,1)-m(2,1))==1);
1549 static std::vector<IntArgs> expected;
1551 expected.push_back(
IntArgs({0,1,2,3,4,5}));
1552 expected.push_back(
IntArgs({0,1,2,4,5,6}));
1553 expected.push_back(
IntArgs({0,1,2,5,4,3}));
1554 expected.push_back(
IntArgs({0,1,2,6,5,4}));
1563 static const int n = 2;
1565 static const int l = 0;
1567 static const int u = 3;
1576 static std::vector<IntArgs> expected;
1578 expected.push_back(
IntArgs({0,0}));
1579 expected.push_back(
IntArgs({0,1}));
1580 expected.push_back(
IntArgs({0,2}));
1581 expected.push_back(
IntArgs({0,3}));
1582 expected.push_back(
IntArgs({1,0}));
1583 expected.push_back(
IntArgs({1,1}));
1584 expected.push_back(
IntArgs({1,2}));
1585 expected.push_back(
IntArgs({1,3}));
1594 static const int n = 4;
1596 static const int l = 0;
1598 static const int u = 3;
1609 static std::vector<IntArgs> expected;
1611 expected.push_back(
IntArgs({0,1,2,3}));
1646#ifdef GECODE_HAS_SET_VARS
Depth-first search engine.
FloatNum size(void) const
Return size of float value (distance between maximum and minimum)
Home class for posting propagators
Passing integer arguments.
static IntArgs create(int n, int start, int inc=1)
Allocate array with n elements such that for all .
Value iterator for integer sets.
static const IntSet empty
Empty set.
Passing integer variables.
Matrix-interface for arrays.
Slice< A > slice(int fc, int tc, int fr, int tr) const
Access slice of the matrix.
Slice< A > col(int c) const
Access column c.
Slice< A > row(int r) const
Access row r.
virtual T * next(void)
Return next solution (NULL, if none exists or search has been stopped)
static const Options def
Default options.
unsigned int c_d
Create a clone after every c_d commits (commit distance)
unsigned int a_d
Create a clone during recomputation if distance is greater than a_d (adaptive distance)
Iterator for the greatest lower bound ranges of a set variable.
Collection of symmetries.
Combine variable selection criteria for tie-breaking.
Class represeting a set of tuples.
TupleSet & add(const IntArgs &t)
Add tuple t to tuple set.
Base(const std::string &s)
Create and register test with name s.
static const int u
Upper bound of values.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
static const int l
Lower bound of values.
static const int n
Number of variables.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
virtual Space * copy(void)
Copying member function.
Test for LDSB infrastructure with Latin square problem
bool run(void)
Perform actual tests.
LDSBLatin(std::string label)
Initialize test.
Test for LDSB infrastructure
LDSBSet(std::string label, unsigned int c=0, unsigned int a=0)
Initialize test.
bool run(void)
Perform actual tests.
unsigned int a_d
Adaptation distance.
unsigned int c_d
Recomputation distance.
bool run(void)
Perform actual tests.
LDSB(std::string label, unsigned int c=0, unsigned int a=0)
Initialize test.
unsigned int c_d
Recomputation distance.
unsigned int a_d
Adaptation distance.
static const int n
Number of variables.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
static const int l
Lower bound of values.
static const int u
Upper bound of values.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
static const int n
Number of variables.
static const int l
Lower bound of values.
static const int u
Upper bound of values.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
static const int u
Upper bound of values.
static const int n
Number of variables.
static const int l
Lower bound of values.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
static const int n
Number of variables.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
static const int l
Lower bound of values.
static const int u
Upper bound of values.
IntSetArgs solution(void)
Return the solution as IntSetArgs.
virtual Space * copy(void)
Copy during cloning.
OneArraySet(int n, int l, int u)
Constructor for creation.
OneArraySet(OneArraySet &s)
Constructor for cloning s.
virtual IntSetArgs * expectedSolutions(void)
Expected solutions.
virtual Space * copy(void)
Copy during cloning.
OneArray(int n, int l, int u)
Constructor for creation.
virtual IntArgs * expectedSolutions(void)
Expected solutions.
OneArray(OneArray &s)
Constructor for cloning s.
IntArgs solution(void)
Return the solution as IntArgs.
Test for handling of recomputation
static const int u
Upper bound of values.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
static const int n
Number of variables.
static const int l
Lower bound of values.
Test for reflection symmetry
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
static const int n
Number of variables.
static const int l
Lower bound of values.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
static const int u
Upper bound of values.
Test for reflection symmetry
static const int u
Upper bound of values.
static const int n
Number of variables.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
static const int l
Lower bound of values.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
Test for set value symmetry
static void setup(Home home, SetVarArray &xs)
Setup problem constraints and symmetries.
static const int l
Lower bound of values.
static const int n
Number of variables.
static std::vector< IntSetArgs > expectedSolutions(void)
Compute list of expected solutions.
static const int u
Upper bound of values.
Test for set value symmetry
static const int l
Lower bound of values.
static std::vector< IntSetArgs > expectedSolutions(void)
Compute list of expected solutions.
static void setup(Home home, SetVarArray &xs)
Setup problem constraints and symmetries.
static const int u
Upper bound of values.
static const int n
Number of variables.
Test for set variable sequence symmetry
static const int n
Number of variables.
static const int l
Lower bound of values.
static const int u
Upper bound of values.
static void setup(Home home, SetVarArray &xs)
Setup problem constraints and symmetries.
static std::vector< IntSetArgs > expectedSolutions(void)
Compute list of expected solutions.
Test for set variable sequence symmetry
static const int n
Number of variables.
static const int u
Upper bound of values.
static void setup(Home home, SetVarArray &xs)
Setup problem constraints and symmetries.
static const int l
Lower bound of values.
static std::vector< IntSetArgs > expectedSolutions(void)
Compute list of expected solutions.
Test for set variable symmetry
static const int u
Upper bound of values.
static void setup(Home home, SetVarArray &xs)
Setup problem constraints and symmetries.
static const int l
Lower bound of values.
static const int n
Number of variables.
static std::vector< IntSetArgs > expectedSolutions(void)
Compute list of expected solutions.
Test for value sequence symmetry
static const int n
Number of variables.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
static const int l
Lower bound of values.
static const int u
Upper bound of values.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
Test for value sequence symmetry
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
static const int u
Upper bound of values.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
static const int l
Lower bound of values.
static const int n
Number of variables.
Test for value sequence symmetry
static const int n
Number of variables.
static const int u
Upper bound of values.
static const int l
Lower bound of values.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
Test for variable sequence symmetry
static const int l
Lower bound of values.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
static const int n
Number of variables.
static const int u
Upper bound of values.
Test for variable sequence symmetry
static const int l
Lower bound of values.
static const int u
Upper bound of values.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
static const int n
Number of variables.
static const int l
Lower bound of values.
static const int u
Upper bound of values.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
static const int n
Number of variables.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
static const int n
Number of variables.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
static const int l
Lower bound of values.
static const int u
Upper bound of values.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
static const int u
Upper bound of values.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
static const int l
Lower bound of values.
static const int n
Number of variables.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
static const int u
Upper bound of values.
static const int l
Lower bound of values.
static const int n
Number of variables.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
static const int n
Number of variables.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
static const int l
Lower bound of values.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
static const int u
Upper bound of values.
static const int l
Lower bound of values.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
static const int u
Upper bound of values.
static const int n
Number of variables.
static const int u
Upper bound of values.
static const int n
Number of variables.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
static const int l
Lower bound of values.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
static const int n
Number of variables.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
static const int l
Lower bound of values.
static const int u
Upper bound of values.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
static const int n
Number of variables.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
static const int l
Lower bound of values.
static const int u
Upper bound of values.
Test for variable symmetry
static const int n
Number of variables.
static const int u
Upper bound of values.
static const int l
Lower bound of values.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
Test for variable symmetry
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
static const int u
Upper bound of values.
static const int l
Lower bound of values.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
static const int n
Number of variables.
Test for variable symmetry
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
static const int l
Lower bound of values.
static const int u
Upper bound of values.
static const int n
Number of variables.
Test for variable symmetry
static const int n
Number of variables.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
static const int l
Lower bound of values.
static const int u
Upper bound of values.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
Test for variable symmetry
static const int u
Upper bound of values.
static const int n
Number of variables.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
static const int l
Lower bound of values.
Test for variable symmetry
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
static const int l
Lower bound of values.
static const int u
Upper bound of values.
static const int n
Number of variables.
Test for variable and value symmetry
static const int l
Lower bound of values.
static const int n
Number of variables.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
static const int u
Upper bound of values.
void branch(Home home, const FloatVarArgs &x, FloatVarBranch vars, FloatValBranch vals, FloatBranchFilter bf=nullptr, FloatVarValPrint vvp=nullptr)
Branch over x with variable selection vars and value selection vals.
void linear(Home home, const FloatVarArgs &x, FloatRelType frt, FloatVal c)
Post propagator for .
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVar x1)
Post propagator for .
void extensional(Home home, const IntVarArgs &x, DFA d, IntPropLevel ipl=IPL_DEF)
Post domain consistent propagator for extensional constraint described by a DFA.
Space(void)
Default constructor.
Symmetry breaking for integer variables.
Gecode toplevel namespace
ArgArray< IntSet > IntSetArgs
Passing set arguments.
SymmetryHandle ValueSymmetry(const IntArgs &v)
Values in v are interchangeable.
SymmetryHandle ValueSequenceSymmetry(const IntArgs &v, int ss)
Value sequences in v of size ss are interchangeable.
Post propagator for SetVar SetOpType SetVar SetRelType r
SymmetryHandle values_reflect(int lower, int upper)
The values from lower to upper (inclusive) can be reflected.
SymmetryHandle rows_reflect(const Matrix< A > &m)
Reflect rows symmetry specification.
Select first unassigned variable SetVarBranch SET_VAR_NONE(void)
IntVarBranch INT_VAR_DEGREE_MAX(BranchTbl tbl=nullptr)
Select variable with largest degree.
IntValBranch INT_VAL_MED(void)
Select greatest value not greater than the median.
TieBreak< VarBranch > tiebreak(VarBranch a, VarBranch b)
Combine variable selection criteria a and b for tie-breaking.
void distinct(Home home, const IntVarArgs &x, IntPropLevel ipl=IPL_DEF)
Post propagator for for all .
IntVarBranch INT_VAR_NONE(void)
Select first unassigned variable.
void abs(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
IntValBranch INT_VAL_MAX(void)
Select largest value.
void values(Home home, const IntVarArgs &x, IntSet y, IntPropLevel ipl=IPL_DEF)
Post constraint .
Post propagator for SetVar SetOpType SetVar y
SymmetryHandle columns_reflect(const Matrix< A > &m)
Reflect columns symmetry specification.
SymmetryHandle rows_interchange(const Matrix< A > &m)
Interchangeable rows symmetry specification.
IntValBranch INT_VAL_MIN(void)
Select smallest value.
SymmetryHandle VariableSymmetry(const IntVarArgs &x)
Variables in x are interchangeable.
IntVarBranch INT_VAR_ACTION_MIN(double d=1.0, BranchTbl tbl=nullptr)
Select variable with lowest action with decay factor d.
Include smallest element SetValBranch SET_VAL_MIN_INC(void)
SymmetryHandle VariableSequenceSymmetry(const IntVarArgs &x, int ss)
Variable sequences in x of size ss are interchangeable.
LinIntExpr cardinality(const SetExpr &)
Cardinality of set expression.
IntVarBranch INT_VAR_MERIT_MAX(IntBranchMerit bm, BranchTbl tbl=nullptr)
Select variable with highest merit according to branch merit function bm.
Post propagator for SetVar x
SymmetryHandle columns_interchange(const Matrix< A > &m)
Interchangeable columns symmetry specification.
LDSB< ValSym4 > valsym4("ValSym4")
LDSB< Action1 > action1("Action1")
double position(const Space &home, IntVar x, int i)
LDSB< MatSym1 > matsym1("MatSym1")
LDSB< VarSym1 > varsym1("VarSym1")
LDSB< SimIntValSym3 > simintvalsym3("SimIntValSym3")
LDSB< VarSym3 > varsym3("VarSym3")
LDSB< MatSym3 > matsym3("MatSym3")
LDSB< VarSym2 > varsym2("VarSym2")
LDSB< ValSym1c > valsym1c("ValSym1c")
LDSB< SimIntVarSym1 > simintvarsym1("SimIntVarSym1")
LDSB< VarSym4 > varsym4("VarSym4")
LDSB< TieBreak > tiebreak("TieBreak")
LDSB< SimIntValSym1 > simintvalsym1("SimIntValSym1")
LDSB< ValSym5 > valsym5("ValSym5")
LDSB< ReflectSym2 > reflectsym2("ReflectSym2")
LDSB< MatSym2 > matsym2("MatSym2")
LDSB< MatSym4 > matsym4("MatSym4")
LDSB< Recomputation > recomp("Recomputation", 999, 999)
LDSB< SimIntVarSym2 > simintvarsym2("SimIntVarSym2")
LDSB< ValSym2 > valsym2("ValSym2")
LDSBSet< SetVarSym1 > setvarsym1("SetVarSym1")
IntSetArgs ISA(int n,...)
Convenient way to make IntSetArgs.
LDSBSet< SetVarSeqSym1 > setvarseqsym1("SetVarSeqSym1")
LDSB< ValSym1b > valsym1b("ValSym1b")
LDSB< ValSym1 > valsym1("ValSym1")
LDSB< SimIntValSym2 > simintvalsym2("SimIntValSym2")
LDSB< ValSym3 > valsym3("ValSym3")
LDSBSet< SetValSym1 > setvalsym1("SetValSym1")
bool check(DFS< T > &e, std::vector< VarArgsType > expected)
Checks found solutions against expected solutions.
LDSB< ValSym2b > valsym2b("ValSym2b")
LDSBSet< SetVarSeqSym2 > setvarseqsym2("SetVarSeqSym2")
LDSB< ReflectSym1 > reflectsym1("ReflectSym1")
LDSB< VarSym5 > varsym5("VarSym5")
LDSB< VarSym1b > varsym1b("VarSym1b")
LDSBSet< SetValSym2 > setvalsym2("SetValSym2", 0, 1)
LDSB< VarValSym1 > varvalsym1("VarValSym1")
bool equal(const IntArgs &a, const IntArgs &b)
Returns true iff a and b are equal (they have the same size and the same elements in the same positio...
std::ostringstream olog
Stream used for logging.