P ROBLEM Write an algorithm that calculates the most efficient route between two points as quickly as possible.

Slides:



Advertisements
Similar presentations
BEST FIRST SEARCH - BeFS
Advertisements

Review: Search problem formulation
AI Pathfinding Representing the Search Space
Greedy best-first search Use the heuristic function to rank the nodes Search strategy –Expand node with lowest h-value Greedily trying to find the least-cost.
Solving Problem by Searching
Artificial Intelligence Chapter 9 Heuristic Search Biointelligence Lab School of Computer Sci. & Eng. Seoul National University.
1 Heuristic Search Chapter 4. 2 Outline Heuristic function Greedy Best-first search Admissible heuristic and A* Properties of A* Algorithm IDA*
ICS-171:Notes 4: 1 Notes 4: Optimal Search ICS 171 Summer 1999.
Problem Solving Agents A problem solving agent is one which decides what actions and states to consider in completing a goal Examples: Finding the shortest.
CSE 380 – Computer Game Programming Pathfinding AI
CS171 Introduction to Computer Science II Graphs Strike Back.
Search Strategies CPS4801. Uninformed Search Strategies Uninformed search strategies use only the information available in the problem definition Breadth-first.
Problem Solving by Searching
CPSC 322 Introduction to Artificial Intelligence October 27, 2004.
SE Last time: Problem-Solving Problem solving: Goal formulation Problem formulation (states, operators) Search for solution Problem formulation:
Review: Search problem formulation
MAE 552 – Heuristic Optimization Lecture 27 April 3, 2002
Using Search in Problem Solving
Problem Solving and Search in AI Heuristic Search
Using Search in Problem Solving
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.
CS 561, Session 6 1 Last time: Problem-Solving Problem solving: Goal formulation Problem formulation (states, operators) Search for solution Problem formulation:
Informed Search Idea: be smart about what paths to try.
Informed search algorithms
CMU Snake Robot
Dijkstra’s Algorithm and Heuristic Graph Search David Johnson.
Problem Solving and Search Andrea Danyluk September 11, 2013.
Graphs II Robin Burke GAM 376. Admin Skip the Lua topic.
WAES 3308 Numerical Methods for AI
COSC 2007 Data Structures II Chapter 14 Graphs III.
Introduction to search Chapter 3. Why study search? §Search is a basis for all AI l search proposed as the basis of intelligence l inference l all learning.
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.
Computer Science CPSC 322 Lecture 9 (Ch , 3.7.6) Slide 1.
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 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..
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
CSC3203: AI for Games Informed search (1) Patrick Olivier
Computer Science CPSC 322 Lecture 6 Iterative Deepening and Search with Costs (Ch: 3.7.3, 3.5.3)
Informed Search and Heuristics Chapter 3.5~7. Outline Best-first search Greedy best-first search A * search Heuristics.
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:
Slides by: Eric Ringger, adapted from slides by Stuart Russell of UC Berkeley. CS 312: Algorithm Design & Analysis Lecture #36: Best-first State- space.
Ricochet Robots Mitch Powell Daniel Tilgner. Abstract Ricochet robots is a board game created in Germany in A player is given 30 seconds to find.
Graph Algorithms GAM 376 Robin Burke Fall Outline Graphs Theory Data structures Graph search Algorithms DFS BFS Project #1 Soccer Break Lab.
Informed Search CSE 473 University of Washington.
A* Path Finding Ref: A-star tutorial.
Search Techniques CS480/580 Fall Introduction Trees: – Root, parent, child, sibling, leaf node, node, edge – Single path from root to any node Graphs:
Searching for Solutions
A* optimality proof, cycle checking CPSC 322 – Search 5 Textbook § 3.6 and January 21, 2011 Taught by Mike Chiang.
1 CO Games Development 1 Week 8 A* Gareth Bellaby.
Chapter 3.5 and 3.6 Heuristic Search Continued. Review:Learning Objectives Heuristic search strategies –Best-first search –A* algorithm Heuristic functions.
CSCI 4310 Lecture 4: Search 2 – Including A*. Book Winston Chapters 4,5,6.
Artificial Intelligence Lecture No. 8 Dr. Asad Ali Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
Best-first search is a search algorithm which explores a graph by expanding the most promising node chosen according to a specified rule.
For Monday Read chapter 4 exercise 1 No homework.
HEURISTIC Good enough is perfect
CPSC 322, Lecture 7Slide 1 Heuristic Search Computer Science cpsc322, Lecture 7 (Textbook Chpt 3.6) Sept, 20, 2013.
ARTIFICIAL INTELLIGENCE Dr. Seemab Latif Lecture No. 4.
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
A* Path Finding Ref: A-star tutorial.
Informed search algorithms
Presentation transcript:

