0% found this document useful (0 votes)
19 views60 pages

20180723162002D4730 - Pert02 - Search Strategies

This document describes a session on artificial intelligence search strategies. It will cover uninformed searches like breadth-first, depth-first, and uniform cost search as well as informed searches like greedy best-first and A* search. Example problems discussed include the 4-queen puzzle and finding paths between cities in Romania. Key concepts are defining the initial state, actions, transitions, and goal tests for formulating problems to be solved through search.

Uploaded by

Ronan Franciscus
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views60 pages

20180723162002D4730 - Pert02 - Search Strategies

This document describes a session on artificial intelligence search strategies. It will cover uninformed searches like breadth-first, depth-first, and uniform cost search as well as informed searches like greedy best-first and A* search. Example problems discussed include the 4-queen puzzle and finding paths between cities in Romania. Key concepts are defining the initial state, actions, transitions, and goal tests for formulating problems to be solved through search.

Uploaded by

Ronan Franciscus
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 60

Course : Artificial Intelligence

Effective Period : September 2018

Search Strategies

Session 02

1
Learning Outcomes
At the end of this session, students will be able to:
 LO 1: Describe what is AI and identify concept of intelligent
agent
 LO 2: Explain various intelligent search algorithms to solve
the problems

2
Outline
1. Problems Example

2. Searching Algorithms for Solutions

3. Uninformed Search Strategies

4. Informed Search Strategies

5. Exercise

3
Problem Solving Agents
• Solving a problem can be simplified if the agent can adopt
a goal and aim satisfying it
• Goal Formulation
– Is the first step in problem solving

• Problem Formulation
– Is the process of deciding what actions and states to
consider

4
Example Problems
• The 4-queen problem:
– On a chess board, place 4 queens so that no queen is
attacking each other

5
Example Problems
• The path finding problem

– Find a path from Arad to Bucharest

6
Problems Formulation
• A problem can be defined formally by five components:
– The initial state: The state where the agent starts

– Actions: Possible actions available to the agents

– Transition model: A description what an action does

– Goal test: Check if a given state is a goal state

– Path cost: Measure the cost to achieve the goal

7
Problem Formulation
• The 4-queen problem:
– The initial state: No queen on the board

– Actions: Add a queen to any empty square

– Transition model: Returns the board with a queen added


to the specified square
– Goal test: 4 queens on the board, none attacked

8
Problem Formulation
• The path finding problem:
– The initial state: In (Arad)

– Actions: Go (Zerind), Go (Zibiu), etc

– Transition model: Results (In (Arad), Go (Zerind)) =


In(Zerind)
– Goal test: In (Bucharest)

– Path cost: Path length in kilometers

9
Example Problems (Real World)
• Route finding problems

10
Searching for Solutions
• Search tree: models the sequence of actions
– Root: initial state

– Branches: actions

– Nodes: results from actions

– Expanding:

• Process of generating child nodes (performing an


action)

11
Searching for Solutions

12
Searching for Solutions

13
Searching for Solutions

14
Searching for Solutions
• Leaf node
– A node that has no children in the tree

• Frontier
– The set of all leaf nodes available for expansion at any
given point
• Explored set
– The set of all expanded nodes

15
Tree Search Pseudocode

16
Searching for Solutions
• Measuring problem-solving performance
– Completeness: Is the algorithm guaranteed to find a
solution when there is one?
– Optimality: Does the strategy find the optimal
solution?
– Time complexity: How long does it take to find a
solution?
– Space complexity: How much memory is needed to
perform the search?

17
Search Algorithms
• There are two types of search algorithms
– Uninformed search (Blind search)

• No additional information/knowledge about states

– Informed search (Heuristic search)

• There is problem specific knowledge to help find the


solution

18
Uninformed Search Strategies
• Strategies:
– Breadth-first search (BFS): Expand the shallowest node

– Uniform-cost search (UCS): Expand the least cost node

– Depth-first search (DFS): Expand deepest node

– Depth-limited search (DLS): DFS with depth limit

– Iterative-deepening search (IDS): DLS with increasing


limit

19
Breadth-first Search (BFS)
Expand shallowest unexpanded node
Implementation: a FIFO queue

20
Breadth-first Search (BFS)
Expand shallowest unexpanded node
Implementation: a FIFO queue

21
Breadth-first Search (BFS)
Expand shallowest unexpanded node
Implementation: a FIFO queue

22
Breadth-first Search (BFS)
Expand shallowest unexpanded node
Implementation: a FIFO queue

