Informed Search Methods

Slides:



Advertisements
Similar presentations
Informed search algorithms
Advertisements

Informed search algorithms
An Introduction to Artificial Intelligence
Informed Search Methods How can we improve searching strategy by using intelligence? Map example: Heuristic: Expand those nodes closest in “as the crow.
CSCI 5582 Fall 2006 CSCI 5582 Artificial Intelligence Lecture 4 Jim Martin.
Introduction to Artificial Intelligence A* Search Ruth Bergman Fall 2002.
Informed (Heuristic) Search Evaluation Function returns a value estimating the desirability of expanding a frontier node Two Basic Approaches –Expand node.
Informed Search Methods Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 4 Spring 2008.
Artificial Intelligence
Informed Search Methods Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 4 Spring 2005.
Cooperating Intelligent Systems Informed search Chapter 4, AIMA.
CS 460 Spring 2011 Lecture 3 Heuristic Search / Local Search.
Cooperating Intelligent Systems Informed search Chapter 4, AIMA 2 nd ed Chapter 3, AIMA 3 rd ed.
Informed Search Methods How can we make use of other knowledge about the problem to improve searching strategy? Map example: Heuristic: Expand those nodes.
Problem Solving and Search in AI Heuristic Search
Iterative Improvement Algorithms For some problems, path to solution is irrelevant: just want solution Start with initial state, and change it iteratively.
CSC344: AI for Games Lecture 4: Informed search
Cooperating Intelligent Systems Informed search Chapter 4, AIMA 2 nd ed Chapter 3, AIMA 3 rd ed.
Rutgers CS440, Fall 2003 Heuristic search Reading: AIMA 2 nd ed., Ch
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 Methods How can we make use of other knowledge about the problem to improve searching strategy? Map example: Heuristic: Expand those nodes.
Informed search algorithms
Informed search algorithms
2013/10/17 Informed search A* algorithm. Outline 2 Informed = use problem-specific knowledge Which search strategies? Best-first search and its variants.
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 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.
Informed Search Include specific knowledge to efficiently conduct the search and find the solution.
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*
Informed Search I (Beginning of AIMA Chapter 4.1)
Artificial Intelligence Problem solving by searching.
1 Kuliah 4 : Informed Search. 2 Outline Best-First Search Greedy Search A* Search.
4/11/2005EE562 EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS Lecture 4, 4/11/2005 University of Washington, Department of Electrical Engineering Spring 2005.
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.
Heuristic Search Foundations of Artificial Intelligence.
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.
Romania. Romania Problem Initial state: Arad Goal state: Bucharest Operators: From any node, you can visit any connected node. Operator cost, the.
CMPT 463. What will be covered A* search Local search Game tree Constraint satisfaction problems (CSP)
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.
Lecture 3: Uninformed Search
Informed Search Uninformed searches Informed searches easy
Review: Tree search Initialize the frontier using the starting state
Last time: Problem-Solving
Artificial Intelligence (CS 370D)
For Monday Chapter 6 Homework: Chapter 3, exercise 7.
Informed Search Methods
Department of Computer Science
Heuristic Search Introduction to Artificial Intelligence
Local Search Algorithms
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.
Artificial Intelligence Informed Search Algorithms
Course Outline 4.2 Searching with Problem-specific Knowledge
COMP 8620 Advanced Topics in AI
Informed search algorithms
Informed search algorithms
Informed search algorithms
Heuristic (Informed) Search (Where we try to choose smartly) R&N: Chap
Heuristics Local Search
Lecture 9 Administration Heuristic search, continued
CS 416 Artificial Intelligence
Solving Problems by Searching
Informed Search.
ECE457 Applied Artificial Intelligence Spring 2008 Lecture #3
Presentation transcript:

Informed Search Methods How can we make use of other knowledge about the problem to improve searching strategy? Map example: Heuristic: Expand those nodes closest in “as the crow flies” distance to goal 8-puzzle: Heuristic: Expand those nodes with the most tiles in place

