HW 1: Warmup Missionaries and Cannibals

Slides:



Advertisements
Similar presentations
Review: Search problem formulation
Advertisements

Informed Search Algorithms
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.
SE Last time: Problem-Solving Problem solving: Goal formulation Problem formulation (states, operators) Search for solution Problem formulation:
Review: Search problem formulation
Problem Solving and Search in AI Heuristic Search
CSC344: AI for Games Lecture 4: Informed search
Solving problems by searching
Solving Problems by Searching
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 (Heuristic) Search
Informed search algorithms Chapter 4. Outline Best-first search Greedy best-first search A * search Heuristics Memory Bounded A* Search.
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.
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.
For Friday Finish reading chapter 4 Homework: –Lisp handout 4.
For Monday Read chapter 4, section 1 No homework..
CS344: Introduction to Artificial Intelligence (associated lab: CS386)
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.
CSC3203: AI for Games Informed search (1) Patrick Olivier
CS621: Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 3 - Search.
1 Kuliah 4 : Informed Search. 2 Outline Best-First Search Greedy Search A* Search.
Search (continued) CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Informed Search and Heuristics Chapter 3.5~7. Outline Best-first search Greedy best-first search A * search Heuristics.
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 CSE 473 University of Washington.
Searching for Solutions
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.
Chap 4: Searching Techniques Artificial Intelligence Dr.Hassan Al-Tarawneh.
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.
Review: Tree search Initialize the frontier using the starting state
Solving problems by searching
Last time: Problem-Solving
Department of Computer Science
Heuristic Search Introduction to Artificial Intelligence
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.
Discussion on Greedy Search and A*
Discussion on Greedy Search and A*
Lecture 1B: Search.
Informed search algorithms
CS 4100 Artificial Intelligence
Artificial Intelligence Informed Search Algorithms
EA C461 – Artificial Intelligence
Informed search algorithms
Informed search algorithms
Artificial Intelligence
BEST FIRST SEARCH -OR Graph -A* Search -Agenda Search CSE 402
CS621: Artificial Intelligence
CSE 473 University of Washington
Chap 4: Searching Techniques
Informed Search Idea: be smart about what paths to try.
The Rich/Knight Implementation
HW 1: Warmup Missionaries and Cannibals
CS621: Artificial Intelligence
Artificial Intelligence
Solving Problems by Searching
Informed Search Idea: be smart about what paths to try.
Informed Search.
The Rich/Knight Implementation
Presentation transcript:

HW 1: Warmup Missionaries and Cannibals Solve the Missionary-Cannibal Problem (with 3 missionaries and 3 cannibals) with a RECURSIVE DEPTH-FIRST SEARCH as follows: You MUST use a recursive depth first search No ancestor repeated states in a path Keep counts of illegal states (cannibals eat missionaries), repeated states, total states searched Use Python Comment on each method and important code sections Print all paths from start to goal Print the final 3 counts. Due Jan 16 11:59pm. Late date Jan 18 11:59pm Your work must be YOUR OWN.

Informed (Heuristic) Search Idea: be smart about what paths to try.

Blind Search vs. Informed Search What’s the difference? How do we formally specify this? A node is selected for expansion based on an evaluation function that estimates cost to goal.

General Tree Search Paradigm function tree-search(root-node) fringe  successors(root-node) while ( notempty(fringe) ) {node  remove-first(fringe) state  state(node) if goal-test(state) return solution(node) fringe  insert-all(successors(node),fringe) } return failure end tree-search root-node successors list How do we order the successor list?

Best-First Search Use an evaluation function f(n) for node n. Always choose the node from fringe that has the lowest f value. 3 5 1 4 6

Heuristics What is a heuristic? What are some examples of heuristics we use? We’ll call the heuristic function h(n).

Greedy Best-First Search f(n) = h(n) What does that mean? What is it ignoring?

Romanian Route Finding Problem Initial State: Arad Goal State: Bucharest c(s,a,s´) is the length of the road from s to s´ Heuristic function: h(s) = the straight line distance from s to Bucharest

