Search Techniques MSc AI module. Search In order to build a system to solve a problem we need to: Define and analyse the problem Acquire the knowledge.

Slides:



Advertisements
Similar presentations
BEST FIRST SEARCH - BeFS
Advertisements

Informed search algorithms
Artificial Intelligence: Knowledge Representation
Chapter 4: Informed Heuristic Search
Informed search algorithms
Heuristic Searches. Feedback: Tutorial 1 Describing a state. Entire state space vs. incremental development. Elimination of children. Closed and the solution.
Review: Search problem formulation
Heuristic Search techniques
Informed search algorithms
An Introduction to Artificial Intelligence
A* Search. 2 Tree search algorithms Basic idea: Exploration of state space by generating successors of already-explored states (a.k.a.~expanding states).
State Space Representation and Search
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.
Traveling Salesperson Problem
PROBLEM SOLVING AND SEARCH
Informed Search Methods How can we improve searching strategy by using intelligence? Map example: Heuristic: Expand those nodes closest in “as the crow.
Problem Solving by Searching Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 3 Spring 2007.
Solving Problem by Searching
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.
CSC 423 ARTIFICIAL INTELLIGENCE
Search in AI.
Problem Solving by Searching
1 Using Search in Problem Solving Part II. 2 Basic Concepts Basic concepts: Initial state Goal/Target state Intermediate states Path from the initial.
Using Search in Problem Solving
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.
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
CSC344: AI for Games Lecture 4: Informed search
1 Tree Searching Strategies. 2 The procedure of solving many problems may be represented by trees. Therefore the solving of these problems becomes a tree.
Solving Problems by Searching
Heuristic Search Heuristic - a “rule of thumb” used to help guide search often, something learned experientially and recalled when needed Heuristic Function.
Informed Search Idea: be smart about what paths to try.
Game Trees: MiniMax strategy, Tree Evaluation, Pruning, Utility evaluation Adapted from slides of Yoonsuck Choe.
Informed Search Strategies
Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning CPSC 315 – Programming Studio Spring 2008 Project 2, Lecture 2 Adapted from slides of Yoonsuck.
Vilalta&Eick: Informed Search Informed Search and Exploration Search Strategies Heuristic Functions Local Search Algorithms Vilalta&Eick: Informed Search.
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.
Dr.Abeer Mahmoud ARTIFICIAL INTELLIGENCE (CS 461D) Dr. Abeer Mahmoud Computer science Department Princess Nora University Faculty of Computer & Information.
P ROBLEM Write an algorithm that calculates the most efficient route between two points as quickly as possible.
Informed search algorithms Chapter 4. Best-first search Idea: use an evaluation function f(n) for each node –estimate of "desirability"  Expand most.
For Monday Read chapter 4, section 1 No homework..
Lecture 3: Uninformed Search
Local Search and Optimization Presented by Collin Kanaley.
Problem Reduction So far we have considered search strategies for OR graph. In OR graph, several arcs indicate a variety of ways in which the original.
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:
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.
Search Techniques CS480/580 Fall Introduction Trees: – Root, parent, child, sibling, leaf node, node, edge – Single path from root to any node Graphs:
Introduction to Artificial Intelligence (G51IAI) Dr Rong Qu Blind Searches - Introduction.
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.
Eick: Informed Search Informed Search and Exploration Search Strategies Heuristic Functions Local Search Algorithms Vilalta&Eick: Informed Search.
Review: Tree search Initialize the frontier using the starting state
Traveling Salesperson Problem
Heuristic Search A heuristic is a rule for choosing a branch in a state space search that will most likely lead to a problem solution Heuristics are used.
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.
BEST FIRST SEARCH -OR Graph -A* Search -Agenda Search CSE 402
Artificial Intelligence
Blay Whitby 2003 Search Blay Whitby 2003
CO Games Development 1 Week 8 Depth-first search, Combinatorial Explosion, Heuristics, Hill-Climbing Gareth Bellaby.
Backtracking and Branch-and-Bound
CSE (c) S. Tanimoto, 2002 State-Space Search
Informed Search Idea: be smart about what paths to try.
CSE (c) S. Tanimoto, 2004 State-Space Search
Tree Searching Strategies
Informed Search Idea: be smart about what paths to try.
Presentation transcript:

Search Techniques MSc AI module

Search In order to build a system to solve a problem we need to: Define and analyse the problem Acquire the knowledge Represent the knowledge Choose the best problem solving technique This where SEARCH TECHNIQUES are important

SEARCH Searches are used to search a problem space - not for a particular piece of data, but for a PATH that joins the initial problem description to the desired (or GOAL) state. The path represents the solution steps. Searching for a solution develops a SOLUTION SPACE. A problem space is procedurally developed as the search progresses (not pre-defined like a data structure) We are defining a problem as a STATE SPACE SEARCH & this forms the basis of many AI problem- solving techniques.

SEARCH For some problems we’re only interested in the solution. E.g. crosswords For others, we’re interested in the PATH i.e. how we arrived at the solution. e.g. finding the shortest distance between two places, or the Towers of Hanoi puzzle. Also interested in the optimal solution, i.e. final state and the cost

