CMU Snake Robot http://www-cgi.cs.cmu.edu/afs/cs.cmu.edu/Web/People/biorobotics/projects/modsnake/index.html.

Slides:



Advertisements
Similar presentations
Review: Search problem formulation
Advertisements

Informed Search Algorithms
Notes Dijstra’s Algorithm Corrected syllabus.
Informed search strategies
Informed search algorithms
An Introduction to Artificial Intelligence
Problem Solving: Informed Search Algorithms Edmondo Trentin, DIISM.
Solving Problem by Searching
1 Heuristic Search Chapter 4. 2 Outline Heuristic function Greedy Best-first search Admissible heuristic and A* Properties of A* Algorithm IDA*
EIE426-AICV 1 Blind and Informed Search Methods Filename: eie426-search-methods-0809.ppt.
Search Strategies CPS4801. Uninformed Search Strategies Uninformed search strategies use only the information available in the problem definition Breadth-first.
Problem Solving by Searching
SE Last time: Problem-Solving Problem solving: Goal formulation Problem formulation (states, operators) Search for solution Problem formulation:
Review: Search problem formulation
Artificial Intelligence
Cooperating Intelligent Systems Informed search Chapter 4, AIMA.
CS 460 Spring 2011 Lecture 3 Heuristic Search / Local Search.
Problem Solving and Search in AI Heuristic Search
CSC344: AI for Games Lecture 4: Informed search
CS 561, Session 6 1 Last time: Problem-Solving Problem solving: Goal formulation Problem formulation (states, operators) Search for solution Problem formulation:
State-Space Searches. 2 State spaces A state space consists of –A (possibly infinite) set of states The start state represents the initial problem Each.
Review: Search problem formulation Initial state Actions Transition model Goal state (or goal test) Path cost What is the optimal solution? What is the.
Problem Solving and Search Andrea Danyluk September 11, 2013.
Informed search algorithms
Informed search algorithms
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.
State-Space Searches. 2 State spaces A state space consists of A (possibly infinite) set of states The start state represents the initial problem Each.
Some material adopted from notes by Charles R. Dyer, University of Wisconsin-Madison Informed Search Chapter 4 (a)
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.
Informed searching. Informed search Blind search algorithms do not consider any information about the states and the goals Often there is extra knowledge.
Informed Search Methods. Informed Search  Uninformed searches  easy  but very inefficient in most cases of huge search tree  Informed searches  uses.
Informed Search Strategies Lecture # 8 & 9. Outline 2 Best-first search Greedy best-first search A * search Heuristics.
For Friday Finish reading chapter 4 Homework: –Lisp handout 4.
For Monday Read chapter 4, section 1 No homework..
Search with Costs and Heuristic Search 1 CPSC 322 – Search 3 January 17, 2011 Textbook §3.5.3, Taught by: Mike Chiang.
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.
Advanced Artificial Intelligence Lecture 2: Search.
CSC3203: AI for Games Informed search (1) Patrick Olivier
1 Kuliah 4 : Informed Search. 2 Outline Best-First Search Greedy Search A* Search.
Informed Search and Heuristics Chapter 3.5~7. Outline Best-first search Greedy best-first search A * search Heuristics.
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:
Informed Search II CIS 391 Fall CIS Intro to AI 2 Outline PART I  Informed = use problem-specific knowledge  Best-first search and its variants.
Heuristic Search Foundations of Artificial Intelligence.
A* optimality proof, cycle checking CPSC 322 – Search 5 Textbook § 3.6 and January 21, 2011 Taught by Mike Chiang.
3.5 Informed (Heuristic) Searches This section show how an informed search strategy can find solution more efficiently than uninformed strategy. Best-first.
Chapter 3.5 and 3.6 Heuristic Search Continued. Review:Learning Objectives Heuristic search strategies –Best-first search –A* algorithm Heuristic functions.
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.
For Monday Read chapter 4 exercise 1 No homework.
CPSC 322, Lecture 7Slide 1 Heuristic Search Computer Science cpsc322, Lecture 7 (Textbook Chpt 3.6) Sept, 20, 2013.
Chapter 3 Solving problems by searching. Search We will consider the problem of designing goal-based agents in observable, deterministic, discrete, known.
1 Intro to AI Informed Search. 2 Intro to AI Heuristic search Best-first search –Greedy search –Beam search –A, A* –Examples Memory-conserving variations.
Chapter 3.5 Heuristic Search. Learning Objectives Heuristic search strategies –Best-first search –A* algorithm Heuristic functions.
Computer Science cpsc322, Lecture 7
Review: Tree search Initialize the frontier using the starting state
Last time: Problem-Solving
Heuristic Search Introduction to Artificial Intelligence
David Kauchak CS30 – Spring 2016
Discussion on Greedy Search and A*
Discussion on Greedy Search and A*
CS 4100 Artificial Intelligence
Informed search algorithms
Informed search algorithms
David Kauchak CS51A – Spring 2019
David Kauchak CS51A – Spring 2019
Informed Search.
Presentation transcript:

