38 #ifdef GECODE_HAS_SET_VARS 53 namespace Test {
namespace LDSB {
61 if (a.
size() != b.
size())
return false;
62 for (
int i = 0 ;
i < a.
size() ; ++
i)
68 #ifdef GECODE_HAS_SET_VARS 73 if (a.
size() != b.
size())
return false;
74 for (
int i = 0 ;
i < a.
size() ; ++
i) {
81 if (x.
val() != y.
val())
return false;
99 template <
class T,
class VarArgsType>
102 int nexpected = expected.size();
103 for (
int i = 0 ;
i < nexpected ; ++
i) {
107 olog <<
"Expected a solution but there are no more solutions." << std::endl;
108 olog <<
"(Expected " << nexpected <<
" but only found " <<
i <<
")" << std::endl;
109 olog <<
"Expected: " << expected[
i] << std::endl;
113 if (!
equal(s->solution(), expected[
i])) {
115 olog <<
"Solution does not match expected." << std::endl;
116 olog <<
"Solution: " << s->solution() << std::endl;
117 olog <<
"Expected: " << expected[
i] << std::endl;
126 olog <<
"More solutions than expected:" << std::endl;
127 olog <<
"(Expected only " << nexpected <<
")" << std::endl;
128 olog << s->solution() << std::endl;
157 for (
int i = 0 ;
i <
a.size() ; ++
i)
165 #ifdef GECODE_HAS_SET_VARS 185 for (
int i = 0 ;
i <
a.size() ; ++
i) {
205 LDSB(std::string label,
unsigned int c=0,
unsigned int a=0)
213 if (c_d != 0) o.
c_d =
c_d;
214 if (a_d != 0) o.
a_d =
a_d;
216 bool r =
check(e, T::expectedSolutions());
222 #ifdef GECODE_HAS_SET_VARS 232 LDSBSet(std::string label,
unsigned int c=0,
unsigned int a=0)
240 if (c_d != 0) o.
c_d =
c_d;
241 if (a_d != 0) o.
a_d =
a_d;
243 bool r =
check(e, T::expectedSolutions());
256 static const int n = 4;
258 static const int l = 0;
260 static const int u = 3;
271 static std::vector<IntArgs> expected;
273 expected.push_back(
IntArgs(4, 0,1,2,3));
282 static const int n = 4;
284 static const int l = 0;
286 static const int u = 3;
296 static std::vector<IntArgs> expected;
298 expected.push_back(
IntArgs(4, 0,1,2,3));
307 static const int n = 4;
309 static const int l = 0;
311 static const int u = 3;
321 static std::vector<IntArgs> expected;
323 expected.push_back(
IntArgs(4, 0,0,0,0));
324 expected.push_back(
IntArgs(4, 0,0,0,1));
325 expected.push_back(
IntArgs(4, 0,0,0,2));
326 expected.push_back(
IntArgs(4, 0,0,0,3));
327 expected.push_back(
IntArgs(4, 0,0,1,1));
328 expected.push_back(
IntArgs(4, 0,0,1,2));
329 expected.push_back(
IntArgs(4, 0,0,1,3));
330 expected.push_back(
IntArgs(4, 0,0,2,2));
331 expected.push_back(
IntArgs(4, 0,0,2,3));
332 expected.push_back(
IntArgs(4, 0,0,3,3));
333 expected.push_back(
IntArgs(4, 0,1,1,1));
334 expected.push_back(
IntArgs(4, 0,1,1,2));
335 expected.push_back(
IntArgs(4, 0,1,1,3));
336 expected.push_back(
IntArgs(4, 0,1,2,2));
337 expected.push_back(
IntArgs(4, 0,1,2,3));
338 expected.push_back(
IntArgs(4, 0,1,3,3));
339 expected.push_back(
IntArgs(4, 0,2,2,2));
340 expected.push_back(
IntArgs(4, 0,2,2,3));
341 expected.push_back(
IntArgs(4, 0,2,3,3));
342 expected.push_back(
IntArgs(4, 0,3,3,3));
343 expected.push_back(
IntArgs(4, 1,1,1,1));
344 expected.push_back(
IntArgs(4, 1,1,1,2));
345 expected.push_back(
IntArgs(4, 1,1,1,3));
346 expected.push_back(
IntArgs(4, 1,1,2,2));
347 expected.push_back(
IntArgs(4, 1,1,2,3));
348 expected.push_back(
IntArgs(4, 1,1,3,3));
349 expected.push_back(
IntArgs(4, 1,2,2,2));
350 expected.push_back(
IntArgs(4, 1,2,2,3));
351 expected.push_back(
IntArgs(4, 1,2,3,3));
352 expected.push_back(
IntArgs(4, 1,3,3,3));
353 expected.push_back(
IntArgs(4, 2,2,2,2));
354 expected.push_back(
IntArgs(4, 2,2,2,3));
355 expected.push_back(
IntArgs(4, 2,2,3,3));
356 expected.push_back(
IntArgs(4, 2,3,3,3));
357 expected.push_back(
IntArgs(4, 3,3,3,3));
366 static const int n = 4;
368 static const int l = 0;
370 static const int u = 3;
380 static std::vector<IntArgs> expected;
382 expected.push_back(
IntArgs(4, 0,1,2,3));
383 expected.push_back(
IntArgs(4, 0,1,3,2));
384 expected.push_back(
IntArgs(4, 0,2,1,3));
385 expected.push_back(
IntArgs(4, 0,2,3,1));
386 expected.push_back(
IntArgs(4, 0,3,1,2));
387 expected.push_back(
IntArgs(4, 0,3,2,1));
388 expected.push_back(
IntArgs(4, 1,2,0,3));
389 expected.push_back(
IntArgs(4, 1,2,3,0));
390 expected.push_back(
IntArgs(4, 1,3,0,2));
391 expected.push_back(
IntArgs(4, 1,3,2,0));
392 expected.push_back(
IntArgs(4, 2,3,0,1));
393 expected.push_back(
IntArgs(4, 2,3,1,0));
402 static const int n = 3;
404 static const int l = 0;
406 static const int u = 2;
418 static std::vector<IntArgs> expected;
420 expected.push_back(
IntArgs(3, 0,1,2));
421 expected.push_back(
IntArgs(3, 0,2,1));
422 expected.push_back(
IntArgs(3, 1,0,2));
423 expected.push_back(
IntArgs(3, 1,2,0));
424 expected.push_back(
IntArgs(3, 2,0,1));
425 expected.push_back(
IntArgs(3, 2,1,0));
434 static const int n = 4;
436 static const int l = 0;
438 static const int u = 3;
450 static std::vector<IntArgs> expected;
452 expected.push_back(
IntArgs(4, 0,1,2,3));
453 expected.push_back(
IntArgs(4, 0,2,1,3));
454 expected.push_back(
IntArgs(4, 0,3,1,2));
455 expected.push_back(
IntArgs(4, 1,2,0,3));
456 expected.push_back(
IntArgs(4, 1,3,0,2));
457 expected.push_back(
IntArgs(4, 2,3,0,1));
466 static const int n = 6;
468 static const int l = 0;
470 static const int u = 1;
480 static std::vector<IntArgs> expected;
482 expected.push_back(
IntArgs(6, 0,0, 0,0, 0,0));
483 expected.push_back(
IntArgs(6, 0,0, 0,0, 0,1));
484 expected.push_back(
IntArgs(6, 0,0, 0,0, 1,0));
485 expected.push_back(
IntArgs(6, 0,0, 0,0, 1,1));
486 expected.push_back(
IntArgs(6, 0,0, 0,1, 0,0));
487 expected.push_back(
IntArgs(6, 0,0, 0,1, 0,1));
488 expected.push_back(
IntArgs(6, 0,0, 0,1, 1,0));
489 expected.push_back(
IntArgs(6, 0,0, 0,1, 1,1));
490 expected.push_back(
IntArgs(6, 0,0, 1,0, 1,0));
491 expected.push_back(
IntArgs(6, 0,0, 1,0, 1,1));
492 expected.push_back(
IntArgs(6, 0,0, 1,1, 1,1));
493 expected.push_back(
IntArgs(6, 0,1, 0,0, 0,0));
494 expected.push_back(
IntArgs(6, 0,1, 0,0, 0,1));
495 expected.push_back(
IntArgs(6, 0,1, 0,0, 1,0));
496 expected.push_back(
IntArgs(6, 0,1, 0,0, 1,1));
497 expected.push_back(
IntArgs(6, 0,1, 0,1, 0,0));
498 expected.push_back(
IntArgs(6, 0,1, 0,1, 0,1));
499 expected.push_back(
IntArgs(6, 0,1, 0,1, 1,0));
500 expected.push_back(
IntArgs(6, 0,1, 0,1, 1,1));
501 expected.push_back(
IntArgs(6, 0,1, 1,0, 1,0));
502 expected.push_back(
IntArgs(6, 0,1, 1,0, 1,1));
503 expected.push_back(
IntArgs(6, 0,1, 1,1, 1,1));
504 expected.push_back(
IntArgs(6, 1,0, 1,0, 1,0));
505 expected.push_back(
IntArgs(6, 1,0, 1,0, 1,1));
506 expected.push_back(
IntArgs(6, 1,0, 1,1, 1,1));
507 expected.push_back(
IntArgs(6, 1,1, 1,1, 1,1));
516 static const int n = 6;
518 static const int l = 0;
520 static const int u = 1;
530 static std::vector<IntArgs> expected;
532 expected.push_back(
IntArgs(6, 0,0, 0,0, 0,0));
533 expected.push_back(
IntArgs(6, 0,0, 0,0, 0,1));
534 expected.push_back(
IntArgs(6, 0,0, 0,0, 1,1));
535 expected.push_back(
IntArgs(6, 0,0, 0,1, 0,0));
536 expected.push_back(
IntArgs(6, 0,0, 0,1, 0,1));
537 expected.push_back(
IntArgs(6, 0,0, 0,1, 1,0));
538 expected.push_back(
IntArgs(6, 0,0, 0,1, 1,1));
539 expected.push_back(
IntArgs(6, 0,0, 1,1, 0,0));
540 expected.push_back(
IntArgs(6, 0,0, 1,1, 0,1));
541 expected.push_back(
IntArgs(6, 0,0, 1,1, 1,1));
542 expected.push_back(
IntArgs(6, 0,1, 0,0, 0,0));
543 expected.push_back(
IntArgs(6, 0,1, 0,0, 0,1));
544 expected.push_back(
IntArgs(6, 0,1, 0,0, 1,0));
545 expected.push_back(
IntArgs(6, 0,1, 0,0, 1,1));
546 expected.push_back(
IntArgs(6, 0,1, 0,1, 0,0));
547 expected.push_back(
IntArgs(6, 0,1, 0,1, 0,1));
548 expected.push_back(
IntArgs(6, 0,1, 0,1, 1,0));
549 expected.push_back(
IntArgs(6, 0,1, 0,1, 1,1));
550 expected.push_back(
IntArgs(6, 0,1, 1,0, 0,0));
551 expected.push_back(
IntArgs(6, 0,1, 1,0, 0,1));
552 expected.push_back(
IntArgs(6, 0,1, 1,0, 1,0));
553 expected.push_back(
IntArgs(6, 0,1, 1,0, 1,1));
554 expected.push_back(
IntArgs(6, 0,1, 1,1, 0,0));
555 expected.push_back(
IntArgs(6, 0,1, 1,1, 0,1));
556 expected.push_back(
IntArgs(6, 0,1, 1,1, 1,0));
557 expected.push_back(
IntArgs(6, 0,1, 1,1, 1,1));
558 expected.push_back(
IntArgs(6, 1,1, 0,0, 0,0));
559 expected.push_back(
IntArgs(6, 1,1, 0,0, 0,1));
560 expected.push_back(
IntArgs(6, 1,1, 0,0, 1,1));
561 expected.push_back(
IntArgs(6, 1,1, 0,1, 0,0));
562 expected.push_back(
IntArgs(6, 1,1, 0,1, 0,1));
563 expected.push_back(
IntArgs(6, 1,1, 0,1, 1,0));
564 expected.push_back(
IntArgs(6, 1,1, 0,1, 1,1));
565 expected.push_back(
IntArgs(6, 1,1, 1,1, 0,0));
566 expected.push_back(
IntArgs(6, 1,1, 1,1, 0,1));
567 expected.push_back(
IntArgs(6, 1,1, 1,1, 1,1));
576 static const int n = 6;
578 static const int l = 0;
580 static const int u = 1;
591 static std::vector<IntArgs> expected;
593 expected.push_back(
IntArgs(6, 0,0, 0,0, 0,0));
594 expected.push_back(
IntArgs(6, 0,0, 0,0, 0,1));
595 expected.push_back(
IntArgs(6, 0,0, 0,0, 1,1));
596 expected.push_back(
IntArgs(6, 0,0, 0,1, 0,0));
597 expected.push_back(
IntArgs(6, 0,0, 0,1, 0,1));
598 expected.push_back(
IntArgs(6, 0,0, 0,1, 1,0));
599 expected.push_back(
IntArgs(6, 0,0, 0,1, 1,1));
600 expected.push_back(
IntArgs(6, 0,0, 1,1, 1,1));
601 expected.push_back(
IntArgs(6, 0,1, 0,0, 0,0));
602 expected.push_back(
IntArgs(6, 0,1, 0,0, 0,1));
603 expected.push_back(
IntArgs(6, 0,1, 0,0, 1,0));
604 expected.push_back(
IntArgs(6, 0,1, 0,0, 1,1));
605 expected.push_back(
IntArgs(6, 0,1, 0,1, 0,0));
606 expected.push_back(
IntArgs(6, 0,1, 0,1, 0,1));
607 expected.push_back(
IntArgs(6, 0,1, 0,1, 1,0));
608 expected.push_back(
IntArgs(6, 0,1, 0,1, 1,1));
609 expected.push_back(
IntArgs(6, 0,1, 1,0, 1,0));
610 expected.push_back(
IntArgs(6, 0,1, 1,0, 1,1));
611 expected.push_back(
IntArgs(6, 0,1, 1,1, 1,1));
612 expected.push_back(
IntArgs(6, 1,1, 1,1, 1,1));
621 static const int n = 4;
623 static const int l = 0;
625 static const int u = 1;
635 static std::vector<IntArgs> expected;
637 expected.push_back(
IntArgs(4, 0, 0, 0, 0));
638 expected.push_back(
IntArgs(4, 0, 0, 0, 1));
639 expected.push_back(
IntArgs(4, 0, 0, 1, 0));
640 expected.push_back(
IntArgs(4, 0, 0, 1, 1));
641 expected.push_back(
IntArgs(4, 0, 1, 0, 0));
642 expected.push_back(
IntArgs(4, 0, 1, 0, 1));
643 expected.push_back(
IntArgs(4, 0, 1, 1, 0));
644 expected.push_back(
IntArgs(4, 0, 1, 1, 1));
645 expected.push_back(
IntArgs(4, 1, 0, 0, 1));
646 expected.push_back(
IntArgs(4, 1, 0, 1, 1));
647 expected.push_back(
IntArgs(4, 1, 1, 1, 1));
656 static const int n = 12;
658 static const int l = 0;
660 static const int u = 3;
667 for (
int i = 0 ;
i < 4 ; ++
i)
677 static std::vector<IntArgs> expected;
679 expected.push_back(
IntArgs(12, 0,0,3, 1,0,2, 2,0,1, 3,0,0));
680 expected.push_back(
IntArgs(12, 0,0,3, 1,0,2, 2,1,0, 3,0,0));
681 expected.push_back(
IntArgs(12, 0,0,3, 1,1,1, 2,0,1, 3,0,0));
682 expected.push_back(
IntArgs(12, 0,0,3, 1,1,1, 2,1,0, 3,0,0));
683 expected.push_back(
IntArgs(12, 0,0,3, 1,2,0, 2,0,1, 3,0,0));
684 expected.push_back(
IntArgs(12, 0,0,3, 1,2,0, 2,1,0, 3,0,0));
685 expected.push_back(
IntArgs(12, 0,1,2, 1,0,2, 2,0,1, 3,0,0));
686 expected.push_back(
IntArgs(12, 0,1,2, 1,0,2, 2,1,0, 3,0,0));
687 expected.push_back(
IntArgs(12, 0,1,2, 1,1,1, 2,0,1, 3,0,0));
688 expected.push_back(
IntArgs(12, 0,1,2, 1,1,1, 2,1,0, 3,0,0));
689 expected.push_back(
IntArgs(12, 0,1,2, 1,2,0, 2,0,1, 3,0,0));
690 expected.push_back(
IntArgs(12, 0,1,2, 1,2,0, 2,1,0, 3,0,0));
691 expected.push_back(
IntArgs(12, 0,2,1, 1,0,2, 2,0,1, 3,0,0));
692 expected.push_back(
IntArgs(12, 0,2,1, 1,0,2, 2,1,0, 3,0,0));
693 expected.push_back(
IntArgs(12, 0,2,1, 1,1,1, 2,0,1, 3,0,0));
694 expected.push_back(
IntArgs(12, 0,2,1, 1,1,1, 2,1,0, 3,0,0));
695 expected.push_back(
IntArgs(12, 0,2,1, 1,2,0, 2,0,1, 3,0,0));
696 expected.push_back(
IntArgs(12, 0,2,1, 1,2,0, 2,1,0, 3,0,0));
697 expected.push_back(
IntArgs(12, 0,3,0, 1,0,2, 2,0,1, 3,0,0));
698 expected.push_back(
IntArgs(12, 0,3,0, 1,0,2, 2,1,0, 3,0,0));
699 expected.push_back(
IntArgs(12, 0,3,0, 1,1,1, 2,0,1, 3,0,0));
700 expected.push_back(
IntArgs(12, 0,3,0, 1,1,1, 2,1,0, 3,0,0));
701 expected.push_back(
IntArgs(12, 0,3,0, 1,2,0, 2,0,1, 3,0,0));
702 expected.push_back(
IntArgs(12, 0,3,0, 1,2,0, 2,1,0, 3,0,0));
710 static const int nrows = 4;
712 static const int ncols = 3;
715 static const int n = nrows*ncols;
717 static const int l = 0;
719 static const int u = 3;
726 for (
int i = 0 ;
i < nrows ; ++
i)
736 for (
int i = 0 ;
i < nrows ;
i++) {
738 symvars << m(1,
i) << m(2,
i);
745 static std::vector<IntArgs> expected;
747 expected.push_back(
IntArgs(12, 0,0,3, 1,0,2, 2,0,1, 3,0,0));
748 expected.push_back(
IntArgs(12, 0,0,3, 1,1,1, 2,0,1, 3,0,0));
749 expected.push_back(
IntArgs(12, 0,1,2, 1,0,2, 2,0,1, 3,0,0));
750 expected.push_back(
IntArgs(12, 0,1,2, 1,1,1, 2,0,1, 3,0,0));
759 static const int n = 2;
761 static const int l = 0;
763 static const int u = 6;
766 rel(home, xs[0] + xs[1] == 6);
775 static std::vector<IntArgs> expected;
777 expected.push_back(
IntArgs(2, 0,6));
778 expected.push_back(
IntArgs(2, 1,5));
779 expected.push_back(
IntArgs(2, 2,4));
780 expected.push_back(
IntArgs(2, 3,3));
789 static const int n = 3;
791 static const int l = 0;
793 static const int u = 8;
811 static std::vector<IntArgs> expected;
813 expected.push_back(
IntArgs(3, 0,1,5));
814 expected.push_back(
IntArgs(3, 1,1,1));
823 static const int n = 2;
825 static const int l = 0;
827 static const int u = 6;
830 rel(home, xs[0] + xs[1] == 6);
838 static std::vector<IntArgs> expected;
840 expected.push_back(
IntArgs(2, 3,3));
841 expected.push_back(
IntArgs(2, 2,4));
842 expected.push_back(
IntArgs(2, 1,5));
843 expected.push_back(
IntArgs(2, 0,6));
852 static const int n = 4;
854 static const int l = 0;
856 static const int u = 3;
867 static std::vector<IntArgs> expected;
869 expected.push_back(
IntArgs(4, 0,1,2,3));
878 static const int n = 4;
880 static const int l = 0;
882 static const int u = 3;
892 static std::vector<IntArgs> expected;
894 expected.push_back(
IntArgs(4, 0,1,2,3));
903 static const int n = 4;
905 static const int l = 0;
907 static const int u = 3;
917 static std::vector<IntArgs> expected;
919 expected.push_back(
IntArgs(4, 3,2,1,0));
928 static const int n = 4;
930 static const int l = 0;
932 static const int u = 3;
942 static std::vector<IntArgs> expected;
944 expected.push_back(
IntArgs(4, 0,0,0,0));
945 expected.push_back(
IntArgs(4, 0,0,0,1));
946 expected.push_back(
IntArgs(4, 0,0,1,0));
947 expected.push_back(
IntArgs(4, 0,0,1,1));
948 expected.push_back(
IntArgs(4, 0,0,1,2));
949 expected.push_back(
IntArgs(4, 0,1,0,0));
950 expected.push_back(
IntArgs(4, 0,1,0,1));
951 expected.push_back(
IntArgs(4, 0,1,0,2));
952 expected.push_back(
IntArgs(4, 0,1,1,0));
953 expected.push_back(
IntArgs(4, 0,1,1,1));
954 expected.push_back(
IntArgs(4, 0,1,1,2));
955 expected.push_back(
IntArgs(4, 0,1,2,0));
956 expected.push_back(
IntArgs(4, 0,1,2,1));
957 expected.push_back(
IntArgs(4, 0,1,2,2));
958 expected.push_back(
IntArgs(4, 0,1,2,3));
967 static const int n = 4;
969 static const int l = 0;
971 static const int u = 3;
980 static std::vector<IntArgs> expected;
982 expected.push_back(
IntArgs(4, 0,0,0,0));
983 expected.push_back(
IntArgs(4, 0,0,0,1));
984 expected.push_back(
IntArgs(4, 0,0,1,0));
985 expected.push_back(
IntArgs(4, 0,0,1,1));
986 expected.push_back(
IntArgs(4, 0,0,1,2));
987 expected.push_back(
IntArgs(4, 0,1,0,0));
988 expected.push_back(
IntArgs(4, 0,1,0,1));
989 expected.push_back(
IntArgs(4, 0,1,0,2));
990 expected.push_back(
IntArgs(4, 0,1,1,0));
991 expected.push_back(
IntArgs(4, 0,1,1,1));
992 expected.push_back(
IntArgs(4, 0,1,1,2));
993 expected.push_back(
IntArgs(4, 0,1,2,0));
994 expected.push_back(
IntArgs(4, 0,1,2,1));
995 expected.push_back(
IntArgs(4, 0,1,2,2));
996 expected.push_back(
IntArgs(4, 0,1,2,3));
1005 static const int n = 4;
1007 static const int l = 0;
1009 static const int u = 3;
1020 static std::vector<IntArgs> expected;
1022 expected.push_back(
IntArgs(4, 0,1,2,3));
1023 expected.push_back(
IntArgs(4, 0,1,3,2));
1024 expected.push_back(
IntArgs(4, 0,2,1,3));
1025 expected.push_back(
IntArgs(4, 0,2,3,1));
1026 expected.push_back(
IntArgs(4, 0,3,1,2));
1027 expected.push_back(
IntArgs(4, 0,3,2,1));
1028 expected.push_back(
IntArgs(4, 2,0,1,3));
1029 expected.push_back(
IntArgs(4, 2,0,3,1));
1030 expected.push_back(
IntArgs(4, 2,3,0,1));
1031 expected.push_back(
IntArgs(4, 3,0,1,2));
1032 expected.push_back(
IntArgs(4, 3,0,2,1));
1033 expected.push_back(
IntArgs(4, 3,2,0,1));
1042 static const int n = 3;
1044 static const int l = 0;
1046 static const int u = 2;
1057 static std::vector<IntArgs> expected;
1059 expected.push_back(
IntArgs(3, 0,1,2));
1060 expected.push_back(
IntArgs(3, 0,2,1));
1061 expected.push_back(
IntArgs(3, 1,0,2));
1062 expected.push_back(
IntArgs(3, 1,2,0));
1063 expected.push_back(
IntArgs(3, 2,0,1));
1064 expected.push_back(
IntArgs(3, 2,1,0));
1073 static const int n = 4;
1075 static const int l = 0;
1077 static const int u = 3;
1090 static std::vector<IntArgs> expected;
1092 expected.push_back(
IntArgs(4, 0,1,2,3));
1093 expected.push_back(
IntArgs(4, 0,2,1,3));
1094 expected.push_back(
IntArgs(4, 0,2,3,1));
1095 expected.push_back(
IntArgs(4, 2,0,1,3));
1096 expected.push_back(
IntArgs(4, 2,0,3,1));
1097 expected.push_back(
IntArgs(4, 2,3,0,1));
1106 static const int n = 4;
1108 static const int l = 0;
1110 static const int u = 3;
1120 static std::vector<IntArgs> expected;
1122 expected.push_back(
IntArgs(4, 0,0,0,0));
1123 expected.push_back(
IntArgs(4, 0,0,0,1));
1124 expected.push_back(
IntArgs(4, 0,0,1,1));
1125 expected.push_back(
IntArgs(4, 0,0,1,2));
1126 expected.push_back(
IntArgs(4, 0,1,1,1));
1127 expected.push_back(
IntArgs(4, 0,1,1,2));
1128 expected.push_back(
IntArgs(4, 0,1,2,2));
1129 expected.push_back(
IntArgs(4, 0,1,2,3));
1144 for (
int i = 0 ;
i <
n ;
i++) {
1158 {
return new Latin(*
this); }
1161 for (
int i = 0 ;
i <
a.size() ; ++
i)
1168 static std::vector<IntArgs> expected;
1170 expected.push_back(
IntArgs(16, 1,2,3,4, 2,1,4,3, 3,4,1,2, 4,3,2,1));
1171 expected.push_back(
IntArgs(16, 1,2,3,4, 2,1,4,3, 3,4,2,1, 4,3,1,2));
1172 expected.push_back(
IntArgs(16, 1,2,3,4, 2,3,4,1, 3,4,1,2, 4,1,2,3));
1173 expected.push_back(
IntArgs(16, 1,2,3,4, 2,4,1,3, 3,1,4,2, 4,3,2,1));
1183 bool r =
check(e, Latin::expectedSolutions());
1222 static const int n = 4;
1224 static const int l = 0;
1226 static const int u = 1;
1232 va << xs[0] << xs[2];
1240 static std::vector<IntArgs> expected;
1242 expected.push_back(
IntArgs(4, 0,0,0,0));
1243 expected.push_back(
IntArgs(4, 0,0,0,1));
1256 expected.push_back(
IntArgs(4, 0,1,0,1));
1258 expected.push_back(
IntArgs(4, 1,0,1,0));
1259 expected.push_back(
IntArgs(4, 1,0,1,1));
1260 expected.push_back(
IntArgs(4, 1,1,1,1));
1275 static const int n = 4;
1277 static const int l = 0;
1279 static const int u = 3;
1288 rel(home, xs[1] != xs[2]);
1299 static std::vector<IntArgs> expected;
1301 expected.push_back(
IntArgs(4, 3,2,0,1));
1306 #ifdef GECODE_HAS_SET_VARS 1315 int x = va_arg(args,
int);
1332 static const int n = 2;
1334 static const int l = 0;
1336 static const int u = 1;
1345 static std::vector<IntSetArgs> expected;
1347 expected.push_back(
ISA(2, 0,1,-1, 0,1,-1));
1348 expected.push_back(
ISA(2, 0,1,-1, 0, -1));
1349 expected.push_back(
ISA(2, 0,1,-1, 1,-1));
1350 expected.push_back(
ISA(2, 0,1,-1, -1));
1351 expected.push_back(
ISA(2, 0, -1, 0,1,-1));
1352 expected.push_back(
ISA(2, 0, -1, 0, -1));
1353 expected.push_back(
ISA(2, 0, -1, 1,-1));
1354 expected.push_back(
ISA(2, 0, -1, -1));
1357 expected.push_back(
ISA(2, 1,-1, 1,-1));
1358 expected.push_back(
ISA(2, 1,-1, -1));
1362 expected.push_back(
ISA(2, -1, -1));
1382 static const int n = 2;
1384 static const int l = 0;
1386 static const int u = 1;
1395 static std::vector<IntSetArgs> expected;
1397 expected.push_back(
ISA(2, 0,1,-1, 0,1,-1));
1398 expected.push_back(
ISA(2, 0,1,-1, 0, -1));
1400 expected.push_back(
ISA(2, 0,1,-1, -1));
1401 expected.push_back(
ISA(2, 0, -1, 0,1,-1));
1402 expected.push_back(
ISA(2, 0, -1, 0, -1));
1403 expected.push_back(
ISA(2, 0, -1, 1,-1));
1404 expected.push_back(
ISA(2, 0, -1, -1));
1409 expected.push_back(
ISA(2, -1, 0,1,-1));
1410 expected.push_back(
ISA(2, -1, 0, -1));
1412 expected.push_back(
ISA(2, -1, -1));
1421 static const int n = 3;
1423 static const int l = 1;
1425 static const int u = 4;
1430 for (
int i = 0 ;
i < 3 ;
i++)
1436 static std::vector<IntSetArgs> expected;
1438 expected.push_back(
ISA(3, 1,-1, 1,-1, 1,-1));
1439 expected.push_back(
ISA(3, 1,-1, 1,-1, 2,-1));
1440 expected.push_back(
ISA(3, 1,-1, 2,-1, 1,-1));
1441 expected.push_back(
ISA(3, 1,-1, 2,-1, 2,-1));
1442 expected.push_back(
ISA(3, 1,-1, 2,-1, 3,-1));
1451 static const int n = 4;
1453 static const int l = 0;
1455 static const int u = 1;
1462 for (
int i = 0 ;
i < 4 ;
i++)
1468 static std::vector<IntSetArgs> expected;
1470 expected.push_back(
ISA(4, 0,-1, 1,-1, 0,-1, 1,-1));
1471 expected.push_back(
ISA(4, 0,-1, 1,-1, 1,-1, 0,-1));
1473 expected.push_back(
ISA(4, 1,-1, 0,-1, 1,-1, 0,-1));
1482 static const int n = 4;
1484 static const int l = 0;
1486 static const int u = 0;
1496 static std::vector<IntSetArgs> expected;
1500 expected.push_back(
ISA(4, 0, -1,0,-1,0,-1,0,-1));
1501 expected.push_back(
ISA(4, 0, -1,0,-1,0,-1, -1));
1505 expected.push_back(
ISA(4, 0, -1, -1,0,-1, -1));
1510 expected.push_back(
ISA(4, -1,0,-1, -1,0,-1));
1511 expected.push_back(
ISA(4, -1,0,-1, -1, -1));
1515 expected.push_back(
ISA(4, -1, -1, -1, -1));
1525 static const int n = 6;
1527 static const int l = 0;
1529 static const int u = 6;
1535 rel(home,
abs(m(0,0)-m(1,0))==1);
1536 rel(home,
abs(m(0,1)-m(1,1))==1);
1537 rel(home,
abs(m(1,0)-m(2,0))==1);
1538 rel(home,
abs(m(1,1)-m(2,1))==1);
1548 static std::vector<IntArgs> expected;
1550 expected.push_back(
IntArgs(6, 0,1,2,3,4,5));
1551 expected.push_back(
IntArgs(6, 0,1,2,4,5,6));
1552 expected.push_back(
IntArgs(6, 0,1,2,5,4,3));
1553 expected.push_back(
IntArgs(6, 0,1,2,6,5,4));
1562 static const int n = 2;
1564 static const int l = 0;
1566 static const int u = 3;
1575 static std::vector<IntArgs> expected;
1577 expected.push_back(
IntArgs(2, 0,0));
1578 expected.push_back(
IntArgs(2, 0,1));
1579 expected.push_back(
IntArgs(2, 0,2));
1580 expected.push_back(
IntArgs(2, 0,3));
1581 expected.push_back(
IntArgs(2, 1,0));
1582 expected.push_back(
IntArgs(2, 1,1));
1583 expected.push_back(
IntArgs(2, 1,2));
1584 expected.push_back(
IntArgs(2, 1,3));
1593 static const int n = 4;
1595 static const int l = 0;
1597 static const int u = 3;
1608 static std::vector<IntArgs> expected;
1610 expected.push_back(
IntArgs(4, 0,1,2,3));
1645 #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")