Search algorithms for constraint satisfaction



The applet allows you to experiment with the behavior of constraint satisfaction search heuristics on randomly generated problems. Examples are resource allocation problems: You can generate a random problem by clicking on the button "generate problem" (due to the implementation of JAVA, this is sometimes a bit slow, so please be patient).

Next, you can select one of the following search methods:
  1. BT: simple backtrack search
  2. FC: backtrack search with forward checking
  3. FC with DVO: as above, but also including dynamic variable ordering
  4. MAC: backtrack search with maintaining arc consistency
  5. MAC with DVO: as above, but also including dynamic variable ordering
  6. BJ: backjumping
  7. CBJ: conflict-directed backjumping
Clicking on "Solve problem" launches the first step of the search. The button "Next step" advances one step. The button "Go" lets the search run all the way to the end. At any time, you can abort the search using the button "Abort". Note that the search is done in a different process from the graphical interface. Thus, if you clicked on "Go", you should decide quickly whether to "Abort", since otherwise the display might continue for a long time even after you clicked "Abort". The window "Solving details" shows a trace of the search.

Assigment of a value is indicated by setting the bar corresponding to the variable to the appropriate colour. When backtracking leads to undoing an assignment, the color disappears again. In all search methods except simple backtracking, the applet indicates the values which have been eliminated from variable labels by crossing them out so you can follow the search better.

  1. Generate a random problem and observe the behavior of backtrack search on this problem. In some problems, this can be quite efficient, in others, it can be very slow. Some problems may also be unsolvable. Generate different problems until you find one which requires several backtracks but is solvable in a reasonable amount of time. Note down where the backtracks occur, and also the statistics (number of backtracks, number of constraint checks). Keep this problem for the next exercises.
  2. Run the same problem using the backjumping heuristic. How does the backtracking behavior change?
  3. Next, observe the performance of forward checking. How does this improve the backtracking behavior? Compare it to backjumping! Compare the statistics and the runtime!
  4. Next, add variable ordering. How much does this improve the efficiency?
  5. Repeat the previous two exercises for conflict-directed backjumping (CBJ), maintaining arc consistency (MAC),and MAC with DVO!
  6. If you have time, make similar exercises with other random problems to see how general your observations are.