1 / 30

Hande ÇAKIN 20133206003

IES 503 TERM PROJECT CONSTRAINT SATISFACTION PROBLEMS. Hande ÇAKIN 20133206003. OUTLINE. Constraint Satisfaction Problems (CSP ) Benefits of CSPs Varieties of CSPs Backtracking Search for CSPs Improving backtracking efficiency M in im um remaining values (MRV ) heuristic

lynna
Download Presentation

Hande ÇAKIN 20133206003

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. IES 503 TERM PROJECT CONSTRAINT SATISFACTION PROBLEMS Hande ÇAKIN 20133206003

  2. OUTLINE • ConstraintSatisfactionProblems (CSP) • Benefits of CSPs • Varieties of CSPs • BacktrackingSearchforCSPs • Improving backtracking efficiency • Minimum remaining values (MRV)heuristic • ForwardChecking • Constraint propagation • LocalSearchforCSPs • Min-conflictsHeuristic • TheStructure of Problems • IndependentSubproblems • CycleCutset • TreeDecomposition • Summary 1

  3. ConstraintSatisfactionProblems (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 AssignmentProblems TimetablingProblems TransportationProblems FactoryScheduling 1

  4. ConstraintSatisfactionProblems (CSP) 1

  5. ConstraintSatisfactionProblems (CSP) Benefits of CSPs 2

  6. ConstraintSatisfactionProblems (CSP) Example : MapColoring • Initial state: the empty assignment {), in which all variables are unassigned. • Successor function: a value can be assigned to any unassigned variable, provided thatit 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. R B G Samecolor is not allowableforneighbours! 3

  7. ConstraintSatisfactionProblems (CSP) Example : MapColoring Variables: WA, NT, Q, NSW, V, SA, T Domains: Di= {Red, Green, Blue } Constraints: Neighbourregionsshouldhavedifferentcolors e.g., WA ≠ NT or (WA,NT) in {(red,green), (red,blue), (green,red), (green,blue), (blue,red), (blue, green)} Solutions: Complete andconsistentassignments e.g. WA=red, NT= green, Q=red, NSW= green, V=red, SA= blue, T=green R B G Samecolor is not allowableforneighbours! 4

  8. ConstraintSatisfactionProblems (CSP) Example : MapColoring R Nodesarevariables Arcsareconstraints ‘Eachconstraintrelatestwovariables’ B G ConstraintGraph 5

  9. ConstraintSatisfactionProblems (CSP) Varieties of CSPs 6

  10. ConstraintSatisfactionProblems (CSP) Varieties of CSPs 7

  11. BacktrackingSearchforCPSs • 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 8

  12. BacktrackingSearchforCPSs 8

  13. BacktrackingSearchforCPSs 8

  14. BacktrackingSearchforCPSs 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? 8

  15. BacktrackingSearchforCPSs Variableand 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 8

  16. BacktrackingSearchforCPSs Variableand Value Ordering Minimum remaining values (MRV) Most constraining variable Choosethe variable with the most constraints on remaining variables 8

  17. BacktrackingSearchforCPSs Variableand Value Ordering D E G R E E H E U R I T I C 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 8

  18. BacktrackingSearchforCPSs Propagating Information throughConstraints ForwardChecking • Keep track of remaining legal values for unassigned variables • Terminate search when any variable has no legal values 8

  19. BacktrackingSearchforCPSs Propagating Information throughConstraints Constraint propagation • Itis the general term for propagating the implicationsof a constraint on one variable onto other variables. • Inotherwords, usingtheconstraintstoreducenumber of legal valuesfor a variable. • Arc consistency • Nodeconsistency • Pathconsistency 8

  20. BacktrackingSearchforCPSs Constraint propagation Arc consistency Providesa fast method of constraint propagation that issubstantially stronger than forward checking X Y is consistent iffor every value x of X there is some allowed y

  21. BacktrackingSearchforCPSs Constraint propagation Arc consistency - 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 8

  22. BacktrackingSearchforCPSs Constraint propagation Arc consistency Time complexity = O(n2d3) 8

  23. BacktrackingSearchforCPSs Constraint propagation A CSP is k-consistent if, for any set of k - 1 variables and for any consistent assignment tothose variables, a consistent value can always be assigned to any kth variable.

  24. BacktrackingSearchforCPSs IntelligentBacktracking- lookingbackward The BACKTRACKING-SEARCH algorithm; back up to the preceding variable and try a different valuewhen it comesupwith a failure Every value violates the constraint, so back up to the Tasmania! R ? G BACKJUMPING METHOD B R

  25. LocalSearchforCSPs Localsearch 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 stateformulation Assign a value for every variable Randomlyselect any conflicted variable The successor function works by changing the value of thatvariable at a time.

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

  27. TheStructure of Problems IndependentSubproblems Tasmania is not connected to the mainland.Intuitively, it is obvious that coloring Tasmania and coloring the mainland are independent subproblems

  28. TheStructure of Problems CycleCutset Cyclecutset has size c, total runtime = O(dC. (n - c)d". 1. Choose a subset S from VARIABLESsuch 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.

  29. TheStructure of Problems TreeDecomposition Tree width has size w Total run time = O(n) • Solveeach subproblem independently; • If any one has no solution, the entireproblem has no solution. • If it is possibletosolve all the subproblems, thenattempt 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

More Related