Setup problem constraints and symmetries
| 720 | static const int u = 3; |
| 721 | /// Setup problem constraints and symmetries |
| 722 | static void setup(Home home, IntVarArray& xs) { |
| 723 | Matrix<IntVarArray> m(xs, 3, 4); |
| 724 | // The values in the first column are distinct. |
| 725 | distinct(home, m.col(0)); |
| 726 | // Each row sums to 3. |
| 727 | for (int i = 0 ; i < nrows ; ++i) |
| 728 | linear(home, m.row(i), IRT_EQ, 3); |
| 729 | |
| 730 | Symmetries s; |
| 731 | |
| 732 | IntArgs a = IntArgs::create(n, 0); |
| 733 | // Rows are interchangeable. |
| 734 | s << VariableSequenceSymmetry(xs, 3); |
| 735 | // Elements (i,1) and (i,2) in row i are interchangeable, |
| 736 | // separately for each row. |
| 737 | for (int i = 0 ; i < nrows ; i++) { |
| 738 | IntVarArgs symvars; |
| 739 | symvars << m(1,i) << m(2,i); |
| 740 | s << VariableSymmetry(symvars); |
| 741 | } |
| 742 | branch(home, xs, INT_VAR_NONE(), INT_VAL_MIN(), s); |
| 743 | } |
| 744 | /// Compute list of expected solutions |
| 745 | static std::vector<IntArgs> expectedSolutions(void) { |
| 746 | static std::vector<IntArgs> expected; |
nothing calls this directly
no test coverage detected