SlideServe
Menu
Préférences
© SlideServe · v2026

Artificial Intelligence

vaughan avatar
18 diapositives · 359 Views · Sep 12, 2014

This article delves into search algorithms, particularly focusing on the Eights Puzzle, also known as the 15-puzzle. It examines various search strategies, including Depth-First Search, Breadth-First Search, and Iterative Deepening Search, highlighting how they can be implemented using lists. The concept of Best-First Search is introduced, which utilizes heuristics to prioritize search states, ultimately enabling more efficient problem-solving. The nuances of these algorithms are compared, showcasing their strengths and weaknesses in navigating the tree structure inherent in search problems.

Artificial Intelligence - slide 1
01 / 18Artificial Intelligence
1 / 17

Télécharger la présentation

Artificial Intelligence
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Artificial Intelligence Search: 2 Ian Gent ipg@cs.st-and.ac.uk

  2. Artificial Intelligence Search 2 Part I : The Eights Puzzle Part II: Search Algorithms via lists Part II: Best First Search

  3. The Eights Puzzle • Sliding blocks puzzle, more usually 15 puzzle • shows you the state of AI in the sixties • how many moves between these states?

  4. Search Reminder • Search states, Search trees • Don’t store whole search trees, just the frontier

  5. Frontiers as lists • One way to implement search algorithms is via lists • Lists fundamental in AI programming • main data structure in Lisp, Prolog • makes list processing really easy (no pointers) • <end of advert for AI languages> • Lists can easily store frontier of search • Each element in list is search state • Different algorithms manipulate list differently

  6. A general search algorithm • 1. Form a one element list with null state • 2. Loop Until (either list empty or we have a solution) • Remove the first state X from the list • Choose the next decision to make • e.g. which letter to set in SAT, which city to choose successor in TSP • Create a new state for each possible choice of decision • e.g. upper/lower case, Walla Walla/Oberlin/Ithaca • MERGE the set of new states into the list • different algorithms will have different MERGE methods • 3. If (solution in list) succeed • else list must be empty, so fail

  7. Depth First Search • The most important AI search algorithm? • MERGE = push • treat list as a stack • new search states to explore at front of list, get treated first • What about when many new states created? • We use a heuristic to decide what order to push new states • all new states in front of all old states in the list • What about when no new states created? • We must be at a leaf node in the search tree • we have to backtrack to higher nodes

  8. Breadth First Search • MERGE = add to end • treat list as a queue • new search states to explore at end of list, • What about when many new states created? • We use a heuristic to decide what order to add new states • Breadth first considers all states at a given depth in the search tree before going on to the next depth • compare with depth-first, • depth-first considers all children of current node before any other nodes in the search tree • list can be exponential size -- all nodes at given depth

  9. Depth-First-Depth-Bounded Search • As depth-first search • Disallow nodes beyond a certain depth d in tree • to implement, add depth in tree to search state • Compare DFDB with Depth-first • DFDB: always finds solution at depth <= d • DF may find very deep solution before shallow ones • DFDB: never goes down infinite branch • relevant if search tree contains infinite branches • e.g. Eights puzzle • DFDB: we have a resource limit (b^d if b branching rate) • How do we choose d?

  10. Iterative Deepening Search • No longer a simple instance of general search • d = min-d • Loop Until (solution found) • apply DFDB(d) • d := d + increment • Why? • Guarantees to find a solution if one exists (cf DFDB) • Finds shallow solutions first (cf DF) • Always has small frontier (cf Breadth First) • Surprising asymptotic guarantees • search time typically no more than d/(d-1) as bad as DF

  11. Why is Iterative deepening ok? • Suppose increment = 1, solution at depth d • how much more work do we expect to do in I.D. vs DF ? • I.d. repeats work from depths 1 to d di=1 bi = b d+1 / (b - 1) • Ratio to b d = b d+1 / bd(b - 1) = b/(b-1) • So we only do b/(b-1) times as much work as we need to • e.g. even if b=2, only do twice as much work • Very often worth the overhead for the advantages

  12. Comparing Search Algorithms

  13. Best First Search • All the algorithms up to now have been hard wired • I.e. they search the tree in a fixed order • use heuristics only to choose among a small number of choices • e.g. which letter to set in SAT / whether to be A or a • Would it be a good idea to explore the frontier heuristically? • I.e. use the most promising part of the frontier? • This is Best First Search

  14. Best First Search • Best First Search is still an instance of general algorithm • Need heuristic score for each search state • MERGE: merge new states in sorted order of score • I.e. list always contains most promising state first • can be efficiently done if use (e.g.) heap for list • no, heaps not done for free in Lisp, Prolog. • Search can be like depth-first, breadth-first, or in-between • list can become exponentially long

  15. Search in the Eights Puzzle • The Eights puzzle is different to (e.g.) SAT • can have infinitely long branches if we don’t check for loops • bad news for depth-first, • still ok for iterative deepening • Usually no need to choose variable (e.g. letter in SAT) • there is only one piece to move (the blank) • we have a choice of places to move it to • we might want to minimise length of path • in SAT just want satisfying assignment

  16. Search in the Eights Puzzle • Are the hard wired methods effective? • Breadth-first very poor except for very easy problems • Depth-first useful without loop checking • not much good with it, either • Depth-bounded -- how do we choose depth bound? • Iterative deepening ok • and we can use increment = 2 (why?) • still need good heuristics for move choice • Will Best-First be ok?

  17. Search in the Eights Puzzle • How can we use Best-First for the Eights puzzle? • We need good heuristic for rating states • Ideally want to find guaranteed shortest solution • Therefore need to take account of moves so far • And some way of guaranteeing no better solution elsewhere

  18. Next week in Search for AI • Heuristics for the Eights Puzzle • the A* algorithm