Presentation is loading. Please wait.

Presentation is loading. Please wait.

Hande ÇAKIN 20133206003 IES 503 TERM PROJECT CONSTRAINT SATISFACTION PROBLEMS.

Similar presentations


Presentation on theme: "Hande ÇAKIN 20133206003 IES 503 TERM PROJECT CONSTRAINT SATISFACTION PROBLEMS."— Presentation transcript:

1 Hande ÇAKIN 20133206003 IES 503 TERM PROJECT CONSTRAINT SATISFACTION PROBLEMS

2 1 OUTLINE Constraint Satisfaction Problems (CSP) Benefits of CSPs Varieties of CSPs Backtracking Search for CSPs Improving backtracking efficiency Minimum remaining values (MRV) heuristic Forward Checking Constraint propagation Local Search for CSPs Min-conflicts Heuristic The Structure of Problems Independent Subproblems Cycle Cutset Tree Decomposition Summary

3 1 Constraint Satisfaction Problems (CSP) Constraint satisfaction problems (CSPs) are mathematical problems defined as a set of objects whose state must satisfy a number of constraints or limitations Simple Examples Eight queens puzzle Map coloring problem Sudoku Real World Examples Assignment Problems Timetabling Problems Transportation Problems Factory Scheduling

4 1 Constraint Satisfaction Problems (CSP) STANDARD SEARCH PROBLEM State is defined as a ‘black box’ and represented with the successor function, heuristic function and goal test. CONSTRAINT SATISFACTION PROBLEMS State is defined by variables X i with values from domain D i and goal test is a set of constraints specifying allowable combinations of values for subsets of variables

5 2 Constraint Satisfaction Problems (CSP) Benefits of CSPs The CSPs yield a natural representation for a wide variety of problem It is possible to develop effective, generic heuristic w/o additional domain-spesific expertise CSP solver is faster than state space search by eliminating large swatches of the search space The structure of the constraint graph can be used to simplify the solution process

6 3 Constraint Satisfaction Problems (CSP) Example : Map Coloring Initial state: the empty assignment {), in which all variables are unassigned. Successor function: a value can be assigned to any unassigned variable, provided that it does not conflict with previously assigned variables. Goal test: the current assignment is complete. Path cost: a constant cost (e.g., 1) for every step. Same color is not allowable for neighbours!

7 4 Constraint Satisfaction Problems (CSP) Example : Map Coloring Variables: WA, NT, Q, NSW, V, SA, T Domains: D i = {Red, Green, Blue } Constraints: Neighbour regions should have different colors e.g., WA ≠ NT or (WA,NT) in {(red,green), (red,blue), (green,red), (green,blue), (blue,red), (blue, green)} Solutions: Complete and consistent assignments e.g. WA=red, NT= green, Q=red, NSW= green, V=red, SA= blue, T=green Same color is not allowable for neighbours!

8 5 Constraint Satisfaction Problems (CSP) Example : Map Coloring Constraint Graph Nodes are variables Arcs are constraints ‘Each constraint relates two variables’

9 6 Constraint Satisfaction Problems (CSP) Varieties of CSPs Types of Variables Discrete VariablesFinite Domainse.g. Boolean CSPsInfinite Domainse.g. Job SchedulingContinuous Variables e.g. Hubble Space Telescope observations

10 7 Constraint Satisfaction Problems (CSP) Varieties of CSPs Types of Constraints Unary Constraintse.g. SA≠ greenBinary Constraintse.g. SA ≠ WA Higher Order Constraints e.g. Cryptarithmetic column constraints

11 8 Backtracking Search for CPSs Depth-first search for CSPs with single-variable assignments is called backtracking search Backtracking search is the basic uninformed algorithm for CSPs Can solve n-queens for n ≈ 25

12 8 Backtracking Search for CPSs

13 8

