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
170 class OneArraySet :
public Space {
180 xs.
update(*
this,share,s.xs);
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(h, 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;
821 static std::vector<IntArgs> expected;
823 expected.push_back(
IntArgs(3, 0,1,5));
824 expected.push_back(
IntArgs(3, 1,1,1));
833 static const int n = 2;
835 static const int l = 0;
837 static const int u = 6;
840 rel(h, xs[0] + xs[1] == 6);
848 static std::vector<IntArgs> expected;
850 expected.push_back(
IntArgs(2, 3,3));
851 expected.push_back(
IntArgs(2, 2,4));
852 expected.push_back(
IntArgs(2, 1,5));
853 expected.push_back(
IntArgs(2, 0,6));
862 static const int n = 4;
864 static const int l = 0;
866 static const int u = 3;
877 static std::vector<IntArgs> expected;
879 expected.push_back(
IntArgs(4, 0,1,2,3));
888 static const int n = 4;
890 static const int l = 0;
892 static const int u = 3;
902 static std::vector<IntArgs> expected;
904 expected.push_back(
IntArgs(4, 0,1,2,3));
913 static const int n = 4;
915 static const int l = 0;
917 static const int u = 3;
927 static std::vector<IntArgs> expected;
929 expected.push_back(
IntArgs(4, 3,2,1,0));
938 static const int n = 4;
940 static const int l = 0;
942 static const int u = 3;
952 static std::vector<IntArgs> expected;
954 expected.push_back(
IntArgs(4, 0,0,0,0));
955 expected.push_back(
IntArgs(4, 0,0,0,1));
956 expected.push_back(
IntArgs(4, 0,0,1,0));
957 expected.push_back(
IntArgs(4, 0,0,1,1));
958 expected.push_back(
IntArgs(4, 0,0,1,2));
959 expected.push_back(
IntArgs(4, 0,1,0,0));
960 expected.push_back(
IntArgs(4, 0,1,0,1));
961 expected.push_back(
IntArgs(4, 0,1,0,2));
962 expected.push_back(
IntArgs(4, 0,1,1,0));
963 expected.push_back(
IntArgs(4, 0,1,1,1));
964 expected.push_back(
IntArgs(4, 0,1,1,2));
965 expected.push_back(
IntArgs(4, 0,1,2,0));
966 expected.push_back(
IntArgs(4, 0,1,2,1));
967 expected.push_back(
IntArgs(4, 0,1,2,2));
968 expected.push_back(
IntArgs(4, 0,1,2,3));
977 static const int n = 4;
979 static const int l = 0;
981 static const int u = 3;
990 static std::vector<IntArgs> expected;
992 expected.push_back(
IntArgs(4, 0,0,0,0));
993 expected.push_back(
IntArgs(4, 0,0,0,1));
994 expected.push_back(
IntArgs(4, 0,0,1,0));
995 expected.push_back(
IntArgs(4, 0,0,1,1));
996 expected.push_back(
IntArgs(4, 0,0,1,2));
997 expected.push_back(
IntArgs(4, 0,1,0,0));
998 expected.push_back(
IntArgs(4, 0,1,0,1));
999 expected.push_back(
IntArgs(4, 0,1,0,2));
1000 expected.push_back(
IntArgs(4, 0,1,1,0));
1001 expected.push_back(
IntArgs(4, 0,1,1,1));
1002 expected.push_back(
IntArgs(4, 0,1,1,2));
1003 expected.push_back(
IntArgs(4, 0,1,2,0));
1004 expected.push_back(
IntArgs(4, 0,1,2,1));
1005 expected.push_back(
IntArgs(4, 0,1,2,2));
1006 expected.push_back(
IntArgs(4, 0,1,2,3));
1015 static const int n = 4;
1017 static const int l = 0;
1019 static const int u = 3;
1030 static std::vector<IntArgs> expected;
1032 expected.push_back(
IntArgs(4, 0,1,2,3));
1033 expected.push_back(
IntArgs(4, 0,1,3,2));
1034 expected.push_back(
IntArgs(4, 0,2,1,3));
1035 expected.push_back(
IntArgs(4, 0,2,3,1));
1036 expected.push_back(
IntArgs(4, 0,3,1,2));
1037 expected.push_back(
IntArgs(4, 0,3,2,1));
1038 expected.push_back(
IntArgs(4, 2,0,1,3));
1039 expected.push_back(
IntArgs(4, 2,0,3,1));
1040 expected.push_back(
IntArgs(4, 2,3,0,1));
1041 expected.push_back(
IntArgs(4, 3,0,1,2));
1042 expected.push_back(
IntArgs(4, 3,0,2,1));
1043 expected.push_back(
IntArgs(4, 3,2,0,1));
1052 static const int n = 3;
1054 static const int l = 0;
1056 static const int u = 2;
1067 static std::vector<IntArgs> expected;
1069 expected.push_back(
IntArgs(3, 0,1,2));
1070 expected.push_back(
IntArgs(3, 0,2,1));
1071 expected.push_back(
IntArgs(3, 1,0,2));
1072 expected.push_back(
IntArgs(3, 1,2,0));
1073 expected.push_back(
IntArgs(3, 2,0,1));
1074 expected.push_back(
IntArgs(3, 2,1,0));
1083 static const int n = 4;
1085 static const int l = 0;
1087 static const int u = 3;
1100 static std::vector<IntArgs> expected;
1102 expected.push_back(
IntArgs(4, 0,1,2,3));
1103 expected.push_back(
IntArgs(4, 0,2,1,3));
1104 expected.push_back(
IntArgs(4, 0,2,3,1));
1105 expected.push_back(
IntArgs(4, 2,0,1,3));
1106 expected.push_back(
IntArgs(4, 2,0,3,1));
1107 expected.push_back(
IntArgs(4, 2,3,0,1));
1116 static const int n = 4;
1118 static const int l = 0;
1120 static const int u = 3;
1130 static std::vector<IntArgs> expected;
1132 expected.push_back(
IntArgs(4, 0,0,0,0));
1133 expected.push_back(
IntArgs(4, 0,0,0,1));
1134 expected.push_back(
IntArgs(4, 0,0,1,1));
1135 expected.push_back(
IntArgs(4, 0,0,1,2));
1136 expected.push_back(
IntArgs(4, 0,1,1,1));
1137 expected.push_back(
IntArgs(4, 0,1,1,2));
1138 expected.push_back(
IntArgs(4, 0,1,2,2));
1139 expected.push_back(
IntArgs(4, 0,1,2,3));
1154 for (
int i = 0 ;
i <
n ;
i++) {
1168 {
return new Latin(share,*
this); }
1171 for (
int i = 0 ;
i <
a.size() ; ++
i)
1178 static std::vector<IntArgs> expected;
1180 expected.push_back(
IntArgs(16, 1,2,3,4, 2,1,4,3, 3,4,1,2, 4,3,2,1));
1181 expected.push_back(
IntArgs(16, 1,2,3,4, 2,1,4,3, 3,4,2,1, 4,3,1,2));
1182 expected.push_back(
IntArgs(16, 1,2,3,4, 2,3,4,1, 3,4,1,2, 4,1,2,3));
1183 expected.push_back(
IntArgs(16, 1,2,3,4, 2,4,1,3, 3,1,4,2, 4,3,2,1));
1193 bool r =
check(e, Latin::expectedSolutions());
1232 static const int n = 4;
1234 static const int l = 0;
1236 static const int u = 1;
1244 va << xs[0] << xs[2];
1252 static std::vector<IntArgs> expected;
1254 expected.push_back(
IntArgs(4, 0,0,0,0));
1255 expected.push_back(
IntArgs(4, 0,0,0,1));
1268 expected.push_back(
IntArgs(4, 0,1,0,1));
1270 expected.push_back(
IntArgs(4, 1,0,1,0));
1271 expected.push_back(
IntArgs(4, 1,0,1,1));
1272 expected.push_back(
IntArgs(4, 1,1,1,1));
1287 static const int n = 4;
1289 static const int l = 0;
1291 static const int u = 3;
1300 rel(h, xs[1] != xs[2]);
1311 static std::vector<IntArgs> expected;
1313 expected.push_back(
IntArgs(4, 3,2,0,1));
1318 #ifdef GECODE_HAS_SET_VARS
1327 int x = va_arg(args,
int);
1344 static const int n = 2;
1346 static const int l = 0;
1348 static const int u = 1;
1357 static std::vector<IntSetArgs> expected;
1359 expected.push_back(
ISA(2, 0,1,-1, 0,1,-1));
1360 expected.push_back(
ISA(2, 0,1,-1, 0, -1));
1361 expected.push_back(
ISA(2, 0,1,-1, 1,-1));
1362 expected.push_back(
ISA(2, 0,1,-1, -1));
1363 expected.push_back(
ISA(2, 0, -1, 0,1,-1));
1364 expected.push_back(
ISA(2, 0, -1, 0, -1));
1365 expected.push_back(
ISA(2, 0, -1, 1,-1));
1366 expected.push_back(
ISA(2, 0, -1, -1));
1369 expected.push_back(
ISA(2, 1,-1, 1,-1));
1370 expected.push_back(
ISA(2, 1,-1, -1));
1374 expected.push_back(
ISA(2, -1, -1));
1394 static const int n = 2;
1396 static const int l = 0;
1398 static const int u = 1;
1407 static std::vector<IntSetArgs> expected;
1409 expected.push_back(
ISA(2, 0,1,-1, 0,1,-1));
1410 expected.push_back(
ISA(2, 0,1,-1, 0, -1));
1412 expected.push_back(
ISA(2, 0,1,-1, -1));
1413 expected.push_back(
ISA(2, 0, -1, 0,1,-1));
1414 expected.push_back(
ISA(2, 0, -1, 0, -1));
1415 expected.push_back(
ISA(2, 0, -1, 1,-1));
1416 expected.push_back(
ISA(2, 0, -1, -1));
1421 expected.push_back(
ISA(2, -1, 0,1,-1));
1422 expected.push_back(
ISA(2, -1, 0, -1));
1424 expected.push_back(
ISA(2, -1, -1));
1433 static const int n = 3;
1435 static const int l = 1;
1437 static const int u = 4;
1442 for (
int i = 0 ; i < 3 ; i++)
1448 static std::vector<IntSetArgs> expected;
1450 expected.push_back(
ISA(3, 1,-1, 1,-1, 1,-1));
1451 expected.push_back(
ISA(3, 1,-1, 1,-1, 2,-1));
1452 expected.push_back(
ISA(3, 1,-1, 2,-1, 1,-1));
1453 expected.push_back(
ISA(3, 1,-1, 2,-1, 2,-1));
1454 expected.push_back(
ISA(3, 1,-1, 2,-1, 3,-1));
1463 static const int n = 4;
1465 static const int l = 0;
1467 static const int u = 1;
1474 for (
int i = 0 ; i < 4 ; i++)
1480 static std::vector<IntSetArgs> expected;
1482 expected.push_back(
ISA(4, 0,-1, 1,-1, 0,-1, 1,-1));
1483 expected.push_back(
ISA(4, 0,-1, 1,-1, 1,-1, 0,-1));
1485 expected.push_back(
ISA(4, 1,-1, 0,-1, 1,-1, 0,-1));
1494 static const int n = 4;
1496 static const int l = 0;
1498 static const int u = 0;
1508 static std::vector<IntSetArgs> expected;
1512 expected.push_back(
ISA(4, 0, -1,0,-1,0,-1,0,-1));
1513 expected.push_back(
ISA(4, 0, -1,0,-1,0,-1, -1));
1517 expected.push_back(
ISA(4, 0, -1, -1,0,-1, -1));
1522 expected.push_back(
ISA(4, -1,0,-1, -1,0,-1));
1523 expected.push_back(
ISA(4, -1,0,-1, -1, -1));
1527 expected.push_back(
ISA(4, -1, -1, -1, -1));
1537 static const int n = 6;
1539 static const int l = 0;
1541 static const int u = 6;
1547 rel(h,
abs(m(0,0)-m(1,0))==1);
1548 rel(h,
abs(m(0,1)-m(1,1))==1);
1549 rel(h,
abs(m(1,0)-m(2,0))==1);
1550 rel(h,
abs(m(1,1)-m(2,1))==1);
1560 static std::vector<IntArgs> expected;
1562 expected.push_back(
IntArgs(6, 0,1,2,3,4,5));
1563 expected.push_back(
IntArgs(6, 0,1,2,4,5,6));
1564 expected.push_back(
IntArgs(6, 0,1,2,5,4,3));
1565 expected.push_back(
IntArgs(6, 0,1,2,6,5,4));
1574 static const int n = 2;
1576 static const int l = 0;
1578 static const int u = 3;
1587 static std::vector<IntArgs> expected;
1589 expected.push_back(
IntArgs(2, 0,0));
1590 expected.push_back(
IntArgs(2, 0,1));
1591 expected.push_back(
IntArgs(2, 0,2));
1592 expected.push_back(
IntArgs(2, 0,3));
1593 expected.push_back(
IntArgs(2, 1,0));
1594 expected.push_back(
IntArgs(2, 1,1));
1595 expected.push_back(
IntArgs(2, 1,2));
1596 expected.push_back(
IntArgs(2, 1,3));
1605 static const int n = 4;
1607 static const int l = 0;
1609 static const int u = 3;
1620 static std::vector<IntArgs> expected;
1622 expected.push_back(
IntArgs(4, 0,1,2,3));
1629 LDSB<VarSym1>
varsym1(
"VarSym1");
1630 LDSB<VarSym1b>
varsym1b(
"VarSym1b");
1631 LDSB<VarSym2>
varsym2(
"VarSym2");
1632 LDSB<VarSym3>
varsym3(
"VarSym3");
1633 LDSB<VarSym4>
varsym4(
"VarSym4");
1634 LDSB<VarSym5>
varsym5(
"VarSym5");
1635 LDSB<MatSym1>
matsym1(
"MatSym1");
1636 LDSB<MatSym2>
matsym2(
"MatSym2");
1637 LDSB<MatSym3>
matsym3(
"MatSym3");
1638 LDSB<MatSym4>
matsym4(
"MatSym4");
1644 LDSB<ValSym1>
valsym1(
"ValSym1");
1645 LDSB<ValSym1b>
valsym1b(
"ValSym1b");
1646 LDSB<ValSym1c>
valsym1c(
"ValSym1c");
1647 LDSB<ValSym2>
valsym2(
"ValSym2");
1648 LDSB<ValSym2b>
valsym2b(
"ValSym2b");
1649 LDSB<ValSym3>
valsym3(
"ValSym3");
1650 LDSB<ValSym4>
valsym4(
"ValSym4");
1651 LDSB<ValSym5>
valsym5(
"ValSym5");
1653 LDSBLatin
latin(
"Latin");
1654 LDSB<Recomputation>
recomp(
"Recomputation", 999,999);
1655 LDSB<TieBreak>
tiebreak(
"TieBreak");
1657 #ifdef GECODE_HAS_SET_VARS
1662 LDSBSet<SetVarSym1>
setvarsym1(
"SetVarSym1");
1663 LDSBSet<SetValSym1>
setvalsym1(
"SetValSym1");
1664 LDSBSet<SetValSym2>
setvalsym2(
"SetValSym2", 0, 1);
unsigned int c_d
Recomputation distance.
unsigned int a_d
Create a clone during recomputation if distance is greater than a_d (adaptive distance) ...
virtual Space * copy(bool share)
Copy during cloning.
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...
SymmetryHandle VariableSequenceSymmetry(const SetVarArgs &x, int ss)
Variable sequences in x of size ss are interchangeable.
LDSB< ValSym3 > valsym3("ValSym3")
static IntArgs create(int n, int start, int inc=1)
Allocate array with n elements such that for all .
static void setup(Home h, SetVarArray &xs)
Setup problem constraints and symmetries.
LDSB< ReflectSym2 > reflectsym2("ReflectSym2")
static void setup(Home h, IntVarArray &xs)
Setup problem constraints and symmetries.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
static void setup(Home h, IntVarArray &xs)
Setup problem constraints and symmetries.
static void setup(Home h, IntVarArray &xs)
Setup problem constraints and symmetries.
Test for set value symmetry
IntVarBranch INT_VAR_NONE(void)
Select first unassigned variable.
Combine variable selection criteria for tie-breaking.
static void setup(Home h, IntVarArray &xs)
Setup problem constraints and symmetries.
IntVarBranch INT_VAR_MERIT_MAX(IntBranchMerit bm, BranchTbl tbl)
Select variable with highest merit according to branch merit function bm.
void linear(Home home, const FloatVarArgs &x, FloatRelType frt, FloatNum c)
Post propagator for .
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.
LDSB< VarSym2 > varsym2("VarSym2")
SetVarBranch SET_VAR_NONE(void)
Select first unassigned variable.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
static void setup(Home h, IntVarArray &xs)
Setup problem constraints and symmetries.
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)
static void setup(Home h, SetVarArray &xs)
Setup problem constraints and symmetries.
static void setup(Home h, IntVarArray &xs)
Setup problem constraints and symmetries.
virtual Space * copy(bool share)
Copying member function.
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 h, SetVarArray &xs)
Setup problem constraints and symmetries.
Test for value sequence symmetry
Test for variable symmetry
LDSB< MatSym2 > matsym2("MatSym2")
LDSBLatin(std::string label)
Initialize test.
SetValBranch SET_VAL_MIN_INC(void)
Include smallest element.
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.
static void setup(Home h, IntVarArray &xs)
Setup problem constraints and symmetries.
Collection of symmetries.
static void setup(Home h, IntVarArray &xs)
Setup problem constraints and symmetries.
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.
LDSB< VarSym5 > varsym5("VarSym5")
SymmetryHandle VariableSymmetry(const SetVarArgs &x)
Variables in x are interchangeable.
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")
static void setup(Home h, IntVarArray &xs)
Setup problem constraints and symmetries.
static void setup(Home h, IntVarArray &xs)
Setup problem constraints and symmetries.
Test for variable sequence symmetry
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
LDSB< Activity1 > activity1("Activity1")
static void setup(Home h, IntVarArray &xs)
Setup problem constraints and symmetries.
static std::vector< IntSetArgs > expectedSolutions(void)
Compute list of expected solutions.
LDSB< ValSym4 > valsym4("ValSym4")
bool run(void)
Perform actual tests.
static void setup(Home h, IntVarArray &xs)
Setup problem constraints and symmetries.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
LDSB< MatSym4 > matsym4("MatSym4")
LDSB< ValSym2 > valsym2("ValSym2")
Test for value sequence symmetry
LDSBSet< SetValSym2 > setvalsym2("SetValSym2", 0, 1)
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
Test for LDSB infrastructure
static void setup(Home h, SetVarArray &xs)
Setup problem constraints and symmetries.
void update(Space &, bool share, VarArray< Var > &a)
Update array to be a clone of array a.
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 h, 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.
IntVarBranch INT_VAR_DEGREE_MAX(BranchTbl tbl)
Select variable with largest degree.
IntVarBranch INT_VAR_ACTIVITY_MIN(double d, BranchTbl tbl)
Select variable with lowest activity with decay factor d.
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.
SymmetryHandle ValueSequenceSymmetry(const IntArgs &vs, int ss)
Value sequences in v of size ss are interchangeable.
static void setup(Home h, IntVarArray &xs)
Setup problem constraints and symmetries.
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) ...
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 std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
unsigned int size(I &i)
Size of all ranges of range iterator i.
Latin(bool share, Latin &s)
bool run(void)
Perform actual tests.
Base class for all tests to be run
Iterator for the greatest lower bound ranges of a set variable.
Slice< A > row(int r) const
Access row r.
LDSB< VarSym1 > varsym1("VarSym1")
static void setup(Home h, SetVarArray &xs)
Setup problem constraints and symmetries.
static void setup(Home h, IntVarArray &xs)
Setup problem constraints and symmetries.
static void setup(Home h, IntVarArray &xs)
Setup problem constraints and symmetries.
LDSB< TieBreak > tiebreak("TieBreak")
static std::vector< IntSetArgs > expectedSolutions(void)
Compute list of expected solutions.
virtual Space * copy(bool share)
Copy during cloning.
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 h, IntVarArray &xs)
Setup problem constraints and symmetries.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
static void setup(Home h, IntVarArray &xs)
Setup problem constraints and symmetries.
OneArraySet(int n, int l, int u)
Constructor for creation.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
static void setup(Home h, IntVarArray &xs)
Setup problem constraints and symmetries.
Passing integer variables.
unsigned int a_d
Adaptation distance.
Passing integer arguments.
static void setup(Home h, IntVarArray &xs)
Setup problem constraints and symmetries.
static void setup(Home h, IntVarArray &xs)
Setup problem constraints and symmetries.
static const IntSet empty
Empty set.
OneArray(bool share, OneArray &s)
Constructor for cloning s.
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)
union Gecode::@518::NNF::@57 u
Union depending on nodetype t.
Class represeting a set of tuples.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
Test for reflection symmetry
void extensional(Home home, const IntVarArgs &x, DFA dfa, IntConLevel)
Post domain consistent propagator for extensional constraint described by a DFA.
IntValBranch INT_VAL_MAX(void)
Select largest value.
void values(Home home, const IntVarArgs &x, IntSet y, IntConLevel icl=ICL_DEF)
Post constraint .
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 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.
virtual IntArgs * expectedSolutions(void)
Expected solutions.
static void setup(Home h, IntVarArray &xs)
Setup problem constraints and symmetries.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
LDSB< ValSym2b > valsym2b("ValSym2b")
Test for variable symmetry
OneArraySet(bool share, OneArraySet &s)
Constructor for cloning s.
unsigned int a_d
Adaptation distance.
static void setup(Home h, IntVarArray &xs)
Setup problem constraints and symmetries.
T * next(void)
Return next solution (NULL, if none exists or search has been stopped)
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
void distinct(Home home, const IntVarArgs &x, IntConLevel icl)
Post propagator for for all .
static void setup(Home h, IntVarArray &xs)
Setup problem constraints and symmetries.
LDSB< MatSym1 > matsym1("MatSym1")
const unsigned int c_d
Create a clone after every c_d commits (commit distance)
SymmetryHandle values_reflect(const IntVar &x)
static void setup(Home h, IntVarArray &xs)
Setup problem constraints and symmetries.
static std::vector< IntArgs > expectedSolutions(void)
Compute list of expected solutions.
Matrix-interface for arrays.
LDSB< SimIntValSym3 > simintvalsym3("SimIntValSym3")
int val(void) const
Return current value.
Test for handling of recomputation
LDSB< SimIntVarSym1 > simintvarsym1("SimIntVarSym1")
struct Gecode::@518::NNF::@57::@58 b
For binary nodes (and, or, eqv)
static void setup(Home h, IntVarArray &xs)
Setup problem constraints and symmetries.
static void setup(Home h, IntVarArray &xs)
Setup problem constraints and symmetries.
Gecode toplevel namespace
LDSB< VarSym4 > varsym4("VarSym4")
BrancherHandle 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...
Slice< A > col(int c) const
Access column c.
void add(const IntArgs &tuple)
Add tuple to tuple set.
Test for LDSB infrastructure
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.
Test for variable symmetry
static void setup(Home h, IntVarArray &xs)
Setup problem constraints and symmetries.
Home class for posting propagators
int size(void) const
Return size of array (number of elements)
LDSB< ValSym1 > valsym1("ValSym1")
Test for LDSB infrastructure with Latin square problem
bool run(void)
Perform actual tests.
struct Gecode::@518::NNF::@57::@59 a
For atomic nodes.
Depth-first search engine.
LDSB< Recomputation > recomp("Recomputation", 999, 999)
Test for value sequence symmetry
static void setup(Home h, IntVarArray &xs)
Setup problem constraints and symmetries.
LDSBSet< SetVarSeqSym2 > setvarseqsym2("SetVarSeqSym2")
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")