Presentation is loading. Please wait.

Presentation is loading. Please wait.

Constraint Satisfaction Problems

Similar presentations


Presentation on theme: "Constraint Satisfaction Problems"— Presentation transcript:

1 Constraint Satisfaction Problems
Chapter 5 Section 1 – 3 Modified by Vali Derhami CS Constraint Satisfaction

2 Forward checking وارسی پیشرو
Idea: Keep track of remaining legal values for unassigned variables هنگامیکه به یک متغیر انتسابی می شود تمام مقادیری از متغیرهای انتساب نیافته دیگر که با این مقدار دهی ناسازگارند را از دامنه آن متغیرها حذف میکند Terminate search when any variable has no legal values CS Constraint Satisfaction

3 CS 3243 - Constraint Satisfaction
Forward checking Idea: Keep track of remaining legal values for unassigned variables Terminate search when any variable has no legal values CS Constraint Satisfaction

4 CS 3243 - Constraint Satisfaction
Forward checking Idea: Keep track of remaining legal values for unassigned variables Terminate search when any variable has no legal values CS Constraint Satisfaction

5 CS 3243 - Constraint Satisfaction
Forward checking Idea: Keep track of remaining legal values for unassigned variables Terminate search when any variable has no legal values CS Constraint Satisfaction

6 Constraint propagation
Forward checking propagates information from assigned to unassigned variables, but doesn't provide early detection for all failures: NT and SA cannot both be blue! Constraint propagation repeatedly enforces constraints locally CS Constraint Satisfaction

7 Arc consistency سازگاری کمان
Simplest form of propagation makes each arc consistent for every value dx of X there is some allowed dy برای هر مقدار dx از متغیر X یک مقدار مجاز برای متغیر Y باشد CS Constraint Satisfaction

8 CS 3243 - Constraint Satisfaction
Arc consistency Simplest form of propagation makes each arc consistent for every value dx of X there is some allowed dy CS Constraint Satisfaction

9 CS 3243 - Constraint Satisfaction
Arc consistency Simplest form of propagation makes each arc consistent X Y is consistent iff for every value dx of X there is some allowed dy If X loses a value, neighbors of X need to be rechecked CS Constraint Satisfaction

10 CS 3243 - Constraint Satisfaction
Arc consistency Simplest form of propagation makes each arc consistent X Y is consistent iff for every value dx of X there is some allowed dy If X loses a value, neighbors of X need to be rechecked Arc consistency detects failure earlier than forward checking Can be run as a preprocessor or after each assignment 4 Feb 2004 CS Constraint Satisfaction

11 Arc consistency algorithm AC-3
Time complexity: O(n2d3) 4 Feb 2004 CS Constraint Satisfaction

12 CS 3243 - Constraint Satisfaction
Local search for CSPs Hill-climbing, simulated annealing typically work with "complete" states, i.e., all variables assigned To apply to CSPs: allow states with unsatisfied constraints operators reassign variable values Variable selection: randomly select any conflicted variable Value selection by min-conflicts heuristic: choose value that violates the fewest constraints i.e., hill-climb with h(n) = total number of violated constraints Violate: نقض کردن 4 Feb 2004 CS Constraint Satisfaction

13 CS 3243 - Constraint Satisfaction
Example: 4-Queens Actions: move queen in column Goal test: no attacks Evaluation: h(n) = number of attacks Given random initial state, can solve n-queens in almost constant time for arbitrary n with high probability (e.g., n = 10,000,000) CS Constraint Satisfaction

14 CS 3243 - Constraint Satisfaction
Summary CSPs are a special kind of problem: states defined by values of a fixed set of variables goal test defined by constraints on variable values Backtracking = depth-first search with one variable assigned per node Variable ordering and value selection heuristics help significantly Forward checking prevents assignments that guarantee later failure Constraint propagation (e.g., arc consistency) does additional work to constrain values and detect inconsistencies Iterative min-conflicts is usually effective in practice 4 Feb 2004 CS Constraint Satisfaction


Download ppt "Constraint Satisfaction Problems"

Similar presentations


Ads by Google