14 8 Improving backtracking efficiency 1. Which variable should be assigned next, and in what order should its values be tried? 2. What are the implications of the current variable assignments for the other unassigned variables? 3. When a path fails-that is, a state is reached in which a variable has no legal values- can the search avoid repeating this failure in subsequent paths?

15 8 Backtracking Search for CPSs Variable and Value Ordering Minimum remaining values (MRV) heuristic: choosing the variable with the fewest "legal" values. It also has been called the "most constrained variable" or "fail-first" heuristic

16 8 Backtracking Search for CPSs Variable and Value Ordering Minimum remaining values (MRV) Most constraining variable Choose the variable with the most constraints on remaining variables

17 8 Backtracking Search for CPSs Variable and Value Ordering Minimum remaining values (MRV) Least constraining value Given a variable, choose the least constraining value: the one that rules out the fewest values in the remaining variables DEGREEHEURITICDEGREEHEURITIC

18 8 Backtracking Search for CPSs Propagating Information through Constraints Forward Checking Keep track of remaining legal values for unassigned variables Terminate search when any variable has no legal values

19 8 Backtracking Search for CPSs Propagating Information through Constraints Constraint propagation It is the general term for propagating the implications of a constraint on one variable onto other variables. In other words, using the constraints to reduce number of legal values for a variable. Arc consistency Node consistency Path consistency

20 Backtracking Search for CPSs Constraint propagation Arc consistency Provides a fast method of constraint propagation that is substantially stronger than forward checking X  Y is consistent if for every value x of X there is some allowed y

21 Backtracking Search for CPSs Constraint propagation Arc consistency 8 - 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

22 Backtracking Search for CPSs Constraint propagation Arc consistency 8 Time complexity = O(n 2 d 3 )

23 Backtracking Search for CPSs Constraint propagation A CSP is k-consistent if, for any set of k - 1 variables and for any consistent assignment to those variables, a consistent value can always be assigned to any kth variable. Node consistency Each individual variable by itself is consistent 1- consistency Arc consistency 2- consistency Path consistency Any pair of adjacent variables can always be extended to a third neighboring variable 3- consistency

24 Backtracking Search for CPSs Intelligent Backtracking- looking backward The BACKTRACKING-SEARCH algorithm; back up to the preceding variable and try a different value when it comes up with a failure Every value violates the constraint, so back up to the Tasmania! BACKJUMPING METHOD

25 Local Search for CSPs Local search algorithms move from solution to solution in the space of candidate solutions (the search space) by applying local changes, until a solution deemed optimal is found or a time bound is elapsed e.g. Hill-climbing, simulated annealing.. Complete state formulation 1.Assign a value for every variable 2.Randomly select any conflicted variable 3.The successor function works by changing the value of that variable at a time.

26 Local Search for CSPs Min-conflicts Heuristic Select the value that results in the minimum number of conflicts with other variables States: 4 queens in 4 columns (4 4 = 256 states) Actions: move queen in column Goal test: no attacks Evaluation: h(n) = number of attacks

27 The Structure of Problems Tasmania is not connected to the mainland. Intuitively, it is obvious that coloring Tasmania and coloring the mainland are independent subproblems Independent Subproblems

28 The Structure of Problems Cycle Cutset 1. Choose a subset S from VARIABLES such that the constraint graph becomes a tree after removal of S. S is called a cycle cutset. 2. For each possible assignment to the variables in S that satisfies all constraints on S, (a) remove from the domains of the remaining variables any values that are inconsistent with the assignment for S, and (b) If the remaining CSP has a solution, return it together with the assignment for S. Cycle cutset has size c, total runtime = O(dC. (n - c)d".

29 The Structure of Problems Tree Decomposition Solve each subproblem independently; If any one has no solution, the entire problem has no solution. If it is possible to solve all the subproblems, then attempt to construct a global solution

30 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


Download ppt "Hande ÇAKIN 20133206003 IES 503 TERM PROJECT CONSTRAINT SATISFACTION PROBLEMS."

Similar presentations


Ads by Google