Informed Search, Heuristics and A*

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson
Download our mobile app to listen on the go
Get App

Questions and Answers

In informed search algorithms, what role do heuristics play?

  • They guide the search towards a goal by estimating the remaining cost from a node to the goal. (correct)
  • They provide a complete map of the search space, eliminating uncertainty in pathfinding.
  • They eliminate the need to explore all possible paths, ensuring the fastest search.
  • They guarantee the discovery of the most optimal path, regardless of the search space.

How does a 'Best First' (greedy) search algorithm decide which node to expand next?

  • It chooses the node that has been in the 'open' list for the longest time.
  • It selects the node with the lowest estimated remaining cost to the goal. (correct)
  • It picks the node with the smallest global cost from the start node.
  • It randomly selects a node from the 'open' list to ensure exploration of all possibilities.

What is a key characteristic of the A* algorithm in terms of its node selection from the open list?

  • It prioritizes nodes that have been on the open list for the longest duration.
  • It selects nodes randomly to ensure exploration of the entire search space.
  • It selects the node with the minimum estimated total cost, which is the sum of the cost so far and the estimated remaining cost. (correct)
  • It picks the node with the lowest estimated remaining cost, similar to a greedy search.

In the context of A* admissibility, what condition must be met by the heuristic estimates?

<p>They must be underestimates of the true remaining cost to the goal. (C)</p> Signup and view all the answers

How does the A* algorithm handle a situation where a better path is found to a node that is already on the closed list?

<p>It updates the node's parent and costs, moves the node back to the <code>open</code> list, and propagates the changes to its descendants. (B)</p> Signup and view all the answers

What does it mean for a search algorithm to be 'blind' in the context of map traversal?

<p>It means the algorithm explores the map without any knowledge of the unexplored areas. (A)</p> Signup and view all the answers

What is the purpose of the estRemCost variable in the SearchState class, as used in the A* algorithm?

<p>To provide an estimate of the remaining cost from the current state to the goal. (A)</p> Signup and view all the answers

How does the 'expand()' method in the Search class contribute to reconstructing the solution path when using informed search algorithms?

<p>It sets the parent of new nodes added to the open list to the current node, allowing traversal back to the start node. (B)</p> Signup and view all the answers

In the context of A*, what does it signify if heuristic estimates are perfectly accurate?

<p>A* directly finds the optimal path without exploring unnecessary nodes. (A)</p> Signup and view all the answers

What role do heuristics play in improving the efficiency of search algorithms?

<p>Heuristics guide the search process by providing estimates that help prioritize the exploration of more promising states. (C)</p> Signup and view all the answers

Which of the following is an example of a greedy algorithm?

<p>Best-first search (A)</p> Signup and view all the answers

If all heuristic estimates are zero (or identical), how does the A* algorithm behave?

<p>It reduces to a breadth-first search or a branch-and-bound strategy. (A)</p> Signup and view all the answers

How is the efficiency of a search, specifically by reconstructing the solution path, determined?

<p>By the ratio of the number of nodes in the solution path to the total number of nodes visited. (B)</p> Signup and view all the answers

In what way does the A* algorithm improve upon a simple map traversal search algorithm?

<p>A* uses heuristics to estimate the distance to the goal, allowing for more informed pathfinding. (A)</p> Signup and view all the answers

When reconstructing the solution path after a search succeeds, what data is used to follow the chain of nodes back to the start?

<p>The parent attribute of each <code>SearchNode</code>. (A)</p> Signup and view all the answers

In the provided code snippets, what is the role of the MapLink class?

<p>It contains information about a connection (link) between two cities, including its cost. (B)</p> Signup and view all the answers

What is the significance of the 'parent' attribute within the SearchNode class during the operation of the A* algorithm?

<p>It provides a means to trace and reconstruct the path from the goal back to the start node once the solution is found. (A)</p> Signup and view all the answers

In best-first search strategy, what is the primary criterion for selecting a node from the open list?

<p>The node with the minimum <code>estRemCost</code>. (C)</p> Signup and view all the answers

What condition related to cost estimates ensures the admissibility of the A* algorithm?

<p>Cost estimates must be underestimates. (B)</p> Signup and view all the answers

What is indicated if the known distance along a complete, non-optimal path is less than an underestimate of the distance along an incomplete, optimal path?

<p>The algorithm will choose the complete, non-optimal path. (D)</p> Signup and view all the answers

If there are accurate estimates, will A* be optimal?

<p>Yes (A)</p> Signup and view all the answers

If all the estimates are 0 (or identical), A* reduces to what kind of search?

<p>Breadth-and-Bound (B)</p> Signup and view all the answers

In the lecture, the lecturer talks about the fact that VetSuccessors may have to change in A*, why is this the case?

