Uninformed search Breadth first Uniform cost search Depth first

INC 551 Artificial
Intelligence
Lecture 3
Search technique
Uninformed search
• Breadth first
• Uniform cost search
• Depth first
• Depth-limit search
• Bidirectional search
Informed search
• Greedy best-first
• A* search
Depth-limited Search
Depth-first ทีม่ ีการกาหนด depth มากสุ ดในการ search
Characteristic of Depth-limit search
Complete – no
Search Time – มาก
O(b d )
Space – น้ อย (linear space)
O(bd )
Optimal – no
Iterative Deepening Depth-first
Search
มีการกาหนด depth มากสุ ดซึ่งจะทาซ้าโดยเพิม่ depth ขึน้ เรื่ อยๆ
ถ้ ายังไม่ ถึง goal
Characteristic ของ Iterative
Deepening Depth-first search
Complete – yes
Search Time – มาก
(d  1)1  (d )b  (d  1)b 2  (d  2)b3  ...  (1)b d  O(b d )
Space – น้ อย (linear space)
O(bd )
Optimal – no (yes ถ้ า path cost = 1 ทุกอัน)
Real Number: Iterative Deepening
Depth-first search
Depth-first
1  b  b  b  ...  b
2
3
d
B=10, d=5
1+10+100+1,000+..+100,000=111,111
Iterative Deepening Depth-first
(d  1)1  (d )b  (d  1)b 2  (d  2)b3  ...  (1)b d
B=10, d=5
6+50+400+3,000+..+100,000=123,456
Search technique
Uninformed search
• Breadth first
• Uniform cost search
• Depth first
• Depth-limit search
• Bidirectional search
Informed search
• Greedy best-first
• A* search
Bidirectional Search
จะ search จากทั้ง start และ goal เพื่อลดจานวน state
จาก bd เป็ น bd/2+ bd/2
Expand ทั้ง start และ goal จนมาชนกัน
Water Jug Puzzle
11 , 9 , 0
10 , 10 , 0
Search Strategies
• Data Driven Search
(Start from the origin and work forward)
• Goal Driven Search
(Start from the goal and work backward)
Search technique
Uninformed search
• Breadth first
• Uniform cost search
• Depth first
• Depth-limit search
• Bidirectional search
Informed search
• Greedy best-first
• A* search
Informed??
ด้ วยข้ อมูลอะไร?
ข้ อมูลนีเ้ รียก “heuristic”
Heuristic คือ แนวทางในการแก้ปัญหาซึ่งมาจาก
ความฉลาดและประสบการณ์ ของมนุษย์
Heuristic function h(n)
Take input = state ใดๆ
output = คะแนนบอกว่ า state นั้นดีแค่ ไหน
คุณสมบัติของ Heuristic
• มาจากความฉลาดของมนุษย์ ในการแก้ปัญหาใดๆ
• ขึน้ กับปัญหานั้นๆ / มีได้ หลายแบบ
• อาจผิดหรื อถูกก็ได้
Example
Heuristic ใน navigation problems ส่ วนมากจะใช้
“Euclidian distance to goal”
a
Start
Goal
b
c
Heuristic ไม่ จาเป็ นต้ องดี/ถูกเสมอไป
ทางขาด
a
Start
Goal
b
c
Search technique
Uninformed search
• Breadth first
• Uniform cost search
• Depth first
• Depth-limit search
• Bidirectional search
Informed search
• Greedy best-first
• A* search
Greedy Best-first Search
จะ expand node ที่มีค่า heuristic มากทีส่ ุ ด
(node ที่ใกล้ goal ทีส่ ุ ดใน navigation
problem)
f(n) = h(n)
Example
Start
Goal
Straight-line Distance
Characteristic of
Greedy Best-first Search
Complete – no
Search Time – depend on heuristics
Space – depend on heuristics
Optimal – no
Search technique
Uninformed search
• Breadth first
• Uniform cost search
• Depth first
• Depth-limit search
• Bidirectional search
Informed search
• Greedy best-first
• A* search
A* search
Idea: avoid expanding the nodes that are already expensive
f(n) = g(n)+h(n)
f(n) = evaluation function decide which node to expand
g(n) = cumulative cost
h(n) = heuristic
Note: A* is optimal
A* Termination Criterion
Stop when A* chooses to expand the goal node.
(different from others where the search ends when
goal node is found)
Characteristic of A* search
Complete – yes
Search Time – depend on heuristics
Space – depend on heuristics
Optimal – yes
Proof of Optimality
Different Heuristics on A*
H1 = จานวนชิ้นทีอ่ ยู่ผดิ ตาแหน่ ง
H2 = ผลรวม Manhattan distance
ของตาแหน่ งปัจจุบนั ถึงตาแหน่ งทีต่ ้ องการของแต่ ละชิ้น
Depth=14 IDS = 3473941 nodes
A*(h1) = 539 nodes
A*(h2) = 113 nodes
Depth=24 IDS = ??
A*(h1) = 39135 nodes
A*(h2) = 1641 nodes
เรียก h2 dominates h1