CS.462 Artificial Intelligence SOMCHAI THANGSATHITYANGKUL Lecture 07 : Planning.
CS.462 Artificial Intelligence
description
Transcript of CS.462 Artificial Intelligence
![Page 1: CS.462 Artificial Intelligence](https://reader036.fdocuments.us/reader036/viewer/2022081519/568139c4550346895da16acb/html5/thumbnails/1.jpg)
CS.462Artificial Intelligence
SOMCHAI THANGSATHITYANGKUL
Lecture 02 : Search
![Page 2: CS.462 Artificial Intelligence](https://reader036.fdocuments.us/reader036/viewer/2022081519/568139c4550346895da16acb/html5/thumbnails/2.jpg)
Searching for Solutions• The state space model provides a formal definition of a
problem and what constitutes a solution to a problem.• State space is the set of all states reachable from the
initial state by any sequence of operators/actions.• Operators -- generate new states from existing states• A solution is• a state (called a goal state) whose attributes have
certain properties and maybe• a sequence of operators that will change the initial
state to a goal state• A solution is found by searching through the state
space until a (goal) state with “specific” properties is found
Artificial Intelligence Chapter 12
![Page 3: CS.462 Artificial Intelligence](https://reader036.fdocuments.us/reader036/viewer/2022081519/568139c4550346895da16acb/html5/thumbnails/3.jpg)
What is a Solution in this type of Search?
• A solution to a search problem is a sequence of operators that generate a path from the initial state to a goal state.
• An optimal solution is a minimal cost solution.
• Solution cost versus search cost -- which one to optimize?
Artificial Intelligence Chapter 13
![Page 4: CS.462 Artificial Intelligence](https://reader036.fdocuments.us/reader036/viewer/2022081519/568139c4550346895da16acb/html5/thumbnails/4.jpg)
4
A directed graph in state space
![Page 5: CS.462 Artificial Intelligence](https://reader036.fdocuments.us/reader036/viewer/2022081519/568139c4550346895da16acb/html5/thumbnails/5.jpg)
5
Three coins problem
Given three coins arrange as in the picture,
which is the initial
state I.
These are goal state G.
![Page 6: CS.462 Artificial Intelligence](https://reader036.fdocuments.us/reader036/viewer/2022081519/568139c4550346895da16acb/html5/thumbnails/6.jpg)
6
Three coins problem
Operation : Flipping the coin one at a time Let A represent flipping the first coin Let B represent flipping the middle
coin Let C represent flipping the last coin
• The search problem: find a path from a sta te in I to a state in G.
• Draw the state space Graph
![Page 7: CS.462 Artificial Intelligence](https://reader036.fdocuments.us/reader036/viewer/2022081519/568139c4550346895da16acb/html5/thumbnails/7.jpg)
7
Three coins problem
State space graph
![Page 8: CS.462 Artificial Intelligence](https://reader036.fdocuments.us/reader036/viewer/2022081519/568139c4550346895da16acb/html5/thumbnails/8.jpg)
8
Three coins problem
Let put some rule into the problemRule : Use exactly 3 flips.This means that 1flip cannot reach the goal
and2 flips also cannot reach the goal.For example: state I : HHTc HHH not goalState I : HHT B HTT A TTT not goal
Let draw the state space
![Page 9: CS.462 Artificial Intelligence](https://reader036.fdocuments.us/reader036/viewer/2022081519/568139c4550346895da16acb/html5/thumbnails/9.jpg)
9
Three coins problem
State space tree
![Page 10: CS.462 Artificial Intelligence](https://reader036.fdocuments.us/reader036/viewer/2022081519/568139c4550346895da16acb/html5/thumbnails/10.jpg)
10
Search
• Many AI problems can be formu lated as search.
• Iterative deepening is good wh en you don’t know much.
First Method of Search• Uninformed Search
![Page 11: CS.462 Artificial Intelligence](https://reader036.fdocuments.us/reader036/viewer/2022081519/568139c4550346895da16acb/html5/thumbnails/11.jpg)
11
Depth First Search (DFS)• Search• Put start state in the agenda• Loop
Get a state from the agenda If goal, then return Expand state (put children in agenda) Avoiding loops Don’t add a node to the agenda if it’s already
in the agenda Don’t expand a node (or add it to the agenda)
if it has already been expanded.
![Page 12: CS.462 Artificial Intelligence](https://reader036.fdocuments.us/reader036/viewer/2022081519/568139c4550346895da16acb/html5/thumbnails/12.jpg)
12
DFS
Graph:
![Page 13: CS.462 Artificial Intelligence](https://reader036.fdocuments.us/reader036/viewer/2022081519/568139c4550346895da16acb/html5/thumbnails/13.jpg)
13
DFSAgenda:
– Expansion: put children at top of stack– Get new nodes from top of stack
Expand node Nodes list
s
{s}
{As ,Bs ,Cs }
![Page 14: CS.462 Artificial Intelligence](https://reader036.fdocuments.us/reader036/viewer/2022081519/568139c4550346895da16acb/html5/thumbnails/14.jpg)
14
Try this
Find a path from node A to the goal nod B. Use
DFS method.A
B
ZO
S F
C
PR
T L M D
![Page 15: CS.462 Artificial Intelligence](https://reader036.fdocuments.us/reader036/viewer/2022081519/568139c4550346895da16acb/html5/thumbnails/15.jpg)
15
Breadth First Search (BFS)
• Search• Put start state in the agenda• Loop
Get a state from the agenda If goal, then return Expand state (put children in agenda) Avoiding loops Don’t add a node to the agenda if it’s
already in the agenda Don’t expand a node (or add it to the
agenda) if it has already been expanded.
![Page 16: CS.462 Artificial Intelligence](https://reader036.fdocuments.us/reader036/viewer/2022081519/568139c4550346895da16acb/html5/thumbnails/16.jpg)
16
BFS
Graph:
![Page 17: CS.462 Artificial Intelligence](https://reader036.fdocuments.us/reader036/viewer/2022081519/568139c4550346895da16acb/html5/thumbnails/17.jpg)
17
BFSAgenda:
– Expansion: put children at end of queue– Get new nodes from the front of queue
Expand node Nodes list
s
{s}
{As ,Bs ,Cs }
![Page 18: CS.462 Artificial Intelligence](https://reader036.fdocuments.us/reader036/viewer/2022081519/568139c4550346895da16acb/html5/thumbnails/18.jpg)
18
Try thisFind a path from node A to the goal
nod B. UseBFS method.
AB
ZO
S F
C
PR
T L M D