CMU Snake Robot http://www-cgi.cs.cmu.edu/afs/cs.cmu.edu/Web/People/biorobotics/projects/modsnake/index.html

CS311 David Kauchak Spring 2013 Informed Search CS311 David Kauchak Spring 2013 Some material borrowed from : Sara Owsley Sood and others

Administrative Assignment 1 was due before class Written problems? how’d it go? come talk to me earlier than later! Written problems? Assignment 2 Mancala (game playing) will be out later today or tomorrow < 2 weeks to complete Can work with a partner tournament! Lectures slides posted on the course web page

Uninformed search strategies Uninformed search strategies use only the information available in the problem definition Breadth-first search Uniform-cost search Depth-first search Depth-limited search Iterative deepening search

Summary of algorithms

A few subtleties… What is the difference between a state and a node?

Be Careful! states vs. nodes A state is a (representation of) a physical configuration A node is a data structure constituting part of a search tree includes state, parent node, action, path cost g(x), depth

Repeated states What is the impact of repeated states? 1 3 8 1 8 1 3 8 4 7 4 3 7 4 7 6 5 2 6 5 2 6 5 2 def treeSearch(start): add start to the frontier while frontier isn’t empty: get the next node from the frontier if node contains goal state: return solution else: expand node and add resulting nodes to frontier

Can make problems seem harder … What will this look like for treeSearch? Solution?

Graph search Keep track of nodes that have been visited (explored) Only add nodes to the frontier if their state has not been seen before def graphSearch(start): add start to the frontier set explored to empty while frontier isn’t empty: get the next node from the frontier if node contains goal state: return solution else: add node to explored set expand node and add resulting nodes to frontier, if they are not in frontier or explored

Graph search implications? We’re keeping track of all of the states that we’ve previously seen For problems with lots of repeated states, this is a huge time savings The tradeoff is that we blow-up the memory usage Space graphDFS? O(bm) Something to think about, but in practice, we often just use the tree approach

8-puzzle revisited The average depth of a solution for an 8-puzzle is 22 moves What do you think the average branching factor is? ~3 (center square has 4 options, corners have 2 and edges have 3) An exhaustive search would require ~322 = 3.1 x 1010 states BFS: 10 terabytes of memory DFS: 8 hours (assuming one million nodes/second) IDS: ~9 hours Can we do better? 1 3 8 4 7 6 5 2

from: Claremont to:Rowland Heights What would the search algorithms do?

from: Claremont to:Rowland Heights DFS

from: Claremont to:Rowland Heights BFS and IDS

from: Claremont to:Rowland Heights We’d like to bias search towards the actual solution Ideas?

Informed search Order the frontier based on some knowledge of the world that estimates how “good” a state is f(n) is called an evaluation function Best-first search rank the frontier based on f(n) take the most desirable state in the frontier first different approaches depending on how we define f(n) def treeSearch(start): add start to the frontier while frontier isn’t empty: get the next node from the frontier if node contains goal state: return solution else: expand node and add resulting nodes to frontier

Heuristic Merriam-Webster's Online Dictionary Heuristic (pron. \hyu-’ris-tik\): adj. [from Greek heuriskein to discover.] involving or serving as an aid to learning, discovery, or problem-solving by experimental and especially trial-and-error methods The Free On-line Dictionary of Computing (2/19/13) heuristic 1. Of or relating to a usually speculative formulation serving as a guide in the investigation or solution of a problem: "The historian discovers the past by the judicious use of such a heuristic device as the 'ideal type'" (Karl J. Weintraub).

Heuristic function: h(n) An estimate of how close the node is to a goal Uses domain-specific knowledge Examples Map path finding? straight-line distance from the node to the goal (“as the crow flies”) 8-puzzle? how many tiles are out of place Missionaries and cannibals? number of people on the starting bank

Greedy best-first search f(n) = h(n) rank nodes by how close we think they are to the goal Arad to Bucharest

Greedy best-first search

Greedy best-first search

Greedy best-first search

Greedy best-first search Is this right/optimal?

Problems with greedy best-first search Time? O(bm) – but can be much faster Space? O(bm) – have to keep them in memory to rank Complete? No – can get stuck in loops, e.g., Iasi  Neamt  Iasi  Neamt  O(b^m), but a good heuristic can give dramatic improvement O(b^m) -- keeps all nodes in memory No

Problems with greedy best-first search Complete? Graph search, yes Tree search, no No – can get stuck in loops, e.g., Iasi  Neamt  Iasi  Neamt  O(b^m), but a good heuristic can give dramatic improvement O(b^m) -- keeps all nodes in memory No

