CMPT 463. What will be covered A* search Local search Game tree Constraint satisfaction problems (CSP)

Slides:



Advertisements
Similar presentations
Constraint Satisfaction Problems
Advertisements

Informed search algorithms
Informed search algorithms
Lecture 11 Last Time: Local Search, Constraint Satisfaction Problems Today: More on CSPs.
1 Constraint Satisfaction Problems A Quick Overview (based on AIMA book slides)
Problem Solving by Searching
Constraint Satisfaction Problems
4 Feb 2004CS Constraint Satisfaction1 Constraint Satisfaction Problems Chapter 5 Section 1 – 3.
CS 460 Spring 2011 Lecture 3 Heuristic Search / Local Search.
CSC344: AI for Games Lecture 4: Informed search
Machine Learning and Review Reading: C Bayesian Approach  Each observed training example can incrementally decrease or increase probability of.
Constraint Satisfaction Problems
Constraint Satisfaction Problems
Constraint Satisfaction Problems
ISC 4322/6300 – GAM 4322 Artificial Intelligence Lecture 4 Constraint Satisfaction Problems Instructor: Alireza Tavakkoli September 17, 2009 University.
Variables “To be is to be the value of a variable.” - William Quine.
Informed search algorithms
1 Constraint Satisfaction Problems Slides by Prof WELLING.
Vilalta&Eick: Informed Search Informed Search and Exploration Search Strategies Heuristic Functions Local Search Algorithms Vilalta&Eick: Informed Search.
Search CSE When you can’t use A* Hill-climbing Simulated Annealing Other strategies 2 person- games.
INTRODUÇÃO AOS SISTEMAS INTELIGENTES Prof. Dr. Celso A.A. Kaestner PPGEE-CP / UTFPR Agosto de 2011.
Informed search algorithms
Constraint Satisfaction Problems Chapter 6. Review Agent, Environment, State Agent as search problem Uninformed search strategies Informed (heuristic.
Informed search algorithms
Chapter 5 Section 1 – 3 1.  Constraint Satisfaction Problems (CSP)  Backtracking search for CSPs  Local search for CSPs 2.
Informed search algorithms Chapter 4. Outline Best-first search Greedy best-first search A * search Heuristics.
1 Shanghai Jiao Tong University Informed Search and Exploration.
CSC 8520 Spring Paula Matuszek Based on Hwee Tou Ng, aima.eecs.berkeley.edu/slides-ppt, which are based on Russell, aima.eecs.berkeley.edu/slides-pdf.
Hande ÇAKIN IES 503 TERM PROJECT CONSTRAINT SATISFACTION PROBLEMS.
Informed search algorithms Chapter 4. Best-first search Idea: use an evaluation function f(n) for each node –estimate of "desirability"  Expand most.
Informed search strategies Idea: give the algorithm “hints” about the desirability of different states – Use an evaluation function to rank nodes and select.
1 Constraint Satisfaction Problems Soup Total Cost < $30 Chicken Dish Vegetable RiceSeafood Pork Dish Appetizer Must be Hot&Sour No Peanuts No Peanuts.
Chapter 5: Constraint Satisfaction ICS 171 Fall 2006.
CSCI 5582 Fall 2006 CSCI 5582 Artificial Intelligence Fall 2006 Jim Martin.
Local Search Algorithms
Review: Tree search Initialize the frontier using the starting state While the frontier is not empty – Choose a frontier node to expand according to search.
Local Search Pat Riddle 2012 Semester 2 Patricia J Riddle Adapted from slides by Stuart Russell,
CSC 8520 Spring Paula Matuszek CS 8520: Artificial Intelligence Search 3: Constraint Satisfaction Problems Paula Matuszek Spring, 2013.
For Wednesday Read chapter 6, sections 1-3 Homework: –Chapter 4, exercise 1.
For Wednesday Read chapter 5, sections 1-4 Homework: –Chapter 3, exercise 23. Then do the exercise again, but use greedy heuristic search instead of A*
Princess Nora University Artificial Intelligence Chapter (4) Informed search algorithms 1.
4/11/2005EE562 EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS Lecture 4, 4/11/2005 University of Washington, Department of Electrical Engineering Spring 2005.
A General Introduction to Artificial Intelligence.
Feng Zhiyong Tianjin University Fall  Best-first search  Greedy best-first search  A * search  Heuristics  Local search algorithms  Hill-climbing.
Best-first search Idea: use an evaluation function f(n) for each node –estimate of "desirability"  Expand most desirable unexpanded node Implementation:
1 Constraint Satisfaction Problems Chapter 5 Section 1 – 3 Grand Challenge:
CHAPTER 5 SECTION 1 – 3 4 Feb 2004 CS Constraint Satisfaction 1 Constraint Satisfaction Problems.
Constraint Satisfaction Problems University of Berkeley, USA
Announcement "A note taker is being recruited for this class. No extra time outside of class is required. If you take clear, well-organized notes, this.
1. 2 Outline of Ch 4 Best-first search Greedy best-first search A * search Heuristics Functions Local search algorithms Hill-climbing search Simulated.
Computing & Information Sciences Kansas State University Friday, 08 Sep 2006CIS 490 / 730: Artificial Intelligence Lecture 7 of 42 Friday, 08 September.
Chapter 5 Team Teaching AI (created by Dewi Liliana) PTIIK Constraint Satisfaction Problems.
Chapter 3.5 and 3.6 Heuristic Search Continued. Review:Learning Objectives Heuristic search strategies –Best-first search –A* algorithm Heuristic functions.
1 Constraint Satisfaction Problems Chapter 5 Section 1 – 3.
Dr. Shazzad Hosain Department of EECS North South University Lecture 01 – Part C Constraint Satisfaction Problems.
CPSC 420 – Artificial Intelligence Texas A & M University Lecture 5 Lecturer: Laurie webster II, M.S.S.E., M.S.E.e., M.S.BME, Ph.D., P.E.
Local Search Algorithms CMPT 463. When: Tuesday, April 5 3:30PM Where: RLC 105 Team based: one, two or three people per team Languages: Python, C++ and.
1 Constraint Satisfaction Problems (CSP). Announcements Second Test Wednesday, April 27.
Constraint Satisfaction Problems
Chapter 3.5 Heuristic Search. Learning Objectives Heuristic search strategies –Best-first search –A* algorithm Heuristic functions.
CS 561, Session 8 1 This time: constraint satisfaction - Constraint Satisfaction Problems (CSP) - Backtracking search for CSPs - Local search for CSPs.
Local Search Algorithms
Constraint Satisfaction Problems
Constraint satisfaction problems
CS 8520: Artificial Intelligence
Midterm Review.
Constraint Satisfaction Problems
Constraint satisfaction problems
Constraint Satisfaction Problems (CSP)
Presentation transcript:

CMPT 463

What will be covered A* search Local search Game tree Constraint satisfaction problems (CSP)

Types of Questions T or F Short answers Homework questions (A*, MiniMax, pruning..)

A * search Best-known form of best-first search. Idea: avoid expanding paths that are already expensive Evaluation function f(n) = g(n) + h(n) g(n) = cost so far to reach n h(n) = estimated cost from n to goal f(n) = estimated total cost of path through n to goal

Admissible heuristics A heuristic h(n) is admissible if for every node n, h(n) ≤ h * (n), where h * (n) is the true cost to reach the goal state from n. An admissible heuristic never overestimates the cost to reach the goal Example: h SLD (n) (never overestimates the actual road distance)

A* Search Complete Yes, unless there are infinitely many nodes with f <= f(G) Time Exponential in [relative error of h x length of soln] The better the heuristic, the better the time Best case h is perfect, O(d) Worst case h = 0, O(b d ) same as BFS Space Keeps all nodes in memory and save in case of repetition This is O(b d ) or worse A* usually runs out of space before it runs out of time Optimal Yes, cannot expand f i+1 unless f i is finished

Manhattan distances

Heuristic Function Function h(N) that estimate the cost of the cheapest path from node N to goal node. Example: 8-puzzle N goal h 2 (N) = sum of the distances of every tile to its goal position = = 13

Local search algorithms In many optimization problems, the path to the goal is irrelevant; the goal state itself is the solution. e.g., n-queens. We can use local search algorithms: keep a single "current" state, try to improve it generally move to neighbors The paths are not retained 9

Hill-climbing search Problem: depending on initial state, can get stuck in local maxima.

Some solutions allow a sideways move shoulder  flat local maximum, that is not a shoulder 11

Some solutions Solution: a limit on the number of consecutive sideway moves E.g., 100 consecutive sideways movies in the 8-queens problem successful rate: raises from14% to 94%  cost: 21 steps on average for each successful instance, 64 for each failure 12

Some more solutions (Variants of hill climbing ) Stochastic hill climbing chooses at random from among the uphill moves converge more slowly, but finds better solutions Random-restart hill climbing “If you don’t succeed, try, try again.” Keep restarting from randomly generated initial states, stopping when goal is found

Simulated Annealing Picks a random move (instead of the best) If “good move” accepted; else accepted with some probability The probability decreases exponentially with the “badness” of the move It also decreases as temperature “T” goes down

Local Beam Search Idea: keep k states instead of 1; choose top k of all their successors Not the same as k searches run in parallel! Searches that find good states recruit other searches to join them moves the resources to where the most progress is being made

Minimax The minimax value of a node is the utility (for Max) of being in the corresponding state, assuming that both players play optimally. Minimax(s) = Utility (s)if Terminal-test(s) max of Minimax(Result(s,a)) if Player(s) = Max min of Minimax(Result(s,a))if Player(s) = Min

Optimal Play MAX MIN This is the optimal play

Alpha-Beta Example [-∞, +∞] Range of possible values Do DFS until first leaf

Alpha-Beta Example (continued) [-∞,3] [-∞,+∞]

Alpha-Beta Example (continued) [-∞,3] [-∞,+∞]

Alpha-Beta Example (continued) [3,+∞] [3,3]

Alpha-Beta Example (continued) [-∞,2] [3,+∞] [3,3] This node is worse for MAX

Alpha-Beta Example (continued) [-∞,2] [3,14] [3,3][-∞,14],

Alpha-Beta Example (continued) [−∞,2] [3,5] [3,3][-∞,5],

Alpha-Beta Example (continued) [2,2] [−∞,2] [3,3]

Alpha-Beta Example (continued) [2,2] [-∞,2] [3,3]

27 Example: Map-Coloring Variables WA, NT, Q, NSW, V, SA, T Domains D i = {red, green, blue} Constraints: adjacent regions must have different colors e.g., WA ≠ NT, or (WA,NT) in {(red,green),(red,blue),(green,red), (green,blue),(blue,red),(blue,green)}

28 Example: Map-Coloring Solutions are complete and consistent assignments, e.g., WA = red, NT = green, Q = red, NSW = green, V = red, SA = blue, T = green

29 Varieties of constraints Unary constraints involve a single variable, e.g., SA ≠ green Binary constraints involve pairs of variables, e.g., SA ≠ WA Higher-order constraints involve 3 or more variables, e.g., cryptarithmetic column constraints

30 Example: Cryptarithmetic Variables: F T U W R O X 1 X 2 X 3 Domains: {0,1,2,3,4,5,6,7,8,9} Constraints: Alldiff (F,T,U,W,R,O) O + O = R + 10 · X 1 X 1 + W + W = U + 10 · X 2 X 2 + T + T = O + 10 · X 3 X 3 = F, T ≠ 0, F ≠ 0

Sudoku

Example: Sudoku CSP variables: X 11, …, X 99 domains: {1,…,9} constraints: row constraint: X 11  X 12, …, X 11  X 19 col constraint: X 11  X 12, …, X 11  X 19 block constraint: X 11  X 12, …, X 11  X 33 Goal: Assign a value to every variable such that all constraints are satisfied

33 Most constrained variable Most constrained variable: choose the variable with the fewest legal values a.k.a. minimum remaining values (MRV) heuristic

34 Most constraining variable Tie-breaker among most constrained variables Most constraining variable (degree heuristics): choose the variable with the most constraints on remaining variables

35 Least constraining value Given a variable, choose the least constraining value: the one that rules out the fewest values in the remaining variables Combining these heuristics makes 1000 queens feasible

36 Forward checking Idea: Keep track of remaining legal values for unassigned variables Terminate search when any variable has no legal values

37 Forward checking Idea: Keep track of remaining legal values for unassigned variables Terminate search when any variable has no legal values

38 Forward checking Idea: Keep track of remaining legal values for unassigned variables Terminate search when any variable has no legal values

39 Forward checking Idea: Keep track of remaining legal values for unassigned variables Terminate search when any variable has no legal values