Original Road Map of Romania What’s the real shortest path from Arad to Bucharest? What’s the distance on that path?

Greedy Search in Romania 140 99 211 Distance = 450

Greedy Best-First Search Is greedy search optimal? Is it complete? No, can get into infinite loops in tree search. Graph search is complete for finite spaces. What is its worst-case complexity for a tree search with branching factor b and maximum depth m? time space O(bm)

Greedy Best-First Search When would we use greedy best-first search or greedy approaches in general?

{ A* Search Hart, Nilsson & Rafael 1968 Best-first search with f(n) = g(n) + h(n) where g(n) = sum of edge costs from start to n and h(n) = estimate of lowest cost path n-->goal If h(n) is admissible then search will find optimal solution. Never overestimates the true cost of any solution which can be reached from a node. { Space bound since the queue must be maintained.

Back to Romania start end

A* for Romanian Shortest Path

f(n) = g(n) + h(n)

8 Puzzle Example f(n) = g(n) + h(n) What is the usual g(n)? two well-known h(n)’s h1 = the number of misplaced tiles h2 = the sum of the distances of the tiles from their goal positions, using city block distance, which is the sum of the horizontal and vertical distances (Manhattan Distance)

8 Puzzle Using Number of Misplaced Tiles 2 3 4 7 6 5 8 3 6 4 7 5 g=0 h=4 f=4 goal 2 8 3 4 7 6 5 2 8 3 1 6 4 7 5 2 8 3 1 6 4 7 5

2 8 3 1 4 7 6 5 Exercise: What are its children and their f, g, h?

Optimality of A* with Admissibility (h never overestimates the cost to the goal) Suppose a suboptimal goal G2 has been generated and is in the queue. Let n be an unexpanded node on the shortest path to an optimal goal G1. f(n) = g(n) + h(n) < g(G1) Why? < g(G2) G2 is suboptimal = f(G2) f(G2) = g(G2) So f(n) < f(G2) and A* will never select G2 for expansion. n G1 G2

Optimality of A* with Consistency (stronger condition) h(n) is consistent if for every node n for every successor n´ due to legal action a h(n) <= c(n,a,n´) + h(n´) Every consistent heuristic is also admissible. n h(n) c(n,a,n´) h(n´) n´ G

Algorithms for A* Since Nillsson defined A* search, many different authors have suggested algorithms. Using Tree-Search, the optimality argument holds, but you search too many states. Using Graph-Search, it can break down, because an optimal path to a repeated state can be discarded if it is not the first one found. One way to solve the problem is that whenever you come to a repeated node, discard the longer path to it.

The Rich/Knight Implementation a node consists of state g, h, f values list of successors pointer to parent OPEN is the list of nodes that have been generated and had h applied, but not expanded and can be implemented as a priority queue. CLOSED is the list of nodes that have already been expanded.

Rich/Knight /* Initialization */ OPEN <- start node Initialize the start node g: h: f: CLOSED <- empty list

Rich/Knight 2) repeat until goal (or time limit or space limit) if OPEN is empty, fail BESTNODE <- node on OPEN with lowest f if BESTNODE is a goal, exit and succeed remove BESTNODE from OPEN and add it to CLOSED generate successors of BESTNODE

Rich/Knight for each successor s do 1. set its parent field 2. compute g(s) 3. if there is a node OLD on OPEN with the same state info as s { add OLD to successors(BESTNODE) if g(s) < g(OLD), update OLD and throw out s }

Rich/Knight/Tanimoto 4. if (s is not on OPEN and there is a node OLD on CLOSED with the same state info as s { add OLD to successors(BESTNODE) if g(s) < g(OLD), update OLD, remove it from CLOSED and put it on OPEN, throw out s }

Rich/Knight 5. If s was not on OPEN or CLOSED { add s to OPEN add s to successors(BESTNODE) calculate g(s), h(s), f(s) } end of repeat loop