Problems with greedy best-first search Complete? Graph search, yes Tree search, no No – can get stuck in loops, e.g., Iasi  Neamt  Iasi  Neamt  O(b^m), but a good heuristic can give dramatic improvement O(b^m) -- keeps all nodes in memory No

Problems with greedy best-first search Optimal? No – can get stuck in loops, e.g., Iasi  Neamt  Iasi  Neamt  O(b^m), but a good heuristic can give dramatic improvement O(b^m) -- keeps all nodes in memory No

Problems with greedy best-first search Optimal? no, as we just saw in the map example No – can get stuck in loops, e.g., Iasi  Neamt  Iasi  Neamt  a g b c d e h i h=2 h=1 h=0 h=3 O(b^m), but a good heuristic can give dramatic improvement Sometimes it’s too greedy O(b^m) -- keeps all nodes in memory Shortest path from a to g? What is the problem? No

A* search Idea: f(n) = g(n) + h(n) don’t expand paths that are already expensive take into account the path cost! f(n) = g(n) + h(n) g(n) is the path cost so far h(n) is our estimate of the cost to the goal f(n) is our estimate of the total path cost to the goal through n

A* search a g b c d e h i h=2 h=1 h=0 h=3 f(n) = ? f(n) = ?

A* search a g b c d e h i h=2 h=1 h=0 h=3 f(n) = 4 f(n) = 5

A* search

A* search

A* search

A* search

A* search

A* search

Admissible heuristics A heuristic function is admissible if it never overestimates if h*(n) is the actual distance to the goal h(n) ≤ h*(n) An admissible heuristic is optimistic (it always thinks the goal is closer than it actually is) Is the straight-line distance admissible? closest to the actual “price” without going over

A* properties Time? Space? Complete? Optimal? depends on heuristic, but generally exponential Space? exponential (have to keep all the nodes in memory/frontier) Complete? YES Optimal? YES, if the heuristic is admissible Why? If we could overestimate, then we could find (that is remove from the queue) a goal node that was suboptimal because our estimate for the optimal goal was too large

A point of technicality Technically if the heuristic isn’t admissible, then the search algorithm that uses f(n) = g(n) + h(n) is call “Algorithm A” A* algorithm requires that the heuristic is admissible That said, you’ll often hear the later referred to as A* Algorithm A is not optimal

Admissible heuristics 8-puzzle 1 3 8 1 2 5 1 2 4 7 4 8 3 4 5 6 5 2 3 6 7 6 7 8 goal

Admissible heuristics 8-puzzle h1(n) = number of misplaced tiles? h2(n) = manhattan distance? admissible? h1 = 7 h2 = 12 h1 = 8 h2 = 8 1 3 8 1 2 5 1 2 4 7 4 8 3 4 5 6 5 2 3 6 7 6 7 8 goal

Admissible heuristics 8-puzzle h1(n) = number of misplaced tiles? h2(n) = manhattan distance? which is better? h1 = 7 h2 = 12 h1 = 8 h2 = 8 1 3 8 1 2 5 1 2 4 7 4 8 3 4 5 6 5 2 3 6 7 6 7 8 goal

Dominance Given two admissible heuristic functions if hi(n) ≥ hj(n) for all n then hi(n) dominates hj(n) A dominant function is always better. Why? It always give a better (i.e. closer) estimate to the actual path cost, without going over What about? h1(n) = number of misplaced tiles h2(n) = manhattan distance

Dominance h2(n) dominates h1(n) depth of solution IDS A*(h1) A*(h2) 2 10 6 4 112 13 12 680 20 18 8 6384 39 25 47127 93 3644035 227 73 14 539 113 16 1301 211 3056 363 7276 676 average nodes expanded for 8-puzzle problems

Combining heuristics Sometimes, we have multiple admissible heuristics, but none dominates What then? We can take the max of all the heuristics! Why? Since they’re all admissible, we know none overestimate taking the max gives us a closer/better estimate overall, a better heuristic function

Relaxed problems A problem with fewer restrictions on the actions is called a relaxed problem The cost of an optimal solution to a relaxed problem is an admissible heuristic for the original problem 8-puzzle: relaxed problems? If the rules of the 8-puzzle are relaxed so that a tile can move anywhere, then h1(n) gives the shortest solution If the rules are relaxed so that a tile can move to any adjacent square, then h2(n) gives the shortest solution

Using A* in Planning C A B C A B C B A B A C B A C B A B C C B A B A C h(n) = “# of goals remaining to be satisfied” g(n) = “# of steps so far”

Missionaries and Cannibals Creating Heuristics Missionaries and Cannibals Remove 5 Sticks 8-Puzzle Route Planning Water Jug Problem N-Queens 5 2