MCPcopy Create free account
hub / github.com/Gecode/gecode / setup

Method setup

test/ldsb.cpp:1282–1297  ·  view source on GitHub ↗

Setup problem constraints and symmetries

Source from the content-addressed store, hash-verified

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;

Callers

nothing calls this directly

Calls 8

distinctFunction · 0.85
tiebreakFunction · 0.85
INT_VAR_DEGREE_MAXFunction · 0.85
INT_VAR_MERIT_MAXFunction · 0.85
INT_VAL_MINFunction · 0.85
VariableSymmetryFunction · 0.50
relFunction · 0.50
branchFunction · 0.50

Tested by

no test coverage detected