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.

Slides:



Advertisements
Similar presentations
Review: Search problem formulation
Advertisements

Informed Search Algorithms
Informed search algorithms
Artificial Intelligence Presentation
An Introduction to Artificial Intelligence
CSCI 5582 Fall 2006 CSCI 5582 Artificial Intelligence Lecture 4 Jim Martin.
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*
Review: Search problem formulation
Artificial Intelligence
Cooperating Intelligent Systems Informed search Chapter 4, AIMA.
Problem Solving and Search in AI Heuristic Search
CSC344: AI for Games Lecture 4: Informed search
5-Nov-2003 Heuristic Search Techniques What do you do when the search space is very large or infinite? We’ll study three more AI search algorithms: Backtracking.
Vilalta&Eick: Informed Search Informed Search and Exploration Search Strategies Heuristic Functions Local Search Algorithms Vilalta&Eick: Informed Search.
Dr.Abeer Mahmoud ARTIFICIAL INTELLIGENCE (CS 461D) Dr. Abeer Mahmoud Computer science Department Princess Nora University Faculty of Computer & Information.
Informed search algorithms Chapter 4. Outline Best-first search Greedy best-first search A * search Heuristics.
CHAPTER 4: INFORMED SEARCH & EXPLORATION Prepared by: Ece UYKUR.
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 algorithms Chapter 4. Best-first search Idea: use an evaluation function f(n) for each node –estimate of "desirability"  Expand most.
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.
For Friday Finish reading chapter 4 Homework: –Lisp handout 4.
For Monday Read chapter 4, section 1 No homework..
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.
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*
CSC3203: AI for Games Informed search (1) Patrick Olivier
Informed Search I (Beginning of AIMA Chapter 4.1)
1 Kuliah 4 : Informed Search. 2 Outline Best-First Search Greedy Search A* Search.
G5AIAI Introduction to AI Graham Kendall Heuristic Searches.
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
Review: Tree search Initialize the frontier using the starting state
Last time: Problem-Solving
Heuristic Functions.
Artificial Intelligence (CS 370D)
For Monday Chapter 6 Homework: Chapter 3, exercise 7.
Informed Search Methods
Department of Computer Science
Informed Search and Exploration
Artificial Intelligence Problem solving by searching CSC 361
The A* Algorithm Héctor Muñoz-Avila.
Discussion on Greedy Search and A*
Discussion on Greedy Search and A*
CS 4100 Artificial Intelligence
Artificial Intelligence Informed Search Algorithms
EA C461 – Artificial Intelligence
Searching for Solutions
Informed search algorithms
Informed search algorithms
Artificial Intelligence
Informed search algorithms
CSE 473 University of Washington
HW 1: Warmup Missionaries and Cannibals
Informed Search Idea: be smart about what paths to try.
State-Space Searches.
State-Space Searches.
HW 1: Warmup Missionaries and Cannibals
Artificial Intelligence
CS 416 Artificial Intelligence
CMSC 471 Fall 2011 Class #4 Tue 9/13/11 Uninformed Search
Midterm Review.
Solving Problems by Searching
State-Space Searches.
Informed Search Idea: be smart about what paths to try.
Presentation transcript:

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 Iterative deepening Your applet should have graphical interface to illustrate the movements of goats and cabbage across the river. Also, print the following statistics at the end of the search: Maximum depth. Time complexity (time and number of nodes) Space complexity.

Blind Search Depth-first search and breadth-first search are examples of blind (or uninformed) search strategies. Breadth-first search produces an optimal solution (eventually, and if one exists), but it still searches blindly through the state-space. Neither uses any knowledge about the specific domain in question to search through the state-space in a more directed manner. If the search space is big, blind search can simply take too long to be practical, or can significantly limit how deep we're able to look into the space. A search strategy is defined by picking the order of node expansion

Informed Search - Overview Heuristic Search Best-First Search Approach Greedy A* Heuristic Functions Local Search and Optimization Hill-climbing Simulated Annealing Local Beam Genetic Algorithms

Informed Search Relies on additional knowledge about the problem or domain frequently expressed through heuristics. Used to distinguish more promising paths towards a goal may be mislead, depending on the quality of the heuristic In general, performs much better than uninformed search but frequently still exponential in time and space for realistic problems

Informed Search (Cont.) Find a solution more quickly Find solutions even when there is limited time available Often find a better solution, since more profitable parts of the state-space can be examined, while ignoring the unprofitable parts. A search strategy which is better than another at identifying the most promising branches of a search- space is said to be more informed.

Best-First Search Relies on an evaluation function f(n) that gives an indication of how useful it would be to expand a node family of search methods with various evaluation functions usually gives an estimate of the distance to the goal often referred to as heuristics in this context The node with the lowest value is expanded first Fringe is ordered by f(n) the name is a little misleading: the node with the lowest value for the evaluation function is not necessarily one that is on an optimal path to a goal function BEST-FIRST-SEARCH(problem, EVAL-FN) returns solution fringe := queue with nodes ordered by EVAL-FN return TREE-SEARCH(problem, fringe)

Greedy Best-First Search Minimizes the estimated cost to a goal expand the node that seems to be closest to a goal utilizes a heuristic function as evaluation function f(n) = h(n) = estimated cost from the current node to a goal heuristic functions are problem-specific e.g., fSLD(n) = straight-line distance often straight-line distance for route-finding and similar problems often better than depth-first. function GREEDY-SEARCH(problem) returns solution return BEST-FIRST-SEARCH(problem, h)

Greedy Best-First Search Snapshot Initial 1 9 Visited Fringe Current 2 7 3 7 Visible Goal 4 6 5 5 6 5 7 6 Heuristics 7 8 7 9 5 10 4 11 3 12 2 13 4 14 5 15 6 8 7 6 5 4 3 2 1 1 2 3 4 5 6 7 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 Fringe: [13(4), 7(6), 8(7)] + [24(0), 25(1)]

Route Finding 374 253 366 329 This shows the difference between straight line distances and other distances…

Greedy best-first search example

Greedy best-first search example

Greedy best-first search example

Greedy best-first search example So is Arad->Sibiu-> Fagaras->Bucharest optimal?

Greedy search, evaluation Completeness: NO Check on repeated states Minimizing h(n) can result in false starts, e.g. Iasi to Fagaras.

Greedy search, evaluation An obvious problem with greedy search is that it doesn't take account of the cost so far, so it isn't optimal, and can wander into dead-ends, like depth- first search. 0 Cost Max local minimum = looping Initial State Goal

A* Search Combines greedy and uniform-cost search to find the (estimated) cheapest path through the current node f(n) = g(n) + h(n) = path cost + estimated cost to the goal from n heuristics must be admissible h(n) never overestimate the cost to reach the goal very good search method, but with complexity problems function A*-SEARCH(problem) returns solution return BEST-FIRST-SEARCH(problem, g+h)

Evaluation Function: F(n) = g(n) + h(n) Estimated cost of A* Search Evaluation Function: F(n) = g(n) + h(n) Estimated cost of cheapest path from node n to goal Path cost from root to node n

A* Snapshot Initial Visited Fringe Current Visible Goal 9 7 7 6 5 5 6 1 9 Visited 4 3 Fringe 11 10 Current 2 7 3 7 Visible 7 2 2 4 Goal 10 13 4 6 5 5 6 5 7 6 Edge Cost 9 2 5 4 4 4 3 6 9 Heuristics 7 11 12 8 7 9 5 10 4 11 3 12 2 13 4 14 5 15 6 f-cost 10 3 4 7 2 4 8 6 5 4 3 4 2 8 3 9 2 13 13 8 7 6 5 4 3 2 1 1 2 3 4 5 6 7 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 Fringe: [2(4+7), 7(3+4+6), 13(3+2+3+4)] + [24(3+2+4+4+0), 25(3+2+4+3+1)]

A* Snapshot with all f-Costs Initial 1 9 Visited 4 3 Fringe 11 10 Current 2 7 3 7 Visible 7 2 2 4 Goal 17 11 10 13 4 6 5 5 6 5 7 6 Edge Cost 9 2 5 4 4 4 3 6 9 Heuristics 7 20 21 14 13 11 12 18 22 8 7 9 5 10 4 11 3 12 2 13 4 14 5 15 6 f-cost 10 3 4 7 2 4 8 6 5 4 3 4 2 8 3 9 2 24 24 29 23 18 19 18 16 13 13 14 13 25 21 31 25 8 7 6 5 4 3 2 1 1 2 3 4 5 6 7 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

