INC 551 Artificial Intelligence Lecture 2
Review Environment Action Sense, Perceive Make Decision Agent World Model Deliberative Agent
Problem Solving Agents Agents with world model
State-Action Model (Finite State Machine) State1State2State3 Action อยู่ในรูปของ state - action
Search for Solutions Tree Structure node Parent Child
ขั้นตอนในการทำ Problem Solving 1. Define Environment 2. Build/Implement Agent with search techniques
Define Environment • Define Problems and solutions Initial state, goal, path cost • Define measuring performance • Choose states and actions
Example
States: Location of each 8 tiles Initial state: as in picture Action: blank moves left, right, up,down Goal state: all tiles match the position Path cost: 1
Example Vacuum problem
States: Agent in 1 of 2 locations, Dirt can be anywhere, total of 8 possible states Initial state: Any Action: left, right, suck Goal state: all space are clean Path cost: each step cost 1
Example
Search Techniques Uninformed search • Breadth first • Uniform cost search • Depth first • Depth-limit search • Bidirectional search Informed search • Greedy best-first • A* search
Problems • Memory • Time เช่นที่ 12 depth, branching factor = 10, ใช้ 35 ปี tetrabytes
Start dpe
dpe ecb
de ecbrh p
dpe ecbrh q
dpe ecbrh q a
dpe ecbrh q aa
dpe ecbrh q aa r
dpe ecbrh q aa rq
dpe ecbrh q aa rqf Depth 1 Depth 0 Depth 2 Depth 3
Search Technique Properties • Completeness – guarantee ว่าจะเจอ solution ถ้า exist • Time Complexity – เวลาที่ใช้ในการ search • Space Complexity – memory ที่ใช้ในการ search • Optimality – solution ที่ได้ guarantee ว่าดีที่สุด
Characteristic of Breadth-first search Complete – yes ถ้า branching factor มีค่าจำกัด Search Time - มาก Space - มาก Optimal – no in general (optimal ถ้า cost =1 ทุก step)
State = Volume of water in each bottle (0,0) Action = How many ways to make state change? Transition 1.Empty Bottle 1 2.Empty Bottle 2 3.Fill in Bottle 1 4.Fill in Bottle 2 5.Pour Bottle 1 to 2 6.Pour Bottle 2 to 1
(0,0) Empty Bottle 1Empty Bottle 2 Fill in Bottle 1 Fill in Bottle 2Pour Bottle 1 to 2Pour Bottle 2 to 1 (3,0) (0,5)
(0,0) Empty Bottle 1Empty Bottle 2 Fill in Bottle 1 Fill in Bottle 2Pour Bottle 1 to 2Pour Bottle 2 to 1 (3,0) (0,5) (3,5)(0,3)(3,2)
(0,0) Empty Bottle 1Empty Bottle 2 Fill in Bottle 1 Fill in Bottle 2Pour Bottle 1 to 2Pour Bottle 2 to 1 (3,0) (0,5) (3,5)(0,3)(3,2) (3,3)(0,2)
(0,0) Empty Bottle 1Empty Bottle 2 Fill in Bottle 1 Fill in Bottle 2Pour Bottle 1 to 2Pour Bottle 2 to 1 (3,0) (0,5) (3,5)(0,3)(3,2) (3,3) (1,5) (0,2) (2,0)
(0,0) Empty Bottle 1Empty Bottle 2 Fill in Bottle 1 Fill in Bottle 2Pour Bottle 1 to 2Pour Bottle 2 to 1 (3,0) (0,5) (3,5)(0,3)(3,2) (3,3) (1,5) (0,2) (2,0) (1,0)(2,3)(2,5)
(0,0) Empty Bottle 1Empty Bottle 2 Fill in Bottle 1 Fill in Bottle 2Pour Bottle 1 to 2Pour Bottle 2 to 1 (3,0) (0,5) (3,5)(0,3)(3,2) (3,3) (1,5) (0,2) (2,0) (1,0)(2,3)(2,5) (3,4) Depth 1 Depth 0 Depth 2 Depth 3 Depth 4 Depth 5 Depth 6
Experiment Water Jug puzzle 19,13,7 Each student bring a paper
(0,13,7) Actions Pour 1 to 2 Pour 1 to 3 Pour 2 to 1 Pour 2 to 3 Pour 3 to 1 Pour 3 to 2 How many minimum move required to solve the puzzle?
How to write a computer program to do this for you?
Memory - > Paper to write something down Node structure State + Action + Back pointer Build tree until the goal is met
0-13-7,x,x
13-0-7,3, ,5,1
Search technique Uninformed search • Breadth first • Uniform cost search • Depth first • Depth-limit search • Bidirectional search Informed search • Greedy best-first • A* search ต่างกันตรงที่ จะ expand node ไหนต่อไป
Uniform-cost search จะ expand node ที่มี cost รวมมาจากจุดเริ่มต้น (accumulative cost) น้อยที่สุด
Example
Characteristic of Uniform-cost search Note: ถ้าทุก step มี cost เท่ากันหมด Uniform-cost search จะเหมือนกับ Breadth-first search Complete – yes ถ้า step cost ทุกอัน > 0 Search Time – มาก ( ขึ้นกับปัญหา ) # node ที่ cost < optimal solution Space – มาก ( ขึ้นกับปัญหา ) # node ที่ cost < optimal solution Optimal – yes
Search technique Uninformed search • Breadth first • Uniform cost search • Depth first • Depth-limit search • Bidirectional search Informed search • Greedy best-first • A* search
Depth-first Search จะ expand node ที่ลึกที่สุด
Characteristic of Depth-first search Complete – no Search Time – มาก Space – น้อย (linear space) Optimal – no