Best-First Search Create evaluation function which returns estimated “value” of expanding node Greedy search Estimate cost of cheapest path from node n to goal h(n) = “as the crow flies distance”

Greedy Search Arad h(n)=366 Timisoara Sibiu Zerind h(n)=374 h(n)=253 Oradea Fagaras Riminicu h(n)=366 h(n)=380 h(n)=178 h(n)=193 Sibiu Bucharest h(n)=253 h(n)=0

Greedy Search Expand the node with smallest h Why is it called greedy? Expands node that appears closest to goal Similar to depth-first search Follows single path all the way to goal, backs up when dead end Worst case time: O(bm), m = depth of search space Worst case memory: O(bm), needs to store all nodes in memory to see which one to expand next

Greedy Search Complete and/or optimal? No – same problems as depth first search Can get lost down an incorrect path How can you (help) to prevent it from getting lost? Look at shortest total path, not just path to goal

A* search (another Best-First Search) Greedy search minimizes h(n) = estimated cost to goal Uniform cost search mininizes g(n) = cost to node n Example of each on map A* search minimizes f(n) = g(n) + h(n) f(n) = best estimate of cost for complete solution through n

A* search Under certain conditions: Conditions: Complete Terminates to produce best solution Conditions: h(n) must never overestimate cost to goal admissible heuristic “optimistic” “Crow flies” heuristic is admissible Heuristic is monotone Never decreases along any path from root Can always generate a monotone heuristic from a non-monotone one

A* Search Arad f(n) = 366 Timisoara Sibiu Zerind f(n) = 449 f(n) = 393 Oradea Fagaras Riminicu f(n) = 646 f(n) = 526 f(n) = 417 f(n) = 413 Pitesti Sibiu f(n) = 415 f(n) = 553 Craiova f(n) = 526

A* Search Arad Oradea Fagaras Riminicu f(n) = 646 f(n) = 526 Pitesti Sibiu f(n) = 415 f(n) = 553 Craiova f(n) = 526 Craiova Bucharest f(n) = 615 f(n) = 418 Riminicu f(n) = 607

A* Search Arad f(n) = 366 Timisoara Sibiu Zerind f(n) = 449 f(n) = 393 Oradea Fagaras Riminicu f(n) = 646 f(n) = 526 f(n) = 417 f(n) = 413 Sibiu Bucharest f(n) = 591 f(n) = 450

A* terminates with optimal solution A* stops when you try to expand a goal state ... and declares this the best solution How does it know this is the best? Suppose you try to expand a non-optimal goal state A* always expands node with smallest f Since heuristic is admissible, f is an underestimate If there is a better goal state available, with a smaller f, there must be a node on graph with smaller f than current – so you would be expanding that instead!

More about A* Completeness Complexity A* expands nodes in order of increasing f Must find goal state unless infinitely many nodes with f(n) < f* infinite branching factor OR finite path cost with infinite nodes on it Complexity Time: Depends on h, can be exponential Memory: O(bm), stores all nodes

Valuing heuristics Example: 8-puzzle Which heuristic is better for A*? h1 = # of tiles in wrong position h2 = sum of distances of tiles from goal position (1-norm, or Manhattan distance) Which heuristic is better for A*? Obvious that h2(n) >= h1(n) for any n h2 dominates h1 A* will expand less nodes with h2 than with h1 Since h2 >= h1, any node that A* expands with h2 it will certainly expand with h1 But A* may be able to avoid expanding some nodes with h2 (larger than goal state f) Better to use larger heuristic (if not overestimate)

Inventing heuristics h1 and h2 are exact path lengths for simpler problems h1 = path length if you could transport each tile to right position h2 = path length if you could just move each tile to right position, irrelevant of blank space Relaxed problem: less restrictive problem than original Can generate heuristics as exact cost estimates to relaxed problems

Today Remainder of informed search Assignment 3: 8-puzzle On Friday: Chapter 5 (Game playing) Question of the day: Is chess episodic?