23
Uniform-cost Search (UCS)
• Instead of expanding the shallowest node, it expands the
node n with the lowest path cost g(n)
• Instead of queue (FIFO), it utilize priority queue based on
g(n)

24
Uniform-cost Search (UCS)

Sibiu
80 99

Rimnicu
Fagaras
Vilcea

25
Uniform-cost Search (UCS)

Sibiu
80 99

Rimnicu
Fagaras
Vilcea

80+97=177

Pitest

26
Uniform-cost Search (UCS)

Sibiu
80 99

Rimnicu
Fagaras
Vilcea

177 99+211=310

Pitest Bucharest

27
Uniform-cost Search (UCS)

Sibiu
80 99

Rimnicu
Fagaras
Vilcea

177 310

Pitest Bucharest

101+177 = 278

Bucharest

28
Uniform-cost Search (UCS)

Sibiu
80 99

Rimnicu
Fagaras
Vilcea

177 310

Pitest Bucharest

278

Bucharest

29
Depth-first Search (DFS)
Expand deepest unexpanded node
Implementation: a LIFO queue

30
Depth-first Search (DFS)
Expand deepest unexpanded node
Implementation: a LIFO queue

31
Depth-first Search (DFS)
Expand deepest unexpanded node
Implementation: a LIFO queue

32
Depth-first Search (DFS)
Expand deepest unexpanded node
Implementation: a LIFO queue

33
Depth-limited Search (DLS)
• DFS with depth limit l (nodes at level l has no successors)
• It solves the infinite-path problem
• Sometimes, depth limits can be based on knowledge of the
problem
– For example, on the map of Romania, there are 20 cities

– And if we study the map carefully, we could discover


that any city can be reached from an other city in at
most 9 steps (l)

34
Iterative Deepening Search (IDS)
• Combine the benefits of BFS and DFS
– The memory requirements are small like DFS

– It is complete and optimal like BFS (when condition


applies)
• Idea: Iteratively increase the search limit until the depth of
the shallowest solution d is reached
• Applies DLS with increasing limits

35
Iterative Deepening Search (IDS)

36
Iterative Deepening Search (IDS)

37
Iterative Deepening Search (IDS)

38
Iterative Deepening Search (IDS)

39
Informed Search Strategies
• The general approach we consider is called best-first
search
• It expands the node n with the lowest evaluation cost f(n)
– Remember the uniform cost search? What is the
principle to expand the node?
• Most best-first search algorithms include a component of f:
– A heuristic function h(n): Estimated cost of the
cheapest path from the state at node n to a goal state

40
Informed Search Strategies
• Strategies:
– (Greedy) Best First Search Algorithm

– A* Algorithm

41
Romania with step costs in km

366

42
(Greedy) Best-First Search
• Greedy best-first search tries to expand the node that is
closest to the goal.
– Thus, f(n) = h(n)

• For example, in route-finding problems in Romania:

– We use the straight line distance heuristic (hSLD)

– hSLD(In(Arad)) = 366

• Denotes that the straight line distance from Arad to


Bucharest is 366 km

43
(Greedy) Best-First Search

44
(Greedy) Best-First Search

45
(Greedy) Best-First Search

46
(Greedy) Best-First Search

47
A* Search
• A* search tries to expand the node by combining the cost
to reach the node (path cost) and the cost to get from
the node to the goal.
– Thus, f(n) = g(n) + h(n)

• Again, the algorithm is identical to uniform-cost search


except that A* use g(n) + h(n) instead of g(n)

48
A* Search

49
A* Search

50
A* Search

51
A* Search

52
A* Search

53
A* Search

54
Heuristic Functions

55
Heuristic Functions

56
References
• Stuart Russell, Peter Norvig. 2010. Artificial Intelligence :
A Modern Approach. Pearson Education. New Jersey.
ISBN:9780132071482

57
Exercise

58
Exercise
• Simulate the node expansion from start state (S) to
reach goal state (G)

– Using BFS, DFS, UCS

2.0 1.0
A D H 1.0
2.0 2.0 2.0
1.0 5.0 1.0
S B G I
1.0
6.0
3.0
2.0 1.0
C F J
1.0 1.0
59
Exercise
• Simulate the node expansion from start state (S) to
reach goal state (G)

– Using Greedy, A*

– Given heuristic function:

h(A) = 8.0 h(H) = 2.0


h(B) = 9.0 h(G) = 0
h(C) = 7.0 h(J) = 3.0
h(D) = 5.0 h(I) = 1.0
h(F) = 4.0

60

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy