1

In MiniZinc it is possible to use the search annotation impact, it is explained as follows on the official website:

annotation impact

Choose the variable with the highest impact so far during the search

What does this mean in practice? What is the highest impact? How is this calculated?

Community
  • 1
  • 1
Atonic
  • 509
  • 1
  • 5
  • 14

1 Answers1

3

To understand the impact based variable selection, you have to understand first_fail. In constraint programming we generally want to solve the hardest sub-problem first, failing quickly if no solution can be found. The problem with first_fail is that it doesn't take into account the number of constraints that a variable is involved in, more would indicate that the a decision for the variable "harder", or the effect that choices on the variable had in other parts of the search-tree.

As a sidenote, dom_w_deg is can be seen as compromise between first_fail and impact, where the constraints are taken into account, but the past decision are not.

impact variable selection is supposed to be an improvement on first_fail where not just domain sizes are considered, but also the constraints it's involved in and how much "impact" historical choices had. The variable with the highest impact is the one that is expected to be the hardest to assign the right value, taking all of this information into account.

As you've seen, MiniZinc does not provide an exact specification of how the variable choice has to made. It is up to solver implementer to select a heuristic that fit the solver. Note that it would be hard to provide an exact heuristic guideline as it would heavily depend on how the solver tracks its variables and constraints.

For ideas on possible implementations of impact based heuristics, I would suggest reading the paper "On the Efficiency of Impact Based Heuristics" by Marco Correia and Pedro Barahona. You can also check your specific MiniZinc/FlatZinc solver for their implementation of the heuristic.

Dekker1
  • 5,565
  • 25
  • 33
  • You say that dom_w_deg is a compromise between first_fail and impact, and that it takes into account the constraints, but not the past decisions. dom_w_deg is described as "Choose the variable with largest domain, divided by the number of attached constraints weighted by how often they have caused failure". So it seems to me that it is how you describe impact, except that they choose the largest domain, or a domain with few constraints. – Atonic Apr 23 '18 at 08:32
  • 1
    @Atonic, The difference is that `dom_w_deg` only takes the number of constraints into account, the higher the better, but it doesn't actually take into account how effective these constraints are. If an constraint never prunes anything then `impact` would treat it as non-existent (the other way arround if it's very effective), but `dom_w_deg` would still treat it the same as any other constraint. – Dekker1 Apr 24 '18 at 00:11