A* Properties The value of f never decreases along any path starting from the initial node This property can be used to draw contours regions where the f-cost is below a certain threshold the better the heuristics h, the narrower the contour around the optimal path

A* Snapshot with Contour f=11 Initial 1 9 Visited 4 3 Fringe 11 10 Current 2 7 3 7 Visible 7 2 2 4 Goal 17 11 10 13 4 6 5 5 6 5 7 6 Edge Cost 9 2 5 4 4 4 3 6 9 Heuristics 7 20 21 14 13 11 12 18 22 8 7 9 5 10 4 11 3 12 2 13 4 14 5 15 6 f-cost 10 3 4 7 2 4 8 6 5 4 3 4 2 8 3 9 2 Contour 24 24 29 23 18 19 18 16 13 13 14 13 25 21 31 25 8 7 6 5 4 3 2 1 1 2 3 4 5 6 7 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

A* Snapshot with Contour f=13 Initial 1 9 Visited 4 3 Fringe 11 10 Current 2 7 3 7 Visible 7 2 2 4 Goal 17 11 10 13 4 6 5 5 6 5 7 6 Edge Cost 9 2 5 4 4 4 3 6 9 Heuristics 7 20 21 14 13 11 12 18 22 8 7 9 5 10 4 11 3 12 2 13 4 14 5 15 6 f-cost 10 3 4 7 2 4 8 6 5 4 3 4 2 8 3 9 2 Contour 24 24 29 23 18 19 18 16 13 13 13 25 21 31 25 8 7 6 5 4 3 2 1 1 3 4 5 6 7 16 17 18 19 20 21 22 23 24 25 14 27 28 29 30 31 2 26

A* search example

A* search example

A* search example

A* search example

A* search example

A* search example

A* Search A* expands nodes in increasing f value Gradually adds f-contours of nodes

Optimality of A* A* will find the optimal solution the first solution found is the optimal one A* is optimally efficient no other algorithm is guaranteed to expand fewer nodes than A* A* is not always “the best” algorithm optimality refers to the expansion of nodes other criteria might be more relevant it generates and keeps all nodes in memory improved in variations of A*

Complexity of A* The number of nodes within the goal contour search space is still exponential with respect to the length of the solution better than other algorithms, but still problematic Frequently, space complexity is more severe than time complexity A* keeps all generated nodes in memory

Memory-Bounded Search Search algorithms that try to conserve memory Most are modifications of A* iterative deepening A* (IDA*) simplified memory-bounded A* (SMA*) recursive best-first search (RBFS)

Iterative Deepening A* (IDA*) Explores paths within a given contour (f-cost limit) in a depth-first manner this saves memory space because depth-first keeps only the current path in memory but it results in repeated computation of earlier contours since it doesn’t remember its history was the “best” search algorithm for many practical problems for some time does have problems with difficult domains

Simplified Memory-Bounded A* (SMA*) Uses all available memory for the search drops nodes from the queue when it runs out of space those with the highest f-costs If there is a tie (equal f-values) we first delete the oldest nodes first. complete if there is enough memory for the shortest solution path often better than A* and IDA* but some problems are still too tough trade-off between time and space requirements

Heuristics for Searching For many tasks, a good heuristic is the key to finding a solution prune the search space move towards the goal

Heuristic Functions 8-Puzzle Example: 8-Puzzle Average solution cost for a random puzzle is 22 moves Branching factor is about 3 Empty tile in the middle -> four moves Empty tile on the edge -> three moves Empty tile in corner -> two moves 322 is approx 3.1e10 Get rid of repeated states 181440 distinct states

Heuristic Functions 8-Puzzle h1=the number of misplaced tiles h2=the sum of the Manhattan distances of the tiles from their goal positions h1 = 7 h2 = 4+0+3+3+1+0+2+1+2 = 16

Heuristic Functions 8-Puzzle