<p>Because it's now possible (if we have a serious underestimate of remaining cost) to find a better route to a node which is already on closed. (B)</p> Signup and view all the answers

What are the classes that are described to be 'open' in the lecture?

<p>Depth first, breadth first, lowest cost first and A* (B)</p> Signup and view all the answers

In the A* algorithm, if a solution is found in the search space, how is the solution path typically reconstructed?

<p>Trace back through the parent pointers from the goal node to the start node. (C)</p> Signup and view all the answers

What happens to a node 'X' after it expanded in normal search algorithms?

<p>All of the above (D)</p> Signup and view all the answers

When does what happens with the normal search algorithms not apply?

<p>A better route to X through B (40=25+5+10) will emerge (C)</p> Signup and view all the answers

If it's possible to find a better route, what needs to change?

<p>The node (X above) should have its parent, <code>globalCost</code> and <code>totalCost</code> changed, then it should be taken off closed and put back on open (D)</p> Signup and view all the answers

In the provided map search code, what does the getSuccessors method in MapState.java do?

<p>Identifies and returns all valid next states (neighboring cities) from the current city. (B)</p> Signup and view all the answers

What is the purpose of reportSuccess()?

<p>reconstruct path, convert to string &amp; return (B)</p> Signup and view all the answers

When the reportSuccess() is run, what will happen to start with?

<p>Initialise StringBuffer to contain <code>currentNode</code>s information first. (A)</p> Signup and view all the answers

In the context of informed search algorithms, what does 'efficiency' refer to when determining performance?

<p>The number of nodes on the solution path divided by the number of nodes visited during the search (D)</p> Signup and view all the answers

What would be the implications of using an inadmissible heuristic (overestimating cost) in A* search?

<p>A* search may return a sub-optimal solution. (B)</p> Signup and view all the answers

Within the search4 algorithms presented, which of the following code enhancements accommodate A* search compared to simpler search methods?

<p>Introduction of variables to track heuristic and total estimated costs for informed node selection (A)</p> Signup and view all the answers

What is the efficiency?

<p>Number of nodes on solution path / Number of nodes visited (C)</p> Signup and view all the answers

Flashcards

Informed Search

Search algorithms that use heuristics to guide the search process.

Best First (Greedy) Search

A search strategy that selects the node that appears to be closest to the goal, based on a heuristic.

A* Algorithm

An informed search algorithm that minimizes f(n) = g(n) + h(n), where g(n) is the cost from start to node n, and h(n) is the estimated cost from node n to the goal.

A* admissibility

A heuristic is admissible if it never overestimates the cost to reach the goal.

Signup and view all the flashcards

estRemCost

A search state property that estimates the cost to reach the goal from that state.

Signup and view all the flashcards

selectNode()

In A*, the function that picks a node with minimum estimated total cost.

Signup and view all the flashcards

A* and Estimates

Estimates should not be too high, as these affect the path with underestimate cost more.

Signup and view all the flashcards

Reconstructing the Solution Path

A process that reconstructs the path from the starting node to the current node.

Signup and view all the flashcards

Parent

Each SearchNode has a field to the node for which it came from.

Signup and view all the flashcards

Expands

A method modified in the Search class to the parent of new nodes to the current Node.

Signup and view all the flashcards

reportSucess ()

Method to follow a parent that will return the correct output.

Signup and view all the flashcards

Efficiency

It's calculated in the Search class when reconstructing the path.

Signup and view all the flashcards

Carta

Provides encapsulated access to map specific data

Signup and view all the flashcards

MapLink

Handy class containing information about the link between two cities.

Signup and view all the flashcards

MapState

Class including, city, localCost, estRemCost

Signup and view all the flashcards

Approaches to Open

Open is sorted by h(x) = g(x) + f(x) first.

Signup and view all the flashcards

Study Notes

Informed Search and Heuristics

  • The lecture discusses informed search and heuristics, best first (greedy) search, and the A* algorithm.
  • The concepts of A* admissibility and map traversal with A* are covered.
  • The lecture goes over implementing A* and reconstructing the solution path, followed by a recap.

Quiz Details

  • The upcoming quiz consisting of 12 multiple choice questions and 3 free-text questions.
  • There is a Mock test which contains examples of the multiple choice questions.

Free Text Questions for 8-Puzzle

  • An example free-text question involves designing a search engine for the 8-puzzle game.
  • The puzzle's configuration must be stored in a 3x3 int array, using '0' to indicate the gap.
  • The task involves describing how to implement the getSuccessor() method, ensuring all possible next moves are added to the list of successor states, even at edge cases.
  • When answering the free text question, make sure you have all the details of the algorithm.
  • Describe the specifics that should happen in the getSuccessor codes
  • Make a clear distinction between a state and a node
  • Avoid using imprecise language