Generate & Test This is the simplest form of Search. List each possible candidate solution in turn and check to see if it satisfies constraints. Either stop at 1st solution or keep going for next. e.g. 3x3 magic square Want to make every row, column, diagonal add up to 15 There are (9!) candidate solutions to this – combinatorial explosion if we generate & check them all

Generate & Test (fig3.4 finlay & dix) The idea of representing the approach to solving this as a tree, enables the elimination of branches beyond certain levels

Generate & Test - fig 3.5 finlay & Dix Another useful representation technique is a graph. We can represent states and move between them on graphs. These can be ‘translated’ into a tree notation to represent the search space.

Towers of Hanoi Search Tree

SEARCH Methods for pruning search trees are integral to many search algorithms. This enables ‘unfruitful’ branches not to be expanded. More sophisticated methods include the idea of heuristics to select best branches. Often use a heuristic evaluation function – a number calculated for each node/path – that says how good/bad it’s likely to be. N.B. entire trees aren’t necessarily constructed in the computers memory. They represent the solution space i.e. the possible solutions.

Depth First Search and Breadth First Search Simplest type Depth first: Breadth first: Depending on where the goal state is, one may reach a solution more quickly than the other. These are known as Blind Searches.

Depth First Search and Breadth First Search Advantages of Depth First Search: Requires less memory, only nodes on current path are stored (breadth first stores everything) May find a solution very quickly (e.g. if solution is at end of first branch). Advantages of Breadth First Search: Will not get trapped exploring a blind alley (i.e. if first branch goes on forever) Guaranteed to find a solution, and if there are a few solutions, the minimal one will be found first.

Branch & Bound If searching for a solution & want to find the best one based on cost (cost can be anything – distance, time, etc.) some branches can be ignored below a certain level if the cost of expanding it beyond that level is greater than the cost of the already found solution. There are variants of this based on depth first & breadth first.

Branch & Bound e.g. Looking for the shortest path between Gainesville & Key West. Jacksonville Orlando Ft. Pierce Miami Key west Tampa Gainesville

Branch and Bound – step by step development of a search tree

Branch and Bound Cont.

Branch and Bound cont

Heuristic Search Consider wanting to find the best route to Glasgow from Leicester. Search space too big to consider every possibility Construct a scoring function that provides estimates re: which paths/nodes are most promising. Promising ones explored first: i.e. try paths that seem to be getting nearer the goal state. Uses an evaluation function, such as ‘as the crow flies’ distance between start town and target town.

Hill Climbing Imagine we’re at the hospital, heading for the church There is no through road from the park

Hill Climbing Using ‘as crow flies’ evaluation function as heuristic would opt for route to the shop rather than route to the park. The Hill Climbing algorithm is as follows: Start with current-state = initial-state Until current-state = goal- state OR there is no change in current-state DO 1. get successors of current-state and use evaluation function to assign score to each successor 2. if one of successors has a better score than current- state then set the new curren- state to be the successor with the best score.

Hill Climbing This terminates when there are no successor states that are better than the current state. Problem: can reach a dead end (local maxima) If we were trying to get from the library to the university, using hill-climbing would take us from the library, to the hospital, & to the park – which is a dead end, no new state would bring us nearer, so it stops.

Hill Climbing Also, see example below. If we’re aiming for the park from the library. We would go to the school, and then no new nodes improve it so the algorithm stops.

Best First Search This is like Hill Climbing but is exhaustive and will eventually search all possible paths. This therefore avoids local maxima problem of hill climbing. To do this it keeps a list of all the nodes that are still to be explored. Start with agenda (i.e. list of nodes) = initial state While agenda is not empty do: Remove best node from agenda If it is a goal then return with success otherwise find successors Assign successor nodes a score using evaluation function and add the scored nodes to the agenda

Best First Search Consider the above tree. The number at each node indicates the cost to solution estimates, (so lowest is best). Breadth first – A B C D E F G Depth First - A B D E G Hill Climbing – A C then gets stuck at local maxima Best First – A C B E G (this needs a good evaluation function to get the best results from using it.)

A* Algorithm Best first uses estimated cost to goal, but doesn’t use the cost so far when choosing the node to search next. A* attempts to minimise the total cost of the solution path Evaluation function = Cost (est to goal) + Cost (from start)

Comparison of A* and Best First A* guarantees to find the shortest path if the evaluation function is suitable It is important not to overestimate the cost-to- goal function. Best 1stA* A(10) B(8), C(9) D(6), C(9) E(4), C(9) F(0), C(9) GOAL A(10) B(8)+2 or C(9)+2 D(6)+6 or C(9)+2 D(6)+6 or G(3)+5 D(6)+6 or F'(0)+7 GOAL

A* Looking for the shortest path between Gainesville & Key West. Jacksonville Orlando Ft. Pierce Miami Key west Tampa Gainesville Underestimates Gainsevill – 8 Jacksonville – 9 Orlando – 6 Tampa – 4 Ft. Pierce – 5 Miami – 2 Key West - 0 1

A* - Solution

A* - solution