Heuristics in Constraint Satisfaction Problems CSP: Find values for a set of variables, subject to a set of constraints Example: Place as many knights as possible on a chessboard so that none attack another Easier example: Map coloring

Color this map... ... using only red, green, and blue: no adjacent regions have same color

Color this map... ... using only red, green, and blue: no adjacent regions have same color

Strategies Variable: Values: Choose variable with fewest possible choices most-constrained-variable heuristic Choose variable that limits other choices the most most-constraining-variable heuristic Values: Choose value that leaves most options available least-constraining-value heuristic

Memory Bounded Search Can A* be improved to use less memory? Iterative deepening A* search (IDA*) Each iteration is a depth-first search, just like regular iterative deepening Each iteration is not an A* iteration: otherwise, still O(bm) memory Use limit on cost (f), instead of depth limit as in regular iterative deepening

IDA* Search f-Cost limit = 366 Arad f(n) = 366 Timisoara Sibiu Zerind

IDA* Search f-Cost limit = 393 Arad f(n) = 366 Timisoara Sibiu Zerind Oradea Fagaras Riminicu f(n) = 646 f(n) = 526 f(n) = 417 f(n) = 415

IDA* Analysis Time complexity Memory complexity If cost value for each node is distinct, only adds one state per iteration BAD! Can improve by increasing cost limit by a fixed amount each time If only a few choices (like 8-puzzle) for cost, works really well Memory complexity Approximately O(bd) (like depth-first) Completeness and optimality same as A*

Simplified Memory-Bounded A* (SMA*) Uses all available memory Basic idea: Do A* until you run out of memory Throw away node with highest f cost Store f-cost in ancestor node Expand node again if all other nodes in memory are worse

SMA* Example: Memory of size 3

SMA* Example: Memory of size 3 B f = 15 Expand to the left

SMA* Example: Memory of size 3 B f = 15 C f = 13 Expand node A, since f smaller

SMA* Example: Memory of size 3 forgotten f = 15 C f = 13 D f = 18 Expand node C, since f smaller

SMA* Example: Memory of size 3 forgotten f = 15 C f = 13 forgotten f = infinity E f = 24 Node D not a solution, no more memory: so expand C again

SMA* Example: Memory of size 3 B f = 15 C f = 13 Forgotten f = 24 (right) Re-expand A; record new f for C

SMA* Example: Memory of size 3 forgotten = 24 B f = 15 F f = 25 Expand left B: not a solution, so useless

SMA* Example: Memory of size 3 Forgotten f = 24 B f = 15 forgotten f = inf G f = 20 Expand right B: find solution

SMA* Properties Complete if can store at least one solution path in memory Finds best solution (and recognizes it) if path can be stored in memory Otherwise, finds best that can fit in memory

Iterative Improvement Algorithms For some problems, path to solution is irrelevant: just want solution itself Start with an initial state, and change it iteratively to improve it Examples: Placing queens on a chessboard How many airline flights to have to where If you know the function, can take derivative: solve derivative = 0

Hill-climbing search (or gradient descent) Example: Allocating professors to departments M&CS: 10 Physics: 5 English: 7 Goal: Maximize majors in 3 departments For a given configuration of profs, I know (by simulation or something) how many money college will make (tuition for majors – salary) Assume profs make $10k / year Start adding profs, end up in local maximum Show on blackboard

Hill-climbing in general Move in direction of increasing value Useful when path to solution is irrelevant Drawbacks: Local maxima Plateaux Ridges Can get around this some with random-restart hill climbing

Simulated Annealing Technique inspired by engineering practice of cooling liquid At each iteration make a random move If position is better than current, do it Over time, slowly drop “temperature” T If position is worse, do it with probability P P becomes smaller as T drops P = exp(change in value / T) Eventually, algorithm reverts to hill climbing Popular in VLSI layout

Iterative Improvement for CSPs Start with an initial configuration (like queens on a chessboard) Min-conflicts heuristic Choose a new value that results in minimum number of conflicts with other variables Queens example