42 #ifdef GECODE_HAS_SET_VARS 57 namespace Test {
namespace LDSB {
65 if (a.
size() != b.
size())
return false;
66 for (
int i = 0 ;
i < a.
size() ; ++
i)
72 #ifdef GECODE_HAS_SET_VARS 77 if (a.
size() != b.
size())
return false;
78 for (
int i = 0 ;
i < a.
size() ; ++
i) {
85 if (x.
val() != y.
val())
return false;
103 template <
class T,
class VarArgsType>
106 int nexpected = expected.size();
107 for (
int i = 0 ;
i < nexpected ; ++
i) {
111 olog <<
"Expected a solution but there are no more solutions." << std::endl;
112 olog <<
"(Expected " << nexpected <<
" but only found " <<
i <<
")" << std::endl;
113 olog <<
"Expected: " << expected[
i] << std::endl;
117 if (!
equal(s->solution(), expected[
i])) {
119 olog <<
"Solution does not match expected." << std::endl;
120 olog <<
"Solution: " << s->solution() << std::endl;
121 olog <<
"Expected: " << expected[
i] << std::endl;
130 olog <<
"More solutions than expected:" << std::endl;
131 olog <<
"(Expected only " << nexpected <<
")" << std::endl;
132 olog << s->solution() << std::endl;
161 for (
int i = 0 ;
i <
a.size() ; ++
i)
169 #ifdef GECODE_HAS_SET_VARS 189 for (
int i = 0 ;
i <
a.size() ; ++
i) {
209 LDSB(std::string label,
unsigned int c=0,
unsigned int a=0)
217 if (c_d != 0) o.
c_d =
c_d;
218 if (a_d != 0) o.
a_d =
a_d;
220 bool r =
check(e, T::expectedSolutions());
226 #ifdef GECODE_HAS_SET_VARS 236 LDSBSet(std::string label,
unsigned int c=0,
unsigned int a=0)
244 if (c_d != 0) o.
c_d =
c_d;
245 if (a_d != 0) o.
a_d =
a_d;
247 bool r =
check(e, T::expectedSolutions());
260 static const int n = 4;
262 static const int l = 0;
264 static const int u = 3;
275 static std::vector<IntArgs> expected;
277 expected.push_back(
IntArgs(4, 0,1,2,3));
286 static const int n = 4;
288 static const int l = 0;
290 static const int u = 3;
300 static std::vector<IntArgs> expected;
302 expected.push_back(
IntArgs(4, 0,1,2,3));
311 static const int n = 4;
313 static const int l = 0;
315 static const int u = 3;
325 static std::vector<IntArgs> expected;
327 expected.push_back(
IntArgs(4, 0,0,0,0));
328 expected.push_back(
IntArgs(4, 0,0,0,1));
329 expected.push_back(
IntArgs(4, 0,0,0,2));
330 expected.push_back(
IntArgs(4, 0,0,0,3));
331 expected.push_back(
IntArgs(4, 0,0,1,1));
332 expected.push_back(
IntArgs(4, 0,0,1,2));
333 expected.push_back(
IntArgs(4, 0,0,1,3));
334 expected.push_back(
IntArgs(4, 0,0,2,2));
335 expected.push_back(
IntArgs(4, 0,0,2,3));
336 expected.push_back(
IntArgs(4, 0,0,3,3));
337 expected.push_back(
IntArgs(4, 0,1,1,1));
338 expected.push_back(
IntArgs(4, 0,1,1,2));
339 expected.push_back(
IntArgs(4, 0,1,1,3));
340 expected.push_back(
IntArgs(4, 0,1,2,2));
341 expected.push_back(
IntArgs(4, 0,1,2,3));
342 expected.push_back(
IntArgs(4, 0,1,3,3));
343 expected.push_back(
IntArgs(4, 0,2,2,2));
344 expected.push_back(
IntArgs(4, 0,2,2,3));
345 expected.push_back(
IntArgs(4, 0,2,3,3));
346 expected.push_back(
IntArgs(4, 0,3,3,3));
347 expected.push_back(
IntArgs(4, 1,1,1,1));
348 expected.push_back(
IntArgs(4, 1,1,1,2));
349 expected.push_back(
IntArgs(4, 1,1,1,3));
350 expected.push_back(
IntArgs(4, 1,1,2,2));
351 expected.push_back(
IntArgs(4, 1,1,2,3));
352 expected.push_back(
IntArgs(4, 1,1,3,3));
353 expected.push_back(
IntArgs(4, 1,2,2,2));
354 expected.push_back(
IntArgs(4, 1,2,2,3));
355 expected.push_back(
IntArgs(4, 1,2,3,3));
356 expected.push_back(
IntArgs(4, 1,3,3,3));
357 expected.push_back(
IntArgs(4, 2,2,2,2));
358 expected.push_back(
IntArgs(4, 2,2,2,3));
359 expected.push_back(
IntArgs(4, 2,2,3,3));
360 expected.push_back(
IntArgs(4, 2,3,3,3));
361 expected.push_back(
IntArgs(4, 3,3,3,3));
370 static const int n = 4;
372 static const int l = 0;
374 static const int u = 3;
384 static std::vector<IntArgs> expected;
386 expected.push_back(
IntArgs(4, 0,1,2,3));
387 expected.push_back(
IntArgs(4, 0,1,3,2));
388 expected.push_back(
IntArgs(4, 0,2,1,3));
389 expected.push_back(
IntArgs(4, 0,2,3,1));
390 expected.push_back(
IntArgs(4, 0,3,1,2));
391 expected.push_back(
IntArgs(4, 0,3,2,1));
392 expected.push_back(
IntArgs(4, 1,2,0,3));
393 expected.push_back(
IntArgs(4, 1,2,3,0));
394 expected.push_back(
IntArgs(4, 1,3,0,2));
395 expected.push_back(
IntArgs(4, 1,3,2,0));
396 expected.push_back(
IntArgs(4, 2,3,0,1));
397 expected.push_back(
IntArgs(4, 2,3,1,0));
406 static const int n = 3;
408 static const int l = 0;
410 static const int u = 2;
422 static std::vector<IntArgs> expected;
424 expected.push_back(
IntArgs(3, 0,1,2));
425 expected.push_back(
IntArgs(3, 0,2,1));
426 expected.push_back(
IntArgs(3, 1,0,2));
427 expected.push_back(
IntArgs(3, 1,2,0));
428 expected.push_back(
IntArgs(3, 2,0,1));
429 expected.push_back(
IntArgs(3, 2,1,0));
438 static const int n = 4;
440 static const int l = 0;
442 static const int u = 3;
454 static std::vector<IntArgs> expected;
456 expected.push_back(
IntArgs(4, 0,1,2,3));
457 expected.push_back(
IntArgs(4, 0,2,1,3));
458 expected.push_back(
IntArgs(4, 0,3,1,2));
459 expected.push_back(
IntArgs(4, 1,2,0,3));
460 expected.push_back(
IntArgs(4, 1,3,0,2));
461 expected.push_back(
IntArgs(4, 2,3,0,1));
470 static const int n = 6;
472 static const int l = 0;
474 static const int u = 1;
484 static std::vector<IntArgs> expected;
486 expected.push_back(
IntArgs(6, 0,0, 0,0, 0,0));
487 expected.push_back(
IntArgs(6, 0,0, 0,0, 0,1));
488 expected.push_back(
IntArgs(6, 0,0, 0,0, 1,0));
489 expected.push_back(
IntArgs(6, 0,0, 0,0, 1,1));
490 expected.push_back(
IntArgs(6, 0,0, 0,1, 0,0));
491 expected.push_back(
IntArgs(6, 0,0, 0,1, 0,1));
492 expected.push_back(
IntArgs(6, 0,0, 0,1, 1,0));
493 expected.push_back(
IntArgs(6, 0,0, 0,1, 1,1));
494 expected.push_back(
IntArgs(6, 0,0, 1,0, 1,0));
495 expected.push_back(
IntArgs(6, 0,0, 1,0, 1,1));
496 expected.push_back(
IntArgs(6, 0,0, 1,1, 1,1));
497 expected.push_back(
IntArgs(6, 0,1, 0,0, 0,0));
498 expected.push_back(
IntArgs(6, 0,1, 0,0, 0,1));
499 expected.push_back(
IntArgs(6, 0,1, 0,0, 1,0));
500 expected.push_back(
IntArgs(6, 0,1, 0,0, 1,1));
501 expected.push_back(
IntArgs(6, 0,1, 0,1, 0,0));
502 expected.push_back(
IntArgs(6, 0,1, 0,1, 0,1));
503 expected.push_back(
IntArgs(6, 0,1, 0,1, 1,0));
504 expected.push_back(
IntArgs(6, 0,1, 0,1, 1,1));
505 expected.push_back(
IntArgs(6, 0,1, 1,0, 1,0));
506 expected.push_back(
IntArgs(6, 0,1, 1,0, 1,1));
507 expected.push_back(
IntArgs(6, 0,1, 1,1, 1,1));
508 expected.push_back(
IntArgs(6, 1,0, 1,0, 1,0));
509 expected.push_back(
IntArgs(6, 1,0, 1,0, 1,1));
510 expected.push_back(
IntArgs(6, 1,0, 1,1, 1,1));
511 expected.push_back(
IntArgs(6, 1,1, 1,1, 1,1));
520 static const int n = 6;
522 static const int l = 0;
524 static const int u = 1;
534 static std::vector<IntArgs> expected;
536 expected.push_back(
IntArgs(6, 0,0, 0,0, 0,0));
537 expected.push_back(
IntArgs(6, 0,0, 0,0, 0,1));
538 expected.push_back(
IntArgs(6, 0,0, 0,0, 1,1));
539 expected.push_back(
IntArgs(6, 0,0, 0,1, 0,0));
540 expected.push_back(
IntArgs(6, 0,0, 0,1, 0,1));
541 expected.push_back(
IntArgs(6, 0,0, 0,1, 1,0));
542 expected.push_back(
IntArgs(6, 0,0, 0,1, 1,1));
543 expected.push_back(
IntArgs(6, 0,0, 1,1, 0,0));
544 expected.push_back(
IntArgs(6, 0,0, 1,1, 0,1));
545 expected.push_back(
IntArgs(6, 0,0, 1,1, 1,1));
546 expected.push_back(
IntArgs(6, 0,1, 0,0, 0,0));
547 expected.push_back(
IntArgs(6, 0,1, 0,0, 0,1));
548 expected.push_back(
IntArgs(6, 0,1, 0,0, 1,0));
549 expected.push_back(
IntArgs(6, 0,1, 0,0, 1,1));
550 expected.push_back(
IntArgs(6, 0,1, 0,1, 0,0));
551 expected.push_back(
IntArgs(6, 0,1, 0,1, 0,1));
552 expected.push_back(
IntArgs(6, 0,1, 0,1, 1,0));
553 expected.push_back(
IntArgs(6, 0,1, 0,1, 1,1));
554 expected.push_back(
IntArgs(6, 0,1, 1,0, 0,0));
555 expected.push_back(
IntArgs(6, 0,1, 1,0, 0,1));
556 expected.push_back(
IntArgs(6, 0,1, 1,0, 1,0));
557 expected.push_back(
IntArgs(6, 0,1, 1,0, 1,1));
558 expected.push_back(
IntArgs(6, 0,1, 1,1, 0,0));
559 expected.push_back(
IntArgs(6, 0,1, 1,1, 0,1));
560 expected.push_back(
IntArgs(6, 0,1, 1,1, 1,0));
561 expected.push_back(
IntArgs(6, 0,1, 1,1, 1,1));
562 expected.push_back(
IntArgs(6, 1,1, 0,0, 0,0));
563 expected.push_back(
IntArgs(6, 1,1, 0,0, 0,1));
564 expected.push_back(
IntArgs(6, 1,1, 0,0, 1,1));
565 expected.push_back(
IntArgs(6, 1,1, 0,1, 0,0));
566 expected.push_back(
IntArgs(6, 1,1, 0,1, 0,1));
567 expected.push_back(
IntArgs(6, 1,1, 0,1, 1,0));
568 expected.push_back(
IntArgs(6, 1,1, 0,1, 1,1));
569 expected.push_back(
IntArgs(6, 1,1, 1,1, 0,0));
570 expected.push_back(
IntArgs(6, 1,1, 1,1, 0,1));
571 expected.push_back(
IntArgs(6, 1,1, 1,1, 1,1));
580 static const int n = 6;
582 static const int l = 0;
584 static const int u = 1;
595 static std::vector<IntArgs> expected;
597 expected.push_back(
IntArgs(6, 0,0, 0,0, 0,0));
598 expected.push_back(
IntArgs(6, 0,0, 0,0, 0,1));
599 expected.push_back(
IntArgs(6, 0,0, 0,0, 1,1));
600 expected.push_back(
IntArgs(6, 0,0, 0,1, 0,0));
601 expected.push_back(
IntArgs(6, 0,0, 0,1, 0,1));
602 expected.push_back(
IntArgs(6, 0,0, 0,1, 1,0));
603 expected.push_back(
IntArgs(6, 0,0, 0,1, 1,1));
604 expected.push_back(
IntArgs(6, 0,0, 1,1, 1,1));
605 expected.push_back(
IntArgs(6, 0,1, 0,0, 0,0));
606 expected.push_back(
IntArgs(6, 0,1, 0,0, 0,1));
607 expected.push_back(
IntArgs(6, 0,1, 0,0, 1,0));
608 expected.push_back(
IntArgs(6, 0,1, 0,0, 1,1));
609 expected.push_back(
IntArgs(6, 0,1, 0,1, 0,0));
610 expected.push_back(
IntArgs(6, 0,1, 0,1, 0,1));
611 expected.push_back(
IntArgs(6, 0,1, 0,1, 1,0));
612 expected.push_back(
IntArgs(6, 0,1, 0,1, 1,1));
613 expected.push_back(
IntArgs(6, 0,1, 1,0, 1,0));
614 expected.push_back(
IntArgs(6, 0,1, 1,0, 1,1));
615 expected.push_back(
IntArgs(6, 0,1, 1,1, 1,1));
616 expected.push_back(
IntArgs(6, 1,1, 1,1, 1,1));
625 static const int n = 4;
627 static const int l = 0;
629 static const int u = 1;
639 static std::vector<IntArgs> expected;
641 expected.push_back(
IntArgs(4, 0, 0, 0, 0));
642 expected.push_back(
IntArgs(4, 0, 0, 0, 1));
643 expected.push_back(
IntArgs(4, 0, 0, 1, 0));
644 expected.push_back(
IntArgs(4, 0, 0, 1, 1));
645 expected.push_back(
IntArgs(4, 0, 1, 0, 0));
646 expected.push_back(
IntArgs(4, 0, 1, 0, 1));
647 expected.push_back(
IntArgs(4, 0, 1, 1, 0));
648 expected.push_back(
IntArgs(4, 0, 1, 1, 1));
649 expected.push_back(
IntArgs(4, 1, 0, 0, 1));
650 expected.push_back(
IntArgs(4, 1, 0, 1, 1));
651 expected.push_back(
IntArgs(4, 1, 1, 1, 1));
660 static const int n = 12;
662 static const int l = 0;
664 static const int u = 3;
671 for (
int i = 0 ;
i < 4 ; ++
i)
681 static std::vector<IntArgs> expected;
683 expected.push_back(
IntArgs(12, 0,0,3, 1,0,2, 2,0,1, 3,0,0));
684 expected.push_back(
IntArgs(12, 0,0,3, 1,0,2, 2,1,0, 3,0,0));
685 expected.push_back(
IntArgs(12, 0,0,3, 1,1,1, 2,0,1, 3,0,0));
686 expected.push_back(
IntArgs(12, 0,0,3, 1,1,1, 2,1,0, 3,0,0));
687 expected.push_back(
IntArgs(12, 0,0,3, 1,2,0, 2,0,1, 3,0,0));
688 expected.push_back(
IntArgs(12, 0,0,3, 1,2,0, 2,1,0, 3,0,0));
689 expected.push_back(
IntArgs(12, 0,1,2, 1,0,2, 2,0,1, 3,0,0));
690 expected.push_back(
IntArgs(12, 0,1,2, 1,0,2, 2,1,0, 3,0,0));
691 expected.push_back(
IntArgs(12, 0,1,2, 1,1,1, 2,0,1, 3,0,0));
692 expected.push_back(
IntArgs(12, 0,1,2, 1,1,1, 2,1,0, 3,0,0));
693 expected.push_back(
IntArgs(12, 0,1,2, 1,2,0, 2,0,1, 3,0,0));
694 expected.push_back(
IntArgs(12, 0,1,2, 1,2,0, 2,1,0, 3,0,0));
695 expected.push_back(
IntArgs(12, 0,2,1, 1,0,2, 2,0,1, 3,0,0));
696 expected.push_back(
IntArgs(12, 0,2,1, 1,0,2, 2,1,0, 3,0,0));
697 expected.push_back(
IntArgs(12, 0,2,1, 1,1,1, 2,0,1, 3,0,0));
698 expected.push_back(
IntArgs(12, 0,2,1, 1,1,1, 2,1,0, 3,0,0));
699 expected.push_back(
IntArgs(12, 0,2,1, 1,2,0, 2,0,1, 3,0,0));
700 expected.push_back(
IntArgs(12, 0,2,1, 1,2,0, 2,1,0, 3,0,0));
701 expected.push_back(
IntArgs(12, 0,3,0, 1,0,2, 2,0,1, 3,0,0));
702 expected.push_back(
IntArgs(12, 0,3,0, 1,0,2, 2,1,0, 3,0,0));
703 expected.push_back(
IntArgs(12, 0,3,0, 1,1,1, 2,0,1, 3,0,0));
704 expected.push_back(
IntArgs(12, 0,3,0, 1,1,1, 2,1,0, 3,0,0));
705 expected.push_back(
IntArgs(12, 0,3,0, 1,2,0, 2,0,1, 3,0,0));
706 expected.push_back(
IntArgs(12, 0,3,0, 1,2,0, 2,1,0, 3,0,0));
714 static const int nrows = 4;
716 static const int ncols = 3;
719 static const int n = nrows*ncols;
721 static const int l = 0;
723 static const int u = 3;
730 for (
int i = 0 ;
i < nrows ; ++
i)
740 for (
int i = 0 ;
i < nrows ;
i++) {
742 symvars << m(1,
i) << m(2,
i);
749 static std::vector<IntArgs> expected;
751 expected.push_back(
IntArgs(12, 0,0,3, 1,0,2, 2,0,1, 3,0,0));
752 expected.push_back(
IntArgs(12, 0,0,3, 1,1,1, 2,0,1, 3,0,0));
753 expected.push_back(
IntArgs(12, 0,1,2, 1,0,2, 2,0,1, 3,0,0));
754 expected.push_back(
IntArgs(12, 0,1,2, 1,1,1, 2,0,1, 3,0,0));
763 static const int n = 2;
765 static const int l = 0;
767 static const int u = 6;
770 rel(home, xs[0] + xs[1] == 6);
779 static std::vector<IntArgs> expected;
781 expected.push_back(
IntArgs(2, 0,6));
782 expected.push_back(
IntArgs(2, 1,5));
783 expected.push_back(
IntArgs(2, 2,4));
784 expected.push_back(
IntArgs(2, 3,3));
793 static const int n = 3;
795 static const int l = 0;
797 static const int u = 8;
815 static std::vector<IntArgs> expected;
817 expected.push_back(
IntArgs(3, 0,1,5));
818 expected.push_back(
IntArgs(3, 1,1,1));
827 static const int n = 2;
829 static const int l = 0;
831 static const int u = 6;
834 rel(home, xs[0] + xs[1] == 6);
842 static std::vector<IntArgs> expected;
844 expected.push_back(
IntArgs(2, 3,3));
845 expected.push_back(
IntArgs(2, 2,4));
846 expected.push_back(
IntArgs(2, 1,5));
847 expected.push_back(
IntArgs(2, 0,6));
856 static const int n = 4;
858 static const int l = 0;
860 static const int u = 3;
871 static std::vector<IntArgs> expected;
873 expected.push_back(
IntArgs(4, 0,1,2,3));
882 static const int n = 4;
884 static const int l = 0;
886 static const int u = 3;
896 static std::vector<IntArgs> expected;
898 expected.push_back(
IntArgs(4, 0,1,2,3));
907 static const int n = 4;
909 static const int l = 0;
911 static const int u = 3;
921 static std::vector<IntArgs> expected;
923 expected.push_back(
IntArgs(4, 3,2,1,0));
932 static const int n = 4;
934 static const int l = 0;
936 static const int u = 3;
946 static std::vector<IntArgs> expected;
948 expected.push_back(
IntArgs(4, 0,0,0,0));
949 expected.push_back(
IntArgs(4, 0,0,0,1));
950 expected.push_back(
IntArgs(4, 0,0,1,0));
951 expected.push_back(
IntArgs(4, 0,0,1,1));
952 expected.push_back(
IntArgs(4, 0,0,1,2));
953 expected.push_back(
IntArgs(4, 0,1,0,0));
954 expected.push_back(
IntArgs(4, 0,1,0,1));
955 expected.push_back(
IntArgs(4, 0,1,0,2));
956 expected.push_back(
IntArgs(4, 0,1,1,0));
957 expected.push_back(
IntArgs(4, 0,1,1,1));
958 expected.push_back(
IntArgs(4, 0,1,1,2));
959 expected.push_back(
IntArgs(4, 0,1,2,0));
960 expected.push_back(
IntArgs(4, 0,1,2,1));
961 expected.push_back(
IntArgs(4, 0,1,2,2));
962 expected.push_back(
IntArgs(4, 0,1,2,3));
971 static const int n = 4;
973 static const int l = 0;
975 static const int u = 3;
984 static std::vector<IntArgs> expected;
986 expected.push_back(
IntArgs(4, 0,0,0,0));
987 expected.push_back(
IntArgs(4, 0,0,0,1));
988 expected.push_back(
IntArgs(4, 0,0,1,0));
989 expected.push_back(
IntArgs(4, 0,0,1,1));
990 expected.push_back(
IntArgs(4, 0,0,1,2));
991 expected.push_back(
IntArgs(4, 0,1,0,0));
992 expected.push_back(
IntArgs(4, 0,1,0,1));
993 expected.push_back(
IntArgs(4, 0,1,0,2));
994 expected.push_back(
IntArgs(4, 0,1,1,0));
995 expected.push_back(
IntArgs(4, 0,1,1,1));
996 expected.push_back(
IntArgs(4, 0,1,1,2));
997 expected.push_back(
IntArgs(4, 0,1,2,0));
998 expected.push_back(
IntArgs(4, 0,1,2,1));
999 expected.push_back(
IntArgs(4, 0,1,2,2));
1000 expected.push_back(
IntArgs(4, 0,1,2,3));
1009 static const int n = 4;
1011 static const int l = 0;
1013 static const int u = 3;
1024 static std::vector<IntArgs> expected;
1026 expected.push_back(
IntArgs(4, 0,1,2,3));
1027 expected.push_back(
IntArgs(4, 0,1,3,2));
1028 expected.push_back(
IntArgs(4, 0,2,1,3));
1029 expected.push_back(
IntArgs(4, 0,2,3,1));
1030 expected.push_back(
IntArgs(4, 0,3,1,2));
1031 expected.push_back(
IntArgs(4, 0,3,2,1));
1032 expected.push_back(
IntArgs(4, 2,0,1,3));
1033 expected.push_back(
IntArgs(4, 2,0,3,1));
1034 expected.push_back(
IntArgs(4, 2,3,0,1));
1035 expected.push_back(
IntArgs(4, 3,0,1,2));
1036 expected.push_back(
IntArgs(4, 3,0,2,1));
1037 expected.push_back(
IntArgs(4, 3,2,0,1));
1046 static const int n = 3;
1048 static const int l = 0;
1050 static const int u = 2;
1061 static std::vector<IntArgs> expected;
1063 expected.push_back(
IntArgs(3, 0,1,2));
1064 expected.push_back(
IntArgs(3, 0,2,1));
1065 expected.push_back(
IntArgs(3, 1,0,2));
1066 expected.push_back(
IntArgs(3, 1,2,0));
1067 expected.push_back(
IntArgs(3, 2,0,1));
1068 expected.push_back(
IntArgs(3, 2,1,0));
1077 static const int n = 4;
1079 static const int l = 0;
1081 static const int u = 3;
1094 static std::vector<IntArgs> expected;
1096 expected.push_back(
IntArgs(4, 0,1,2,3));
1097 expected.push_back(
IntArgs(4, 0,2,1,3));
1098 expected.push_back(
IntArgs(4, 0,2,3,1));
1099 expected.push_back(
IntArgs(4, 2,0,1,3));
1100 expected.push_back(
IntArgs(4, 2,0,3,1));
1101 expected.push_back(
IntArgs(4, 2,3,0,1));
1110 static const int n = 4;
1112 static const int l = 0;
1114 static const int u = 3;
1124 static std::vector<IntArgs> expected;
1126 expected.push_back(
IntArgs(4, 0,0,0,0));
1127 expected.push_back(
IntArgs(4, 0,0,0,1));
1128 expected.push_back(
IntArgs(4, 0,0,1,1));
1129 expected.push_back(
IntArgs(4, 0,0,1,2));
1130 expected.push_back(
IntArgs(4, 0,1,1,1));
1131 expected.push_back(
IntArgs(4, 0,1,1,2));
1132 expected.push_back(
IntArgs(4, 0,1,2,2));
1133 expected.push_back(
IntArgs(4, 0,1,2,3));
1148 for (
int i = 0 ;
i <
n ;
i++) {
1162 {
return new Latin(*
this); }
1165 for (
int i = 0 ;
i <
a.size() ; ++
i)
1172 static std::vector<IntArgs> expected;
1174 expected.push_back(
IntArgs(16, 1,2,3,4, 2,1,4,3, 3,4,1,2, 4,3,2,1));
1175 expected.push_back(
IntArgs(16, 1,2,3,4, 2,1,4,3, 3,4,2,1, 4,3,1,2));
1176 expected.push_back(
IntArgs(16, 1,2,3,4, 2,3,4,1, 3,4,1,2, 4,1,2,3));
1177 expected.push_back(
IntArgs(16, 1,2,3,4, 2,4,1,3, 3,1,4,2, 4,3,2,1));
1187 bool r =
check(e, Latin::expectedSolutions());
1226 static const int n = 4;
1228 static const int l = 0;
1230 static const int u = 1;
1236 va << xs[0] << xs[2];
1244 static std::vector<IntArgs> expected;
1246 expected.push_back(
IntArgs(4, 0,0,0,0));
1247 expected.push_back(
IntArgs(4, 0,0,0,1));
1260 expected.push_back(
IntArgs(4, 0,1,0,1));
1262 expected.push_back(
IntArgs(4, 1,0,1,0));
1263 expected.push_back(
IntArgs(4, 1,0,1,1));
1264 expected.push_back(
IntArgs(4, 1,1,1,1));
1279 static const int n = 4;
1281 static const int l = 0;
1283 static const int u = 3;
1292 rel(home, xs[1] != xs[2]);
1303 static std::vector<IntArgs> expected;
1305 expected.push_back(
IntArgs(4, 3,2,0,1));
1310 #ifdef GECODE_HAS_SET_VARS 1319 int x = va_arg(args,
int);
1336 static const int n = 2;
1338 static const int l = 0;
1340 static const int u = 1;
1349 static std::vector<IntSetArgs> expected;
1351 expected.push_back(
ISA(2, 0,1,-1, 0,1,-1));
1352 expected.push_back(
ISA(2, 0,1,-1, 0, -1));
1353 expected.push_back(
ISA(2, 0,1,-1, 1,-1));
1354 expected.push_back(
ISA(2, 0,1,-1, -1));
1355 expected.push_back(
ISA(2, 0, -1, 0,1,-1));
1356 expected.push_back(
ISA(2, 0, -1, 0, -1));
1357 expected.push_back(
ISA(2, 0, -1, 1,-1));
1358 expected.push_back(
ISA(2, 0, -1, -1));
1361 expected.push_back(
ISA(2, 1,-1, 1,-1));
1362 expected.push_back(
ISA(2, 1,-1, -1));
1366 expected.push_back(
ISA(2, -1, -1));
1386 static const int n = 2;
1388 static const int l = 0;
1390 static const int u = 1;
1399 static std::vector<IntSetArgs> expected;
1401 expected.push_back(
ISA(2, 0,1,-1, 0,1,-1));
1402 expected.push_back(
ISA(2, 0,1,-1, 0, -1));
1404 expected.push_back(
ISA(2, 0,1,-1, -1));
1405 expected.push_back(
ISA(2, 0, -1, 0,1,-1));
1406 expected.push_back(
ISA(2, 0, -1, 0, -1));
1407 expected.push_back(
ISA(2, 0, -1, 1,-1));
1408 expected.push_back(
ISA(2, 0, -1, -1));
1413 expected.push_back(
ISA(2, -1, 0,1,-1));
1414 expected.push_back(
ISA(2, -1, 0, -1));
1416 expected.push_back(
ISA(2, -1, -1));
1425 static const int n = 3;
1427 static const int l = 1;
1429 static const int u = 4;
1434 for (
int i = 0 ;
i < 3 ;
i++)
1440 static std::vector<IntSetArgs> expected;
1442 expected.push_back(
ISA(3, 1,-1, 1,-1, 1,-1));
1443 expected.push_back(
ISA(3, 1,-1, 1,-1, 2,-1));
1444 expected.push_back(
ISA(3, 1,-1, 2,-1, 1,-1));
1445 expected.push_back(
ISA(3, 1,-1, 2,-1, 2,-1));
1446 expected.push_back(
ISA(3, 1,-1, 2,-1, 3,-1));
1455 static const int n = 4;
1457 static const int l = 0;
1459 static const int u = 1;
1466 for (
int i = 0 ;
i < 4 ;
i++)
1472 static std::vector<IntSetArgs> expected;
1474 expected.push_back(
ISA(4, 0,-1, 1,-1, 0,-1, 1,-1));
1475 expected.push_back(
ISA(4, 0,-1, 1,-1, 1,-1, 0,-1));
1477 expected.push_back(
ISA(4, 1,-1, 0,-1, 1,-1, 0,-1));
1486 static const int n = 4;
1488 static const int l = 0;
1490 static const int u = 0;
1500 static std::vector<IntSetArgs> expected;
1504 expected.push_back(
ISA(4, 0, -1,0,-1,0,-1,0,-1));
1505 expected.push_back(
ISA(4, 0, -1,0,-1,0,-1, -1));
1509 expected.push_back(
ISA(4, 0, -1, -1,0,-1, -1));
1514 expected.push_back(
ISA(4, -1,0,-1, -1,0,-1));
1515 expected.push_back(
ISA(4, -1,0,-1, -1, -1));
1519 expected.push_back(
ISA(4, -1, -1, -1, -1));
1529 static const int n = 6;
1531 static const int l = 0;
1533 static const int u = 6;
1539 rel(home,
abs(m(0,0)-m(1,0))==1);
1540 rel(home,
abs(m(0,1)-m(1,1))==1);
1541 rel(home,
abs(m(1,0)-m(2,0))==1);
1542 rel(home,
abs(m(1,1)-m(2,1))==1);
1552 static std::vector<IntArgs> expected;
1554 expected.push_back(
IntArgs(6, 0,1,2,3,4,5));
1555 expected.push_back(
IntArgs(6, 0,1,2,4,5,6));
1556 expected.push_back(
IntArgs(6, 0,1,2,5,4,3));
1557 expected.push_back(
IntArgs(6, 0,1,2,6,5,4));
1566 static const int n = 2;
1568 static const int l = 0;
1570 static const int u = 3;
1579 static std::vector<IntArgs> expected;
1581 expected.push_back(
IntArgs(2, 0,0));
1582 expected.push_back(
IntArgs(2, 0,1));
1583 expected.push_back(
IntArgs(2, 0,2));
1584 expected.push_back(
IntArgs(2, 0,3));
1585 expected.push_back(
IntArgs(2, 1,0));
1586 expected.push_back(
IntArgs(2, 1,1));
1587 expected.push_back(
IntArgs(2, 1,2));
1588 expected.push_back(
IntArgs(2, 1,3));
1597 static const int n = 4;
1599 static const int l = 0;
1601 static const int u = 3;
1612 static std::vector<IntArgs> expected;
1614 expected.push_back(
IntArgs(4, 0,1,2,3));
1649 #ifdef GECODE_HAS_SET_VARS unsigned int c_d
Recomputation distance.
unsigned int a_d
Create a clone during recomputation if distance is greater than a_d (adaptive distance) ...
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...
LDSB< ValSym3 > valsym3("ValSym3")
static IntArgs create(int n, int start, int inc=1)
Allocate array with n elements such that for all .
LDSB< Action1 > action1("Action1")
static void setup(Home home, SetVarArray &xs)
Setup problem constraints and symmetries.
LDSB< ReflectSym2 > reflectsym2("ReflectSym2")
Test for set value symmetry
IntVarBranch INT_VAR_NONE(void)
Select first unassigned variable.
Combine variable selection criteria for tie-breaking.
Slice< A > col(int c) const
Access column c.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
void finalize(void)
Finalize tuple set.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
Test for variable sequence symmetry
unsigned int c_d
Recomputation distance.
int size(void) const
Return size of array (number of elements)
LDSB< VarSym2 > varsym2("VarSym2")
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
virtual Space * copy(void)
Copying member function.
static std::vector< IntSetArgs > expectedSolutions(void)
Compute list of expected solutions.
IntSetArgs ISA(int n,...)
Convenient way to make IntSetArgs.
int size(void) const
Return size of array (number of elements)
SymmetryHandle VariableSymmetry(const SetVarArgs &x)
void update(Space &home, VarArray< Var > &a)
Update array to be a clone of array a.
unsigned int c_d
Create a clone after every c_d commits (commit distance)
void abs(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
Test for value sequence symmetry
Test for variable symmetry
LDSB< MatSym2 > matsym2("MatSym2")
IntVarBranch INT_VAR_DEGREE_MAX(BranchTbl tbl)
Select variable with largest degree.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
LDSBLatin(std::string label)
Initialize test.
virtual T * next(void)
Return next solution (NULL, if none exists or search has been stopped)
bool check(DFS< T > &e, std::vector< VarArgsType > expected)
Checks found solutions against expected solutions.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
Collection of symmetries.
void linear(Home home, const FloatVarArgs &x, FloatRelType frt, FloatVal c)
Post propagator for .
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
Slice< A > slice(int fc, int tc, int fr, int tr) const
Access slice of the matrix.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
LDSB< VarValSym1 > varvalsym1("VarValSym1")
LDSBSet(std::string label, unsigned int c=0, unsigned int a=0)
Initialize test.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
IntVarBranch INT_VAR_MERIT_MAX(IntBranchMerit bm, BranchTbl tbl)
Select variable with highest merit according to branch merit function bm.
LDSB< VarSym5 > varsym5("VarSym5")
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
Test for set variable sequence symmetry
SymmetryHandle columns_interchange(const Matrix< A > &m)
Interchangeable columns symmetry specification.
LDSB< ValSym1b > valsym1b("ValSym1b")
Test for set value symmetry
Test for variable and value symmetry
LDSB< ValSym1c > valsym1c("ValSym1c")
LDSB< VarSym3 > varsym3("VarSym3")
Test for variable sequence symmetry
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
SetVarBranch SET_VAR_NONE(void)
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
static std::vector< IntSetArgs > expectedSolutions(void)
Compute list of expected solutions.
int val(void) const
Return current value.
LDSB< ValSym4 > valsym4("ValSym4")
bool run(void)
Perform actual tests.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
LDSB< MatSym4 > matsym4("MatSym4")
LDSB< ValSym2 > valsym2("ValSym2")
Test for value sequence symmetry
OneArray(OneArray &s)
Constructor for cloning s.
LDSBSet< SetValSym2 > setvalsym2("SetValSym2", 0, 1)
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
Test for LDSB infrastructure
LDSB(std::string label, unsigned int c=0, unsigned int a=0)
Initialize test.
static std::vector< IntSetArgs > expectedSolutions(void)
Compute list of expected solutions.
Gecode::FloatVal c(-8, 8)
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
Gecode::IntArgs i(4, 1, 2, 3, 4)
LDSB< VarSym1b > varsym1b("VarSym1b")
LDSB< ReflectSym1 > reflectsym1("ReflectSym1")
int n
Number of negative literals for node type.
Test for reflection symmetry
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
LDSBSet< SetVarSeqSym1 > setvarseqsym1("SetVarSeqSym1")
virtual IntSetArgs * expectedSolutions(void)
Expected solutions.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
SymmetryHandle ValueSequenceSymmetry(const IntArgs &vs, int ss)
Value sequences in v of size ss are interchangeable.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
static const Options def
Default options.
const unsigned int a_d
Create a clone during recomputation if distance is greater than a_d (adaptive distance) ...
void extensional(Home home, const IntVarArgs &x, DFA dfa, IntPropLevel)
Post domain consistent propagator for extensional constraint described by a DFA.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
LDSBSet< SetVarSym1 > setvarsym1("SetVarSym1")
OneArray(int n, int l, int u)
Constructor for creation.
Test for set variable sequence symmetry
IntArgs solution(void)
Return the solution as IntArgs.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
LDSB< SimIntValSym2 > simintvalsym2("SimIntValSym2")
Test for variable symmetry
IntValBranch INT_VAL_MIN(void)
Select smallest value.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
unsigned int size(I &i)
Size of all ranges of range iterator i.
bool run(void)
Perform actual tests.
Base class for all tests to be run
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
void distinct(Home home, const IntVarArgs &x, IntPropLevel ipl)
Post propagator for for all .
Iterator for the greatest lower bound ranges of a set variable.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
LDSB< VarSym1 > varsym1("VarSym1")
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
LDSB< TieBreak > tiebreak("TieBreak")
static std::vector< IntSetArgs > expectedSolutions(void)
Compute list of expected solutions.
union Gecode::@585::NNF::@62 u
Union depending on nodetype t.
LDSB< SimIntValSym1 > simintvalsym1("SimIntValSym1")
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
OneArraySet(int n, int l, int u)
Constructor for creation.
static void setup(Home home, SetVarArray &xs)
Setup problem constraints and symmetries.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
Passing integer variables.
virtual Space * copy(void)
Copy during cloning.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
unsigned int a_d
Adaptation distance.
Passing integer arguments.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
SetValBranch SET_VAL_MIN_INC(void)
static const IntSet empty
Empty set.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
SymmetryHandle columns_reflect(const Matrix< A > &m)
Reflect columns symmetry specification.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
LinIntExpr cardinality(const SetExpr &e)
Cardinality of set expression.
double position(const Space &home, IntVar x, int i)
Class represeting a set of tuples.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
Test for reflection symmetry
IntValBranch INT_VAL_MAX(void)
Select largest value.
struct Gecode::@585::NNF::@62::@63 b
For binary nodes (and, or, eqv)
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
Post propagator for SetVar SetOpType SetVar y
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
Test for set variable symmetry
static std::vector< IntSetArgs > expectedSolutions(void)
Compute list of expected solutions.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
LDSB< ValSym5 > valsym5("ValSym5")
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
Node * x
Pointer to corresponding Boolean expression node.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
virtual IntArgs * expectedSolutions(void)
Expected solutions.
struct Gecode::@585::NNF::@62::@64 a
For atomic nodes.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
LDSB< ValSym2b > valsym2b("ValSym2b")
Test for variable symmetry
static void setup(Home home, SetVarArray &xs)
Setup problem constraints and symmetries.
unsigned int a_d
Adaptation distance.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
Slice< A > row(int r) const
Access row r.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
IntVarBranch INT_VAR_ACTION_MIN(double d, BranchTbl tbl)
Select variable with lowest action with decay factor d.
std::ostringstream olog
Stream used for logging.
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
Value iterator for integer sets.
IntValBranch INT_VAL_MED(void)
Select greatest value not greater than the median.
SymmetryHandle rows_interchange(const Matrix< A > &m)
Interchangeable rows symmetry specification.
Test for variable symmetry
LDSB< MatSym1 > matsym1("MatSym1")
const unsigned int c_d
Create a clone after every c_d commits (commit distance)
static void setup(Home home, SetVarArray &xs)
Setup problem constraints and symmetries.
SymmetryHandle values_reflect(const IntVar &x)
void values(Home home, const IntVarArgs &x, IntSet y, IntPropLevel ipl=IPL_DEF)
Post constraint .
OneArraySet(OneArraySet &s)
Constructor for cloning s.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
Matrix-interface for arrays.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
LDSB< SimIntValSym3 > simintvalsym3("SimIntValSym3")
Test for handling of recomputation
TupleSet & add(const IntArgs &t)
Add tuple t to tuple set.
LDSB< SimIntVarSym1 > simintvarsym1("SimIntVarSym1")
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
Gecode toplevel namespace
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
LDSB< VarSym4 > varsym4("VarSym4")
Test for LDSB infrastructure
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
SymmetryHandle VariableSequenceSymmetry(const SetVarArgs &x, int ss)
Variable sequences in x of size ss are interchangeable.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
Test for variable symmetry
Home class for posting propagators
virtual Space * copy(void)
Copy during cloning.
LDSB< ValSym1 > valsym1("ValSym1")
Test for LDSB infrastructure with Latin square problem
bool run(void)
Perform actual tests.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
Depth-first search engine.
LDSB< Recomputation > recomp("Recomputation", 999, 999)
Test for value sequence symmetry
static void setup(Home home, SetVarArray &xs)
Setup problem constraints and symmetries.
static void setup(Home home, IntVarArray &xs)
Setup problem constraints and symmetries.
LDSBSet< SetVarSeqSym2 > setvarseqsym2("SetVarSeqSym2")
void branch(Home home, const SetVarArgs &x, TieBreak< SetVarBranch > vars, SetValBranch vals, const Symmetries &syms, SetBranchFilter bf, SetVarValPrint vvp)
Branch over x with tie-breaking variable selection vars and value selection vals with symmetry breaki...
LDSBSet< SetValSym1 > setvalsym1("SetValSym1")
LDSB< SimIntVarSym2 > simintvarsym2("SimIntVarSym2")
SymmetryHandle rows_reflect(const Matrix< A > &m)
Reflect rows symmetry specification.
IntSetArgs solution(void)
Return the solution as IntSetArgs.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
SymmetryHandle ValueSymmetry(IntVar x)
All values in the domain of the given variable are interchangeable.
Test for variable symmetry
LDSB< MatSym3 > matsym3("MatSym3")