Map Traversal and Heuristics

  • A Map Traversal search algorithm without heuristics is "blind" to the parts of the map it hasn't explored.
  • Algorithms only know the cost/distance of expanded nodes without knowing if they are useful choices.
  • Heuristics estimate the distance to the goal from each node
  • Branch-and-bound searches expand effort equally in all directions.
  • Knowledge guiding search comes from estimating the remaining cost to the goal from any node n.
  • A SearchState may contain a variable estRemCost which the user has to supply to the application
  • In map traversal, this could be the straight-line distance to the goal.
  • Only estimates, not true costs, are used for this
  • Searching is pointless if the true costs are already known!
  • A Best-First search strategy selects the node with the minimum estRemCost from open, i.e., the node closest to a goal.
  • This makes it a greedy algorithm which makes use of the heuristics whilst ignoring the global cost with potentially lucky and great estimates if so.
  • It is not admissible

A* Algorithm Overview

  • The A* Algorithm is a state space searching that combines Branch-and-Bound and Best-First (Greedy) approaches.
  • A* select a node n from open with minimum estimated cost h(n) of path from start to goal through n, where h(n) = g(n) + f(n).
    • g(n) is the cost from start to n, and f(n) estimates the remaining cost from n to the goal.
  • It was first discovered by Peter Hard, Nils Nilsson and Bertram Raphael, working at the Stanford Research Institute (1968)

A* Algorithm Characteristics

  • A* is admissible if all f(n) (estRemCosts) are guaranteed to be underestimates.
  • The known distance along a complete, non-optimal path will not be less than an underestimate of the distance along the incomplete, optimal path, hence the correct path cannot be selected from open.
  • There are limiting cases to improve efficiency and accuracy.
    • If all estimates are 0 (or identical), A* reduces to Branch-and-Bound.
    • If all the estimates are accurate A* is optimal and the better the estimates, the more efficient A* is.

Admissibility of A*

  • When there are 2 competing routes to the goal; through X and through Y
    • Suppose the known cost of g(X)=110 and Estimated remaining cost f(X) to goal: 25 vs g(Y)=80 and Estimated remaining cost f(Y) to goal: 40
    • As long as estimates are underestimates

Node Selection Approaches from the Open List

  • Search problems with variable costs affect how the currentNode is selected off the open list.
  • Approaches include Depth-first (stack: last in, first out), breadth-first (queue: first in, first out), and lowest-cost-first (sorted by lowest g(x) first).
  • A* uses an open list sorted by lowest h(x)=g(x)+f(x) first.

Search Algorithms

  • Search algorithms include both uniformed and informed searches.
  • Uninformed search examples: Breadth First Search, Depth First Search, Lower cost / Branch and Bound Search, and Progressive Deepening
  • Informed search examples: Best First (Greedy) Search, and A* Search.

Implementing A*

  • In the search4 code, changes were made and you can supply estRemCosts for each searchState.
  • Additional changes made to selectNode(), and vetSucessors() as well

Nodes on closed

  • Initially, place the node, X on open, before expanded it at anytime
  • Once fully expanded, this will be placed on closed
  • It won't resurface again

Implementing A* - What Happens on the Closed List?

  • Node X is placed on open with parent A (cost 10, remaining cost 25)
  • open now has X and B. X is expanded (remaining cost 30, not B which would be 55)
  • X is moved to the closed list
  • Later, a shorter route to X through B (40, remainder 5) emerges
  • The node X has its parent and globalCost and totalCost, removed from closed and placed back on open.

Summary of Code Inspection

  • Carta provides encapsulated access to the map specific data cities, links, local costs, and estimates.
  • MapLink and Carta uses listings of MapLink instances, providing information about a link between two variables.
  • MapState inherits from SearchState variables, and also contains city, localCostandestRemCost`.
  • getSuccessors() in MapState uses the map information to find successors, and also keeps track of the localCost and estRemCost.

Solution Path Reconstruction

  • It is often necessary to reconstruct the solution path
  • The parent of each SearchNode must be recalled
  • The parent will be "null" for the start node
  • The expand() method from Search must be modified so that the parent of open nodes is now the currentNode
  • When a search suceeds, you have to reconstruct the solution path, starting with the currentNode and working with closed, following the chain of parents until you get to the parent "null" node.
  • The efficiency of the search can also be calculated with this

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Related Documents

More Like This

Artificial Intelligence Chapter 4
32 questions
Informed Search Methods
10 questions

Informed Search Methods

BoundlessPrairie avatar
BoundlessPrairie
Heuristic Search Algorithms
41 questions

Heuristic Search Algorithms

InexpensiveObsidian3151 avatar
InexpensiveObsidian3151
Informed Search Algorithms and Planning
35 questions
Use Quizgecko on...
Browser
Browser