P ROBLEM Write an algorithm that calculates the most efficient route between two points as quickly as possible.

I NTRODUCTION TO A LGORITHMS S EARCHING & F INDING Improving search techniques Simon Ellis 24 th March, 2014

Search techniques  Breadth-first search (BFS)  Depth-first search (DFS)  Tree spanning  Greedy best-first search  Dijkstra’s algorithm

Improving search performance  Guided search  Uses an heuristic to improve performance  Guaranteed to find a path if one exists  Like other searches  … but will always return the optimum path with admissible heuristic

Heuristics  An heuristic is an experience-based technique used for problem-solving, learning and discovery  Solution is not guaranteed to be optimal  Speeds up process of finding a satisfactory solution using shortcuts  Could be called ‘computational best-guesswork’

Heuristics  Strategies using readily accessible, if not always strictly applicable, information to control and influence problem solving

Heuristics  Common heuristics in humans include  Trial and error  Drawing a picture  Writing out an algorithm  Assuming you have a solution and attempting to derive from that (‘working backwards’)  Talking to someone about a problem  Obtaining a concrete example of an abstract problem  Trying for a general solution before the specific one (‘inventor’s paradox’)  Putting a problem aside and coming back to it later  Getting someone else to do it for you

Admissibility  An heuristic is admissible if and only if it is optimistic  An ‘optimistic’ heuristic will never over-estimate the remaining cost to the goal from any given node n  Assume  n is a node  h is an heuristic  h(n) is the heuristic cost  C(n) is the actual cost

Admissibility  An admissible heuristic can be derived from  Induction and inductive learning  Information from databases with solutions to subproblems  Relaxed versions of the problem

A* basics  Best-first search  Finds a least-cost path from initial node to goal node  Uses a knowledge-plus-heuristic cost to determine search order  Complete and admissible  Will always find a solution if it exists  Guaranteed to find the shortest path between nodes

A* basics  Maintains 2 pieces of information  Open list  Contains candidate nodes which may lie along the path  Closed list  Contains nodes which have the lowest path score so far  Nodes move between lists based on current information

A* basics  Uses a knowledge-plus-heuristic cost  Knowledge  Movement cost to reach node n k from initial node n 0  G  Heuristic cost to reach target node n t from node n k  H  Lowest total path cost to node n k is given by F = G + H  Best path is given by sequence of nodes with lowest F

A* algorithm 1 1. Add initial node n 0 to open list 2. Do 1. Find the node with the lowest F cost on the open list, n c 2. Remove n c from the open list and add it to the closed list 3. For all nodes n k connected to n c 1. If node is on the closed list or not traversable (e.g. a wall): ignore it 2. If node is not on the open list: add it, record costs, make n c its parent 3. If node is already on the open list: check to see if this path to n c is better (i.e. a lower G score); if so, change parent of n c to n k and recalculate its G and F scores (may require resorting of open list) 4. Until 1. If n t is added to the closed list, path has been found 2. If open list is empty, there is no path

A* algorithm 2 3. Derive path if one exists 1. Begin at target node n t 2. Follow chain of parent nodes back to node n 0 3. Reverse order of nodes to derive path

A* heuristics  There are some ‘standard heuristics’ GG  For square grids, often the ‘Manhattan distance’ Orthogonal movement costs 10 or 1 Diagonal movement costs 14 or 1.4  For other graphs, the edge cost is generally used HH  Straight-line distance often used  Numerous other heuristics are possible (Manhattan, cross- product…)

A* heuristics  Scales must be the same for both heuristics!  What happens if scales are not the same?  Firstly, heuristic is probably inadmissible (overestimates cost)  Won’t find the best path  Might take longer to run  In short, will not find the best path in the best time

Example

A* performance  Speed: O(b d )  Memory requirement: O(b d )  … why?  Same as Dijkstra’s algorithm  Dijkstra’s algorithm is effectively A* with H = 0 for all nodes

ANY QUESTIONS?

References Useful A* resources Images from