Search (continued) CPSC 386 Artificial Intelligence Ellen Walker Hiram College.

Slides:



Advertisements
Similar presentations
Review: Search problem formulation
Advertisements

Heuristics CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
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*
1 Lecture 3 Uninformed Search. 2 Uninformed search strategies Uninformed: While searching you have no clue whether one non-goal state is better than any.
Properties of breadth-first search Complete? Yes (if b is finite) Time? 1+b+b 2 +b 3 +… +b d + b(b d -1) = O(b d+1 ) Space? O(b d+1 ) (keeps every node.
CS 480 Lec 3 Sept 11, 09 Goals: Chapter 3 (uninformed search) project # 1 and # 2 Chapter 4 (heuristic search)
Blind Search1 Solving problems by searching Chapter 3.
Search Strategies Reading: Russell’s Chapter 3 1.
CS 484 – Artificial Intelligence1 Announcements Department Picnic: today, after class Lab 0 due today Homework 2 due Tuesday, 9/18 Lab 1 due Thursday,
Chapter 4 Search Methodologies.
Artificial Intelligence (CS 461D)
Search Strategies CPS4801. Uninformed Search Strategies Uninformed search strategies use only the information available in the problem definition Breadth-first.
SE Last time: Problem-Solving Problem solving: Goal formulation Problem formulation (states, operators) Search for solution Problem formulation:
Review: Search problem formulation
1 Chapter 4 Search Methodologies. 2 Chapter 4 Contents l Brute force search l Depth-first search l Breadth-first search l Properties of search methods.
Using Search in Problem Solving
Uninformed Search Reading: Chapter 3 by today, Chapter by Wednesday, 9/12 Homework #2 will be given out on Wednesday DID YOU TURN IN YOUR SURVEY?
Problem Solving and Search in AI Heuristic Search
Using Search in Problem Solving
CSC344: AI for Games Lecture 4: Informed search
CS 188: Artificial Intelligence Spring 2006 Lecture 2: Queue-Based Search 8/31/2006 Dan Klein – UC Berkeley Many slides over the course adapted from either.
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.
State-Space Searches.
Informed Search Idea: be smart about what paths to try.
Review: Search problem formulation Initial state Actions Transition model Goal state (or goal test) Path cost What is the optimal solution? What is the.
Informed Search Strategies
Problem Solving and Search Andrea Danyluk September 11, 2013.
Vilalta&Eick: Informed Search Informed Search and Exploration Search Strategies Heuristic Functions Local Search Algorithms Vilalta&Eick: Informed Search.
Informed (Heuristic) Search
Informed search algorithms Chapter 4. Outline Best-first search Greedy best-first search A * search Heuristics.
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.
Informed search strategies Idea: give the algorithm “hints” about the desirability of different states – Use an evaluation function to rank nodes and select.
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.
Lecture 3: Uninformed Search
Search CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Advanced Artificial Intelligence Lecture 2: Search.
CSC3203: AI for Games Informed search (1) Patrick Olivier
1 Solving problems by searching Chapter 3. Depth First Search Expand deepest unexpanded node The root is examined first; then the left child of the root;
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.
Informed Search CSE 473 University of Washington.
Heuristic Search Foundations of Artificial Intelligence.
Searching for Solutions
3.5 Informed (Heuristic) Searches This section show how an informed search strategy can find solution more efficiently than uninformed strategy. Best-first.
Solving problems by searching A I C h a p t e r 3.
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.
Romania. Romania Problem Initial state: Arad Goal state: Bucharest Operators: From any node, you can visit any connected node. Operator cost, the.
Chapter 3 Solving problems by searching. Search We will consider the problem of designing goal-based agents in observable, deterministic, discrete, known.
Chapter 3.5 Heuristic Search. Learning Objectives Heuristic search strategies –Best-first search –A* algorithm Heuristic functions.
Eick: Informed Search Informed Search and Exploration Search Strategies Heuristic Functions Local Search Algorithms Vilalta&Eick: Informed Search.
Lecture 3: Uninformed Search
Last time: Problem-Solving
Artificial Intelligence Problem solving by searching CSC 361
HW #1 Due 29/9/2008 Write Java Applet to solve Goats and Cabbage “Missionaries and cannibals” problem with the following search algorithms: Breadth first.
EA C461 – Artificial Intelligence
Artificial Intelligence
HW 1: Warmup Missionaries and Cannibals
Informed Search Idea: be smart about what paths to try.
HW 1: Warmup Missionaries and Cannibals
Artificial Intelligence
Informed Search Idea: be smart about what paths to try.
Presentation transcript:

Search (continued) CPSC 386 Artificial Intelligence Ellen Walker Hiram College

Evaluating Search Strategies Completeness –Will a solution always be found if one exists? Optimality –Will the optimal (least cost) solution be found? Time Complexity –How long does it take to find the solution? –Often represented by # nodes expanded Space Complexity –How much memory is needed to perform the search? –Represented by max # nodes stored at once

Comparison of Strategies Breadth First Uniform Cost Depth First Depth Limited Iterative Deepening Bidirec- tional Complete ? Yes (finite) YesNo Yes TimeO(b d+1 )O(b C*/e )O(b m )O(b l )O(b d )O(b d/2 ) SpaceO(b d+1 )O(b C*/e )O(bm)O(bl) O(b d/2 ) Optimal?Yes (all =) YesNo Yes (all =) Yes (all =, bfs) (Adapted from Figure 3.17, p. 81)

Avoiding Repeated States All visited nodes must be saved to avoid looping –Closed list: all expanded nodes –Open list: fringe of unexpanded nodes If the current node matches a node on the closed list, it is discarded –In some algorithms, the new node might be better, and the old one discarded

Partial Information Sensorless problems –Multiple initial states, multiple next states –Consider all for a solution, e.g. table tipping Contingency problems –New information after each action –E.g. adversarial (multiplayer games)

Informed Search Strategies Also called heuristic search All are variations of best-first search –The next node to expand is the one “most likely” to lead to a solution –Priority queue, like uniform cost search, but priority is based on additional knowledge of the problem –The priority function for the priority queue is usually called f(n)

Heuristic Function Heuristic, from Greek for “good” Heuristic function, h(n) = estimated cost from the current state to the goal Therefore, our best estimate of total path cost is g(n) + h(n) –Recall, g(n) is cost from initial state to current state –If we treat uniform cost search as a heuristic search, f(n) = g(n) and h(n) = 0

Algorithms Greedy best-first search –Always expand the node closest to the goal –f(n) = h(n) A* Search –Expand the node with the best estimated total cost –f(n) = g(n) + h(n) –The fun part is dealing with loops when a node being expanded matches a node on the open or closed list.

Greedy Best-First Search Like depth-first search, it tends to want to stay on a path, once chosen Doesn’t like solutions that require you to move away from the goal to get there –Example: 8 puzzle Non-optimal Worst-case exponential, but good heuristic function helps! Also called “hill climbing” (but traditional hill climbing doesn’t backtrack)

A* Search Algorithm –put initial state (only) on OPEN –Until a goal node is found: If OPEN is empty, fail BESTNODE := best node on OPEN (lowest (g+h) value) if BESTNODE is a goal node, succeed move BESTNODE from OPEN to CLOSED generate successors of BESTNODE

A* (cont) –For each SUCCESSOR in successor list set SUCCESSOR's parent to BESTNODE (back link for finding path later) compute g(SUCCESSOR) = g(BESTNODE) + cost of link from BESTNODE to SUCCESSOR if SUCCESSOR is the same as a node on OPEN OLD := node on OPEN that is same as SUCCESSOR add OLD to list of BESTNODE's successors if g(SUCCESSOR) < g(OLD) (newly found path is cheaper) reset OLD’s parent to BESTNODE g(OLD) = g(SUCCESSOR)

A* (cont) else if SUCCESSOR is the same as a node on CLOSED OLD := node on CLOSED that is same as SUCCESSOR add OLD to list of BESTNODE's successors if g(SUCCESSOR) < g(OLD) (newly found path is cheaper) reset OLD's parent to BESTNODE g(OLD) = g(SUCCESSOR) Update g() of all successors of OLD else add SUCCESSOR to list of BESTNODE's successors

Updating successors of a closed node if NODE is empty, return For each successor of NODE if the parent of the successor is NODE then g(successor) = g(NODE) + path cost update_successors(successor) else if g(NODE) + path cost < g(successor) then g(successor) = g(NODE) + path cost update_successors(successor)

A* Example (h = true cost) BC A D E F G H I

A* Search Example (h underestimates true cost) BC A D E F G H I

Better h means better search When h = cost to the goal, –Only nodes on correct path are expanded –Optimal solution is found When h < cost to the goal, –Additional nodes are expanded –Optimal solution is found When h > cost to the goal –Optimal solution can be overlooked

Comments on A* search A* is optimal if h(n) is admissable, -- if it never overestimates distance to goal We don’t need all the bookkeeping if h(n) is consistent -- if the distance of a successor node is never more than the distance of the predecessor – the cost of the action. If g(n) = 0, A* = greedy best-first search If g(n) = k, h(n)=0, A* = breadth-first search