Setup problem constraints and symmetries
| 1280 | static const int u = 3; |
| 1281 | /// Setup problem constraints and symmetries |
| 1282 | static void setup(Home home, IntVarArray& xs) { |
| 1283 | Symmetries syms; |
| 1284 | IntArgs indices({0,1,2,3}); |
| 1285 | syms << VariableSymmetry(xs, indices); |
| 1286 | distinct(home, xs); |
| 1287 | // This redundant constraint is to trick the variable |
| 1288 | // heuristic. |
| 1289 | rel(home, xs[1] != xs[2]); |
| 1290 | // xs[1] and xs[2] have higher degree than the others, so they |
| 1291 | // are considered first. xs[2] is higher than x[1] by the merit |
| 1292 | // function, so it is assigned first. Now all remaining |
| 1293 | // variables have the same degree, so they are searched in |
| 1294 | // reverse order (according to the merit function). So, the |
| 1295 | // solution found is {3, 2, 0, 1}. |
| 1296 | branch(home, xs, tiebreak(INT_VAR_DEGREE_MAX(), INT_VAR_MERIT_MAX(position)), INT_VAL_MIN(), syms); |
| 1297 | } |
| 1298 | /// Compute list of expected solutions |
| 1299 | static std::vector<IntArgs> expectedSolutions(void) { |
| 1300 | static std::vector<IntArgs> expected; |
nothing calls this directly
no test coverage detected