1 / 27

Constraint Propagation: Heuristics

Constraint Propagation: Heuristics. Artificial Intelligence CMSC 25000 January 24, 2002. Agenda. Constraint Propagation: Review CSP structure Propagation mechanisms Constraint Propagation Heuristics Back-jumping Dynamic ordering Iterative improvement Summary .

hwilliam
Download Presentation

Constraint Propagation: Heuristics

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:Heuristics Artificial Intelligence CMSC 25000 January 24, 2002

  2. Agenda • Constraint Propagation: Review • CSP structure • Propagation mechanisms • Constraint Propagation Heuristics • Back-jumping • Dynamic ordering • Iterative improvement • Summary

  3. Constraint Satisfaction Problems • Very general: Model wide range of tasks • Key components: • Variables: Take on a value • Domains: Values that can be assigned to vars • Constraints: Restrictions on assignments • Constraints are HARD • Not preferences: Must be observed • E.g. Can’t schedule two classes: same room, same time

  4. Constraint Satisfaction Problem • Graph/Map Coloring: Label a graph such that no two adjacent vertexes same color • Variables: Vertexes • Domain: Colors • Constraints: If E(a,b), then C(a) != C(b)

  5. Constraint Satisfaction Problem • “N-Queens”: • Place N queens on an NxN chessboard such that none attacks another • Variables: Queens (1/column) • Domain: Rows • Constraints: Not same row, column, or diagonal

  6. N-queens Q3 Q1 Q4 Q2

  7. Constraint Propagation Method • For each variable, • Get all values for that variable • Remove all values that conflict with ALL adjacent • A:For each neighbor, remove all values that conflict with ALL adjacent • Repeat A as long as some label set is reduced

  8. Constraint Propagation Mechanism • Arc consistency • Arc V1->V2 is arc consistent if for all x in D1, there exists y in D2 such that (x,y) is allowed • Delete disallowed x’s to achieve arc consistency

  9. Arc Consistency Example • Graph Coloring: • Variables: Nodes • Domain: Colors (R,G,B) • Constraint: If E(a,b), then C(a) != C(b) • Initial assignments X R,G,B R,B R,B Z Y

  10. CSP as Search • Constraint Satisfaction Problem (CSP) is a restricted class of search problem • State: Set of variables & assignment info • Initial State: No variables assigned • Goal state: Set of assignments consistent with constraints • Operators: Assignment of value to variable

  11. Backtracking with Forward Checking • Augment DFS with backtracking • Add some constraint propagation • Propagate constraints • Remove assignments which violate constraint • Only propagate when domain = 1 • “Forward checking” • Limit constraints to test

  12. X=B X=R X=G Y=B Y=R Y=B Y=R Z=B Z=R Backtracking+Forward Checking No! No! Yes! Yes!

  13. Heuristic CSP • Improving Backtracking • Standard backtracking • Back up to last assignment • Back-jumping • Back up to last assignment that reduced current domain • Change assignment that led to dead end

  14. Heuristic backtracking: Back-jumping C1 C3 C5 C2 C4

  15. Heuristic Backtracking: Backjumping C1 C2 C3 C4 C5

  16. Heuristic Backtracking: Backjumping C1 C2 C3 C4 C5 Dead end! Why?

  17. Back-jumping • Previous assignment reduced domain • C3 = B • Changes to intermediate assignment can’t affect dead end • Backtrack up to C3 • Avoid wasted work - alternatives at C4 • In general, forward checking more effective

  18. Heuristic CSP: Dynamic Ordering • Question: What to explore next • Current solution: • Static: Next in fixed order • Lexicographic, leftmost.. • Random • Alternative solution: • Dynamic: Select “best” in current state

  19. Dynamic Ordering • Heuristic CSP • Most constrained variable: • Pick variable with smallest current domain • Least constraining value: • Pick value that removes fewest values from domains of other variables • Improve chance of finding SOME assignment • Can increase feasible size of CSP problem

  20. Dynamic Ordering C1 C3 C5 C2 C4

  21. Dynamic Ordering with FC C1 C2 C5 C3 C4

  22. Incremental Repair • Start with initial complete assignment • Use greedy approach • Probably invalid - I.e. violates some constraints • Incrementally convert to valid solution • Use heuristic to replace value that violates • “min-conflict” strategy: • Change value to result in fewest constraint violations • Break ties randomly • Incorporate in local or backtracking hill-climber

  23. Q2 Q4 Q1 Q3 Q2 Q4 Q1 Q3 Incremental Repair Q2 Q4 5 conflicts Q1 Q3 0 conflicts 2 conflicts

  24. Min-Conflict Effectiveness • N-queens: Given initial random assignment, can solve in ~ O(n) • For n < 10^7 • GSAT (satisfiability) • Best (near linear in practice) solution uses min-conflict-type hill-climbing strategy • Adds randomization to escape local min • ~Linear seems true for most CSPs • Except for some range of ratios of constraints to variables • Avoids storage of assignment history (for BT)

  25. CSP Complexity • Worst-case in general: • Depth-first search: • Depth= # of variables • Branching factor: |Domain| • |D|^n+1 • Tree-structured CSPs • No loops in constraint graph • O(n|D|^2)

  26. Tree-structured CSPs C1 C5 C2 C4 C3 C6 Constraint Graph Create breadth-first ordering Starting from leaf nodes [O(n)], remove all values from parent domain that do not participate in some valid pairwise constraint [O(|D|^2)] Starting from root node, assign value to variable

  27. CSP Summary • General problem structure • Variables; Domain: values to assign; • Constraints: Restrictions on valid assignments • N-Queens; Graph-coloring; 3-Sat; Scheduling • Constraint propagation mechanisms • Arc consistency • Search model: Backtrack+Forward-checking • Heuristics: Back-jump; Variable&value selection • Incremental refinement

More Related