1

I have started to use choco-solver in my work and didn't understand how propogator and search stradegies interart with each other.

I think choco has some flag that shows me if there is any domain of constraint variables that is changed during propogation. And if there is, then propogation starts again and again until no domain changes occur. And after that, if constraint still not satisfied or fails, search strategies will be connected to solving process.

But output of my progamm shows me that I'm wrong. Propogator really works 2 or 3 times, changing domains each time, but then search strategy is called.

Help me please, where am I wrong in my conclusions? Or it should work just the way I think and there is some mistakes in my code, that lead to wrong output?

Sorry for my bad english

2 Answers2

4

Choco is a Constraint Programming solver, these solvers all work according to the same principe.

Different than a brute force search, a constraint solver will first call all (relevant) propagators to remove values, from the variable domain, that it knows the variables can't take. Calling one propagator might trigger new values to become impossible and might thus trigger other propagators to run again.

Once all propagators report that they can't remove anymore values (we call this fix point), the search strategy will be consulted to see what to do next. (In general this is a guess to what should be a solution and we might need to backtrack).

If all variables have only one possible value, this is a solution. However, it can happen that in our search a variable loses all its possible values. In this case a propagator will fail. If we had already used search, we will need to backtrack. If this was at the root node, then it means the problem was unsatisfiable.

For more information, try the tutorials of several constraint solvers. A lot of them can be found on Wikipedia. You might also be able to find online courses.

Dekker1
  • 5,565
  • 25
  • 33
  • 1
    Looks like you repeat my assumptions on wiki-language. So this means that I have some mistakes in my code that activate search strategy before propagators reach fix point. Thank you for the answer! – Yuri Oleynik Sep 28 '17 at 12:45
0

To complete Dekker answer, and based on my experience, fix point is generally reached within a pretty small number of iterations in practice. This can still be slow (because there are many constraints or because "global constraints" may be slow to propagate) but it is rare that the ping-pong effect is dramatic. Choco Solver and similar solvers have many tricks to be efficient on propagation...

So it is completely ok that each propagator is called only 2-3 times before branching.

  • Problem is that branching starts before propagators reach the fix point. I'm watching on variables domains so can definitely say that they are changing on each propagation before branching. The question was: is it normal? – Yuri Oleynik Oct 04 '17 at 07:16
  • Problem is that branching starts before propagators reach the fix point. -> How can you know that? You said that domains change on each propagation... This does not mean the fixpoint is not reached. To prove that fixpoint is not reached, you have to show that, if propagation was called once more, then there would be new domain changes – Jean-Guillaume Fages Oct 04 '17 at 12:02
  • How does system understand that fix point is reached if it not even try to propagate after last changes? Anyway I wrote the logic of propogator, I am watching the state of constraint, so I can definitely say that there are some changes that propogator should do on further iterations, but branching is appeared. – Yuri Oleynik Oct 04 '17 at 14:43
  • which constraints do you have in your model? If you have cumulative constraint for instance I think there is a "fast" mode that does not apply fixpoint, but this is rare – Jean-Guillaume Fages Oct 04 '17 at 22:28
  • I have simple choco constraint with my one propogator and search strategies on IntVar-variables. – Yuri Oleynik Oct 05 '17 at 09:28