1 / 64

Constraint Propagation

Constraint Propagation. Constraint Propagation …. … is the process of determining how the possible values of one variable affect the possible values of other variables. Forward Checking.

saul
Download Presentation

Constraint Propagation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Constraint Propagation

  2. Constraint Propagation … … is the process of determining how the possible values of one variable affect the possible values of other variables Constraint Propagation

  3. Forward Checking After a variable X is assigned a value v, look at each unassigned variable Y that is connected to X by a constraint and deletes from Y’s domain any value that is inconsistent with v Constraint Propagation

  4. NT Q WA NSW SA T V Map Coloring Constraint Propagation

  5. NT Q WA NSW SA T V Map Coloring Constraint Propagation

  6. NT Q WA NSW SA T V Map Coloring Constraint Propagation

  7. NT Q WA NSW SA T V Impossible assignments that forward checking do not detect Map Coloring Constraint Propagation

  8.  constraint propagation Constraint Propagation

  9. Edge Labeling in Computer Vision Russell and Norvig: Chapter 24, pages 745-749 Constraint Propagation

  10. Edge Labeling Constraint Propagation

  11. Edge Labeling Constraint Propagation

  12. + – Edge Labeling Constraint Propagation

  13. + + + + + - - + + + + + Edge Labeling Constraint Propagation

  14. - - + + - + + - - + + - - - - + + + - + Junction Label Sets (Waltz, 1975; Mackworth, 1977) Constraint Propagation

  15. Edge Labeling as a CSP • A variable is associated with each junction • The domain of a variable is the label set of the corresponding junction • Each constraint imposes that the values given to two adjacent junctions give the same label to the joining edge Constraint Propagation

  16. - + + - - + + - + Edge Labeling Constraint Propagation

  17. + - - + + - - - - + + Edge Labeling Constraint Propagation

  18. + + + + - + + - - + + Edge Labeling + + Constraint Propagation

  19. - - + + + + + - - Edge Labeling + + Constraint Propagation

  20. Removal of Arc Inconsistencies REMOVE-ARC-INCONSISTENCIES(J,K) • removed  false • X  label set of J • Y  label set of K • For every label y in Y do • If there exists no label x in X such that the constraint (x,y) is satisfied then • Remove y from Y • If Y is empty then contradiction  true • removed  true • Label set of K  Y • Return removed Constraint Propagation

  21. CP Algorithm for Edge Labeling • Associate with every junction its label set • contradiction false • Q stack of all junctions • while Q is not empty and not contradictiondo • J UNSTACK(Q) • For every junction K adjacent to J do • If REMOVE-ARC-INCONSISTENCIES(J,K) then • STACK(K,Q) (Waltz, 1975; Mackworth, 1977) Constraint Propagation

  22. General CP for Binary Constraints Algorithm AC3 • contradiction false • Q stack of all variables • while Q is not empty and not contradiction do • X UNSTACK(Q) • For every variable Y adjacent to X do • If REMOVE-ARC-INCONSISTENCIES(X,Y) then • STACK(Y,Q) Constraint Propagation

  23. General CP for Binary Constraints Algorithm AC3 • contradiction false • Q stack of all variables • while Q is not empty and not contradiction do • X UNSTACK(Q) • For every variable Y adjacent to X do • If REMOVE-ARC-INCONSISTENCY(X,Y) then • STACK(Y,Q) REMOVE-ARC-INCONSISTENCY(X,Y) • removed  false • For every value y in the domain of Y do • If there exists no value x in the domain of X such that the constraints on (x,y) is satisfied then • Remove y from the domain of Y • If Y is empty then contradiction  true • removed  true • Return removed Constraint Propagation

  24. Complexity Analysis of AC3 • n = number of variables • d = number of values per variable • s = maximum number of constraints on a pair of variables • Each variables is inserted in Q up to d times • REMOVE-ARC-INCONSISTENCY takes O(d2) time • CP takes O(n s d3) time Constraint Propagation

  25. {1, 2} {1, 2} X  Y X Y X  Z Y  Z Z {1, 2} Is AC3 All What is Needed? NO! Constraint Propagation

  26. Solving a CSP • Interweave constraint propagation, e.g., • forward checking • AC3 • and backtracking • + Take advantage of the CSP structure Constraint Propagation

  27. X1 {1,2,3,4} X2 {1,2,3,4} 1 2 3 4 1 2 3 4 X3 {1,2,3,4} X4 {1,2,3,4} 4-Queens Problem Constraint Propagation

  28. X1 {1,2,3,4} X2 {1,2,3,4} 1 2 3 4 1 2 3 4 X3 {1,2,3,4} X4 {1,2,3,4} 4-Queens Problem Constraint Propagation

  29. X1 {1,2,3,4} X2 {1,2,3,4} 1 2 3 4 1 2 3 4 X3 {1,2,3,4} X4 {1,2,3,4} 4-Queens Problem Constraint Propagation

  30. X1 {1,2,3,4} X2 {1,2,3,4} 1 2 3 4 1 2 3 4 X3 {1,2,3,4} X4 {1,2,3,4} 4-Queens Problem Constraint Propagation

  31. X1 {1,2,3,4} X2 {1,2,3,4} 1 2 3 4 1 2 3 4 X3 {1,2,3,4} X4 {1,2,3,4} 4-Queens Problem Constraint Propagation

  32. X1 {1,2,3,4} X2 {1,2,3,4} 1 2 3 4 1 2 3 4 X3 {1,2,3,4} X4 {1,2,3,4} 4-Queens Problem Constraint Propagation

  33. X1 {1,2,3,4} X2 {1,2,3,4} 1 2 3 4 1 2 3 4 X3 {1,2,3,4} X4 {1,2,3,4} 4-Queens Problem Constraint Propagation

  34. X1 {1,2,3,4} X2 {1,2,3,4} 1 2 3 4 1 2 3 4 X3 {1,2,3,4} X4 {1,2,3,4} 4-Queens Problem Constraint Propagation

  35. X1 {1,2,3,4} X2 {1,2,3,4} 1 2 3 4 1 2 3 4 X3 {1,2,3,4} X4 {1,2,3,4} 4-Queens Problem Constraint Propagation

  36. X1 {1,2,3,4} X2 {1,2,3,4} 1 2 3 4 1 2 3 4 X3 {1,2,3,4} X4 {1,2,3,4} 4-Queens Problem Constraint Propagation

  37. NT Q WA NSW SA T V Structure of CSP • If the constraint graph contains multiple components, then one independent CSP per component Constraint Propagation

  38. Structure of CSP • If the constraint graph contains multiple components, then one independent CSP per component • If the constraint graph is a tree (no loop), then the CSP can be solved efficiently Constraint Propagation

  39. X Y Z V U W Constraint Tree  (X, Y, Z, U, V, W) Constraint Propagation

  40. Constraint Tree • Order the variables from the root to the leaves  (X1, X2, …, Xn) • For j = n, n-1, …, 2 doREMOVE-ARC-INCONSISTENCY(Xj, Xi) whereXiis the parent ofXj • Assign any legal value to X1 • For j = 2, …, n do • assign any value to Xj consistent with the value assigned to Xi, where Xi is the parent of Xj Constraint Propagation

  41. NT Q WA NSW SA V Structure of CSP • If the constraint graph contains multiple components, then one independent CSP per component • If the constraint graph is a tree, then the CSP can be solved efficiently • Whenever a variable is assigned a value by the backtracking algorithm, propagate this value and remove the variable from the constraint graph Constraint Propagation

  42. NT Q WA NSW V Structure of CSP • If the constraint graph contains multiple components, then one independent CSP per component • If the constraint graph is a tree, then the CSP can be solved in linear time • Whenever a variable is assigned a value by the backtracking algorithm, propagate this value and remove the variable from the constraint graph Constraint Propagation

  43. Over-Constrained Problems Weaken an over-constrained problem by: • Enlarging the domain of a variable • Loosening a constraint • Removing a variable • Removing a constraint Constraint Propagation

  44. Non-Binary Constraints • So far, all constraints have been binary (two variables) or unary (one variable) • Constraints with more than 2 variables would be difficult to propagate • Theoretically, one can reduce a constraint with k>2 variables to a set of binary constraints by introducing additional variables Constraint Propagation

  45. When to Use CSP Techniques? • When the problem can be expressed by a set of variables with constraints on their values • When constraints are relatively simple (e.g., binary) • When constraints propagate well (AC3 eliminates many values) • When the solutions are “densely” distributed in the space of possible assignments Constraint Propagation

  46. Summary • Forward checking • Constraint propagation • Edge labeling in Computer Vision • Interweaving CP and backtracking • Exploiting CSP structure • Weakening over-constrained CSP Constraint Propagation

  47. Game Playing

  48. Games as search problems • Chess, Go • Simulation of war (war game) • 스타크래프트의 전투 • Claude Shannon, Alan Turing  Chess program (1950년대) Constraint Propagation

  49. Contingency problems • The opponent introduces uncertainty • 마이티에서는 co-work이 필요 • 고스톱에서는 co-work방지가 필요 • Hard to solve  in chess, 35100 possible nodes, 1040 different legal positions • Time limits  how to make the best use of time to reach good decisions • Pruning, heuristic evaluation function Constraint Propagation

  50. Perfect decisions in two person games • The initial state, A set of operators, A terminal test, A utility function (payoff function) • Mini-max algorithm, • Negmax algorithms Constraint Propagation

More Related