introduction to artificial intelligence · revised approach •start with a frontier that contains...

299
Introduction to Artificial Intelligence with Python

Upload: others

Post on 13-Apr-2020

20 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

Introduction to Artificial Intelligence

with Python

Page 2: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

Artificial Intelligence

Page 3: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

Search

O

X X

O X

Page 4: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

Knowledge

P → Q

QP

Page 5: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

Uncertainty

Page 6: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

Optimization

Page 7: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

LearningInbox

Spam

Page 8: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

Neural Networks

Page 9: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

Language

NP

NP PP

ADJ N P N

artificial

intelligence

with

python

Page 10: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

Search

Page 11: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

1 2 3 4

5 6 7 8

9 10 11 12

13 14 15

Page 12: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier
Page 13: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier
Page 14: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

Search Problems

Page 15: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

agent

entity that perceives its environment and acts upon that environment

Page 16: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

state

a configuration of the agent and its environment

Page 17: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

5 742

1 1138

12

10614

15139

4 2912

3 1478

10

1161

15135

10 3415

11 12113

14 759

286

Page 18: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

initial state

the state in which the agent begins

Page 19: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

initial state 5 742

1 1138

12

10614

15139

Page 20: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

actions

choices that can be made in a state

Page 21: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

actions

ACTIONS(s) returns the set of actions that can be executed in state s

Page 22: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

actions1 2

34

Page 23: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

transition model

a description of what state results from performing any applicable action in any state

Page 24: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

transition model

RESULT(s, a) returns the state resulting from performing action a in state s

Page 25: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

RESULT( , ) =

5 742

1 1138

1210614

15139

5 742

1 1138

1210614

15139

RESULT( , ) =

5 742

1 1138

1210614

15139

5 742

1 1138

12

10614

15139

Page 26: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

transition model

RESULT( , ) =

5 742

1 1138

1210614

15139

5 742

1 1138

12

10614

15139

Page 27: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

state space

the set of all states reachable from the initial state by any sequence of actions

Page 28: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

2 4 5 7

8 3 1 11

14 6 10 12

9 13 152 4 5 7

8 3 1 11

14 6 10 12

9 13 15

2 4 5 7

8 3 1 11

14 6 10

129 13 15

2 4 5 7

8 3 1 11

14 6

10

12

9 13 15

2 4 5 7

8 3 1 11

14 6 10 12

9 13 15

2 4 5 7

8 3 1 11

14 6 10

129 13 15

2 4 5 7

8 3 1

1114 6 10

129 13 15

Page 29: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier
Page 30: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

goal test

way to determine whether a given state is a goal state

Page 31: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

path cost

numerical cost associated with a given path

Page 32: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

C D

H

M

I

E

J

K

AB

F G

L

Page 33: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

C D

H

M

I

E

J

K

AB

F G

L

2

1

3 2

21

4

2

34

3

56

24

Page 34: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

C D

H

M

I

E

J

K

AB

F G

L

1

1

1 1

11

1

1

11

1

11

11

Page 35: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

Search Problems

• initial state

• actions

• transition model

• goal test

• path cost function

Page 36: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

solution

a sequence of actions that leads from the initial state to a goal state

Page 37: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

optimal solution

a solution that has the lowest path cost among all solutions

Page 38: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

node

a data structure that keeps track of - a state - a parent (node that generated this node) - an action (action applied to parent to get node) - a path cost (from initial state to node)

Page 39: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

Approach

• Start with a frontier that contains the initial state.

• Repeat:

• If the frontier is empty, then no solution.

• Remove a node from the frontier.

• If node contains goal state, return the solution.

• Expand node, add resulting nodes to the frontier.

Page 40: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

E

AB

C D

F

Frontier

Find a path from A to E.

• Start with a frontier that contains the initial state.

• Repeat:

• If the frontier is empty, then no solution.

• Remove a node from the frontier.

• If node contains goal state, return the solution.

• Expand node, add resulting nodes to the frontier.

A

Page 41: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

E

AB

C D

F

Frontier

Find a path from A to E.

• Start with a frontier that contains the initial state.

• Repeat:

• If the frontier is empty, then no solution.

• Remove a node from the frontier.

• If node contains goal state, return the solution.

• Expand node, add resulting nodes to the frontier.

A

Page 42: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

E

AB

C D

F

Frontier

Find a path from A to E.

• Start with a frontier that contains the initial state.

• Repeat:

• If the frontier is empty, then no solution.

• Remove a node from the frontier.

• If node contains goal state, return the solution.

• Expand node, add resulting nodes to the frontier.

B

Page 43: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

E

AB

C D

F

Frontier

Find a path from A to E.

• Start with a frontier that contains the initial state.

• Repeat:

• If the frontier is empty, then no solution.

• Remove a node from the frontier.

• If node contains goal state, return the solution.

• Expand node, add resulting nodes to the frontier.

B

Page 44: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

E

AB

C D

F

Frontier

Find a path from A to E.

• Start with a frontier that contains the initial state.

• Repeat:

• If the frontier is empty, then no solution.

• Remove a node from the frontier.

• If node contains goal state, return the solution.

• Expand node, add resulting nodes to the frontier.

C D

Page 45: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

E

AB

C D

F

Frontier

Find a path from A to E.

• Start with a frontier that contains the initial state.

• Repeat:

• If the frontier is empty, then no solution.

• Remove a node from the frontier.

• If node contains goal state, return the solution.

• Expand node, add resulting nodes to the frontier.

C D

Page 46: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

E

AB

C D

F

Frontier

Find a path from A to E.

• Start with a frontier that contains the initial state.

• Repeat:

• If the frontier is empty, then no solution.

• Remove a node from the frontier.

• If node contains goal state, return the solution.

• Expand node, add resulting nodes to the frontier.

D

E

Page 47: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

E

AB

C D

F

Frontier

Find a path from A to E.

• Start with a frontier that contains the initial state.

• Repeat:

• If the frontier is empty, then no solution.

• Remove a node from the frontier.

• If node contains goal state, return the solution.

• Expand node, add resulting nodes to the frontier.

DE

Page 48: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

E

AB

C D

F

Frontier

Find a path from A to E.

• Start with a frontier that contains the initial state.

• Repeat:

• If the frontier is empty, then no solution.

• Remove a node from the frontier.

• If node contains goal state, return the solution.

• Expand node, add resulting nodes to the frontier.

D

Page 49: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

E

AB

C D

F

Frontier

Find a path from A to E.

• Start with a frontier that contains the initial state.

• Repeat:

• If the frontier is empty, then no solution.

• Remove a node from the frontier.

• If node contains goal state, return the solution.

• Expand node, add resulting nodes to the frontier.

D

Page 50: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

What could go wrong?

Page 51: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

E

AB

C D

F

Frontier

Find a path from A to E. A

Page 52: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

E

AB

C D

F

Frontier

Find a path from A to E.

A

Page 53: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

E

AB

C D

F

Frontier

Find a path from A to E.

B

Page 54: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

E

AB

C D

F

Frontier

Find a path from A to E.

B

Page 55: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

E

AB

C D

F

Frontier

Find a path from A to E. A

C D

Page 56: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

E

AB

C D

F

Frontier

Find a path from A to E.

A C D

Page 57: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

E

AB

C D

F

Frontier

Find a path from A to E.

C D

Page 58: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

Revised Approach

• Start with a frontier that contains the initial state.

• Start with an empty explored set.

• Repeat:

• If the frontier is empty, then no solution.

• Remove a node from the frontier.

• If node contains goal state, return the solution.

• Add the node to the explored set.

• Expand node, add resulting nodes to the frontier if they aren't already in the frontier or the explored set.

Page 59: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

Revised Approach

• Start with a frontier that contains the initial state.

• Start with an empty explored set.

• Repeat:

• If the frontier is empty, then no solution.

• Remove a node from the frontier.

• If node contains goal state, return the solution.

• Add the node to the explored set.

• Expand node, add resulting nodes to the frontier if they aren't already in the frontier or the explored set.

Page 60: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

stack

last-in first-out data type

Page 61: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

E

AB

C D

F

Frontier

Find a path from A to E. A

Explored Set

Page 62: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

E

AB

C D

F

Frontier

Find a path from A to E.

A

Explored Set

Page 63: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

E

AB

C D

F

Frontier

Find a path from A to E.

Explored Set

B

A

Page 64: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

E

AB

C D

F

Frontier

Find a path from A to E.

Explored Set

B

A

Page 65: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

E

AB

C D

F

Frontier

Find a path from A to E.

Explored Set

C D

BA

Page 66: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

E

AB

C D

F

Frontier

Find a path from A to E.

Explored Set

C D

BA

Page 67: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

E

AB

C D

F

Frontier

Find a path from A to E.

Explored Set

C

F

BA D

Page 68: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

E

AB

C D

F

Frontier

Find a path from A to E.

Explored Set

C F

BA D

Page 69: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

E

AB

C D

F

Frontier

Find a path from A to E.

Explored Set

C

BA D F

Page 70: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

E

AB

C D

F

Frontier

Find a path from A to E.

Explored Set

E

BA D F C

Page 71: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

E

AB

C D

F

Frontier

Find a path from A to E.

Explored Set

E

BA D F C

Page 72: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

E

AB

C D

F

Frontier

Find a path from A to E.

Explored Set

BA D F C

Page 73: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

Depth-First Search

Page 74: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

depth-first search

search algorithm that always expands the deepest node in the frontier

Page 75: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

Breadth-First Search

Page 76: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

breadth-first search

search algorithm that always expands the shallowest node in the frontier

Page 77: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

queue

first-in first-out data type

Page 78: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

E

AB

C D

F

Frontier

Find a path from A to E. A

Explored Set

Page 79: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

E

AB

C D

F

Frontier

Find a path from A to E.

Explored Set

A

Page 80: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

E

AB

C D

F

Frontier

Find a path from A to E.

Explored Set

A

B

Page 81: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

E

AB

C D

F

Frontier

Find a path from A to E.

Explored Set

A

B

Page 82: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

E

AB

C D

F

Frontier

Find a path from A to E.

Explored Set

A B

C D

Page 83: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

E

AB

C D

F

Frontier

Find a path from A to E.

Explored Set

A B

C D

Page 84: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

E

AB

C D

F

Frontier

Find a path from A to E.

Explored Set

A B C

D

E

Page 85: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

E

AB

C D

F

Frontier

Find a path from A to E.

Explored Set

A B C

D E

Page 86: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

E

AB

C D

F

Frontier

Find a path from A to E.

Explored Set

A B C D

E

F

Page 87: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

E

AB

C D

F

Frontier

Find a path from A to E.

Explored Set

A B C D

E F

Page 88: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

E

AB

C D

F

Frontier

Find a path from A to E.

Explored Set

A B C D

F

Page 89: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 90: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 91: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 92: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 93: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 94: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 95: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 96: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 97: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 98: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 99: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 100: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 101: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 102: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 103: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 104: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 105: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 106: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 107: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 108: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 109: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 110: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 111: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 112: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 113: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 114: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 115: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 116: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 117: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 118: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 119: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 120: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 121: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 122: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 123: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 124: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 125: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 126: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 127: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 128: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 129: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 130: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 131: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 132: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 133: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 134: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 135: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 136: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Depth-First Search

Page 137: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 138: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 139: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 140: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 141: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 142: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 143: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 144: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 145: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 146: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 147: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 148: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 149: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 150: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 151: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 152: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 153: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 154: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 155: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 156: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 157: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 158: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 159: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 160: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 161: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 162: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 163: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 164: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 165: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 166: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 167: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 168: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 169: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 170: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 171: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 172: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 173: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 174: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 175: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 176: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 177: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 178: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 179: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 180: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 181: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 182: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 183: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 184: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 185: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 186: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 187: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 188: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 189: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 190: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 191: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 192: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 193: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 194: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 195: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Breadth-First Search

Page 196: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

uninformed search

search strategy that uses no problem-specific knowledge

Page 197: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

informed search

search strategy that uses problem-specific knowledge to find solutions more efficiently

Page 198: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

greedy best-first search

search algorithm that expands the node that is closest to the goal, as estimated by a heuristic function h(n)

Page 199: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

A

Heuristic function?

Page 200: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

D

C

A

Heuristic function?

Page 201: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

B

D

C

A

Heuristic function? Manhattan distance.

Page 202: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

11 9 7 3 2 B

12 10 8 7 6 4 1

13 12 11 9 7 6 5 2

13 10 8 6 3

14 13 12 11 9 7 6 5 4

13 10

A 16 15 14 11 10 9 8 7 6

Greedy Best-First Search

Page 203: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

11 9 7 3 2 B

12 10 8 7 6 4 1

13 12 11 9 7 6 5 2

13 10 8 6 3

14 13 12 11 9 7 6 5 4

13 10

A 16 15 14 11 10 9 8 7 6

Greedy Best-First Search

Page 204: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

11 9 7 3 2 B

12 10 8 7 6 4 1

13 12 11 9 7 6 5 2

13 10 8 6 3

14 13 12 11 9 7 6 5 4

13 10

A 16 15 14 11 10 9 8 7 6

Greedy Best-First Search

Page 205: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

11 9 7 3 2 B

12 10 8 7 6 4 1

13 12 11 9 7 6 5 2

13 10 8 6 3

14 13 12 11 9 7 6 5 4

13 10

A 16 15 14 11 10 9 8 7 6

Greedy Best-First Search

Page 206: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

11 9 7 3 2 B

12 10 8 7 6 4 1

13 12 11 9 7 6 5 2

13 10 8 6 3

14 13 12 11 9 7 6 5 4

13 10

A 16 15 14 11 10 9 8 7 6

Greedy Best-First Search

Page 207: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

11 9 7 3 2 B

12 10 8 7 6 4 1

13 12 11 9 7 6 5 2

13 10 8 6 3

14 13 12 11 9 7 6 5 4

13 10

A 16 15 14 11 10 9 8 7 6

Greedy Best-First Search

Page 208: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

11 9 7 3 2 B

12 10 8 7 6 4 1

13 12 11 9 7 6 5 2

13 10 8 6 3

14 13 12 11 9 7 6 5 4

13 10

A 16 15 14 11 10 9 8 7 6

Greedy Best-First Search

Page 209: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

11 9 7 3 2 B

12 10 8 7 6 4 1

13 12 11 9 7 6 5 2

13 10 8 6 3

14 13 12 11 9 7 6 5 4

13 10

A 16 15 14 11 10 9 8 7 6

Greedy Best-First Search

Page 210: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

11 9 7 3 2 B

12 10 8 7 6 4 1

13 12 11 9 7 6 5 2

13 10 8 6 3

14 13 12 11 9 7 6 5 4

13 10

A 16 15 14 11 10 9 8 7 6

Greedy Best-First Search

Page 211: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

11 9 7 3 2 B

12 10 8 7 6 4 1

13 12 11 9 7 6 5 2

13 10 8 6 3

14 13 12 11 9 7 6 5 4

13 10

A 16 15 14 11 10 9 8 7 6

Greedy Best-First Search

Page 212: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

11 9 7 3 2 B

12 10 8 7 6 4 1

13 12 11 9 7 6 5 2

13 10 8 6 3

14 13 12 11 9 7 6 5 4

13 10

A 16 15 14 11 10 9 8 7 6

Greedy Best-First Search

Page 213: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

11 9 7 3 2 B

12 10 8 7 6 4 1

13 12 11 9 7 6 5 2

13 10 8 6 3

14 13 12 11 9 7 6 5 4

13 10

A 16 15 14 11 10 9 8 7 6

Greedy Best-First Search

Page 214: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

11 9 7 3 2 B

12 10 8 7 6 4 1

13 12 11 9 7 6 5 2

13 10 8 6 3

14 13 12 11 9 7 6 5 4

13 10

A 16 15 14 11 10 9 8 7 6

Greedy Best-First Search

Page 215: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

11 9 7 3 2 B

12 10 8 7 6 4 1

13 12 11 9 7 6 5 2

13 10 8 6 3

14 13 12 11 9 7 6 5 4

13 10

A 16 15 14 11 10 9 8 7 6

Greedy Best-First Search

Page 216: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

11 9 7 3 2 B

12 10 8 7 6 4 1

13 12 11 9 7 6 5 2

13 10 8 6 3

14 13 12 11 9 7 6 5 4

13 10

A 16 15 14 11 10 9 8 7 6

Greedy Best-First Search

Page 217: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

11 9 7 3 2 B

12 10 8 7 6 4 1

13 12 11 9 7 6 5 2

13 10 8 6 3

14 13 12 11 9 7 6 5 4

13 10

A 16 15 14 11 10 9 8 7 6

Greedy Best-First Search

Page 218: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

11 9 7 3 2 B

12 10 8 7 6 4 1

13 12 11 9 7 6 5 2

13 10 8 6 3

14 13 12 11 9 7 6 5 4

13 10

A 16 15 14 11 10 9 8 7 6

Greedy Best-First Search

Page 219: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

11 9 7 3 2 B

12 10 8 7 6 4 1

13 12 11 9 7 6 5 2

13 10 8 6 3

14 13 12 11 9 7 6 5 4

13 10

A 16 15 14 11 10 9 8 7 6

Greedy Best-First Search

Page 220: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

11 9 7 3 2 B

12 10 8 7 6 4 1

13 12 11 9 7 6 5 2

13 10 8 6 3

14 13 12 11 9 7 6 5 4

13 10

A 16 15 14 11 10 9 8 7 6

Greedy Best-First Search

Page 221: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

11 9 7 3 2 B

12 10 8 7 6 4 1

13 12 11 9 7 6 5 2

13 10 8 6 3

14 13 12 11 9 7 6 5 4

13 10

A 16 15 14 11 10 9 8 7 6

Greedy Best-First Search

Page 222: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

11 9 7 3 2 B

12 10 8 7 6 4 1

13 12 11 9 7 6 5 2

13 10 8 6 3

14 13 12 11 9 7 6 5 4

13 10

A 16 15 14 11 10 9 8 7 6

Greedy Best-First Search

Page 223: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

11 9 7 3 2 B

12 10 8 7 6 4 1

13 12 11 9 7 6 5 2

13 10 8 6 3

14 13 12 11 9 7 6 5 4

13 10

A 16 15 14 11 10 9 8 7 6

Greedy Best-First Search

Page 224: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

11 9 7 3 2 B

12 10 8 7 6 4 1

13 12 11 9 7 6 5 2

13 10 8 6 3

14 13 12 11 9 7 6 5 4

13 10

A 16 15 14 11 10 9 8 7 6

Greedy Best-First Search

Page 225: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

11 9 7 3 2 B

12 10 8 7 6 4 1

13 12 11 9 7 6 5 2

13 10 8 6 3

14 13 12 11 9 7 6 5 4

13 10

A 16 15 14 11 10 9 8 7 6

Greedy Best-First Search

Page 226: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

11 9 7 3 2 B

12 10 8 7 6 4 1

13 12 11 9 7 6 5 2

13 10 8 6 3

14 13 12 11 9 7 6 5 4

13 10

A 16 15 14 11 10 9 8 7 6

Greedy Best-First Search

Page 227: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

11 9 7 3 2 B

12 10 8 7 6 4 1

13 12 11 9 7 6 5 2

13 10 8 6 3

14 13 12 11 9 7 6 5 4

13 10

A 16 15 14 11 10 9 8 7 6

Greedy Best-First Search

Page 228: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

11 9 7 3 2 B

12 10 8 7 6 4 1

13 12 11 9 7 6 5 2

13 10 8 6 3

14 13 12 11 9 7 6 5 4

13 10

A 16 15 14 11 10 9 8 7 6

Greedy Best-First Search

Page 229: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

10 9 8 7 6 5 4 3 2 1 B

11 1

12 10 9 8 7 6 5 4 2

13 11 5 3

14 13 12 10 9 8 7 6 4

13 11 5

A 16 15 14 12 11 10 9 8 7 6

Greedy Best-First Search

Page 230: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

10 9 8 7 6 5 4 3 2 1 B

11 1

12 10 9 8 7 6 5 4 2

13 11 5 3

14 13 12 10 9 8 7 6 4

13 11 5

A 16 15 14 12 11 10 9 8 7 6

Greedy Best-First Search

Page 231: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

10 9 8 7 6 5 4 3 2 1 B

11 1

12 10 9 8 7 6 5 4 2

13 11 5 3

14 13 12 10 9 8 7 6 4

13 11 5

A 16 15 14 12 11 10 9 8 7 6

Greedy Best-First Search

Page 232: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

A* search

search algorithm that expands node with lowest value of g(n) + h(n)

g(n) = cost to reach node h(n) = estimated cost to goal

Page 233: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

10 9 8 7 6 5 4 3 2 1 B

11 1

12 10 9 8 7 6 5 4 2

13 11 5 3

14 13 12 10 9 8 7 6 4

13 11 5

A 16 15 14 12 11 10 9 8 7 6

A* Search

Page 234: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

10 9 8 7 6 5 4 3 2 1 B

11 1

12 10 9 8 7 6 5 4 2

13 11 5 3

14 13 12 10 9 8 7 6 4

13 11 5

A 1+16 15 14 12 11 10 9 8 7 6

A* Search

Page 235: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

10 9 8 7 6 5 4 3 2 1 B

11 1

12 10 9 8 7 6 5 4 2

13 11 5 3

14 13 12 10 9 8 7 6 4

13 11 5

A 1+16 2+15 14 12 11 10 9 8 7 6

A* Search

Page 236: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

10 9 8 7 6 5 4 3 2 1 B

11 1

12 10 9 8 7 6 5 4 2

13 11 5 3

14 13 12 10 9 8 7 6 4

13 11 5

A 1+16 2+15 3+14 12 11 10 9 8 7 6

A* Search

Page 237: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

10 9 8 7 6 5 4 3 2 1 B

11 1

12 10 9 8 7 6 5 4 2

13 11 5 3

14 13 12 10 9 8 7 6 4

4+13 11 5

A 1+16 2+15 3+14 12 11 10 9 8 7 6

A* Search

Page 238: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

10 9 8 7 6 5 4 3 2 1 B

11 1

12 10 9 8 7 6 5 4 2

13 11 5 3

14 13 5+12 10 9 8 7 6 4

4+13 11 5

A 1+16 2+15 3+14 12 11 10 9 8 7 6

A* Search

Page 239: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

10 9 8 7 6 5 4 3 2 1 B

11 1

12 10 9 8 7 6 5 4 2

13 6+11 5 3

14 13 5+12 10 9 8 7 6 4

4+13 11 5

A 1+16 2+15 3+14 12 11 10 9 8 7 6

A* Search

Page 240: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

10 9 8 7 6 5 4 3 2 1 B

11 1

12 7+10 9 8 7 6 5 4 2

13 6+11 5 3

14 13 5+12 10 9 8 7 6 4

4+13 11 5

A 1+16 2+15 3+14 12 11 10 9 8 7 6

A* Search

Page 241: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

10 9 8 7 6 5 4 3 2 1 B

11 1

12 7+10 8+9 8 7 6 5 4 2

13 6+11 5 3

14 13 5+12 10 9 8 7 6 4

4+13 11 5

A 1+16 2+15 3+14 12 11 10 9 8 7 6

A* Search

Page 242: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

10 9 8 7 6 5 4 3 2 1 B

11 1

12 7+10 8+9 9+8 7 6 5 4 2

13 6+11 5 3

14 13 5+12 10 9 8 7 6 4

4+13 11 5

A 1+16 2+15 3+14 12 11 10 9 8 7 6

A* Search

Page 243: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

10 9 8 7 6 5 4 3 2 1 B

11 1

12 7+10 8+9 9+8 10+7 6 5 4 2

13 6+11 5 3

14 13 5+12 10 9 8 7 6 4

4+13 11 5

A 1+16 2+15 3+14 12 11 10 9 8 7 6

A* Search

Page 244: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

10 9 8 7 6 5 4 3 2 1 B

11 1

12 7+10 8+9 9+8 10+7 11+6 5 4 2

13 6+11 5 3

14 13 5+12 10 9 8 7 6 4

4+13 11 5

A 1+16 2+15 3+14 12 11 10 9 8 7 6

A* Search

Page 245: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

10 9 8 7 6 5 4 3 2 1 B

11 1

12 7+10 8+9 9+8 10+7 11+6 12+5 4 2

13 6+11 5 3

14 13 5+12 10 9 8 7 6 4

4+13 11 5

A 1+16 2+15 3+14 12 11 10 9 8 7 6

A* Search

Page 246: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

10 9 8 7 6 5 4 3 2 1 B

11 1

12 7+10 8+9 9+8 10+7 11+6 12+5 13+4 2

13 6+11 5 3

14 13 5+12 10 9 8 7 6 4

4+13 11 5

A 1+16 2+15 3+14 12 11 10 9 8 7 6

A* Search

Page 247: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

10 9 8 7 6 5 4 3 2 1 B

11 1

12 7+10 8+9 9+8 10+7 11+6 12+5 13+4 2

13 6+11 14+5 3

14 13 5+12 10 9 8 7 6 4

4+13 11 5

A 1+16 2+15 3+14 12 11 10 9 8 7 6

A* Search

Page 248: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

10 9 8 7 6 5 4 3 2 1 B

11 1

12 7+10 8+9 9+8 10+7 11+6 12+5 13+4 2

13 6+11 14+5 3

14 6+13 5+12 10 9 8 7 6 4

4+13 11 5

A 1+16 2+15 3+14 12 11 10 9 8 7 6

A* Search

Page 249: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

10 9 8 7 6 5 4 3 2 1 B

11 1

12 7+10 8+9 9+8 10+7 11+6 12+5 13+4 2

13 6+11 14+5 3

14 6+13 5+12 10 9 8 7 15+6 4

4+13 11 5

A 1+16 2+15 3+14 12 11 10 9 8 7 6

A* Search

Page 250: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

10 9 8 7 6 5 4 3 2 1 B

11 1

12 7+10 8+9 9+8 10+7 11+6 12+5 13+4 2

13 6+11 14+5 3

7+14 6+13 5+12 10 9 8 7 15+6 4

4+13 11 5

A 1+16 2+15 3+14 12 11 10 9 8 7 6

A* Search

Page 251: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

10 9 8 7 6 5 4 3 2 1 B

11 1

12 7+10 8+9 9+8 10+7 11+6 12+5 13+4 2

8+13 6+11 14+5 3

7+14 6+13 5+12 10 9 8 7 15+6 4

4+13 11 5

A 1+16 2+15 3+14 12 11 10 9 8 7 6

A* Search

Page 252: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

10 9 8 7 6 5 4 3 2 1 B

11 1

9+12 7+10 8+9 9+8 10+7 11+6 12+5 13+4 2

8+13 6+11 14+5 3

7+14 6+13 5+12 10 9 8 7 15+6 4

4+13 11 5

A 1+16 2+15 3+14 12 11 10 9 8 7 6

A* Search

Page 253: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

10 9 8 7 6 5 4 3 2 1 B

10+11 1

9+12 7+10 8+9 9+8 10+7 11+6 12+5 13+4 2

8+13 6+11 14+5 3

7+14 6+13 5+12 10 9 8 7 15+6 4

4+13 11 5

A 1+16 2+15 3+14 12 11 10 9 8 7 6

A* Search

Page 254: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

11+10 9 8 7 6 5 4 3 2 1 B

10+11 1

9+12 7+10 8+9 9+8 10+7 11+6 12+5 13+4 2

8+13 6+11 14+5 3

7+14 6+13 5+12 10 9 8 7 15+6 4

4+13 11 5

A 1+16 2+15 3+14 12 11 10 9 8 7 6

A* Search

Page 255: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

11+10 12+9 8 7 6 5 4 3 2 1 B

10+11 1

9+12 7+10 8+9 9+8 10+7 11+6 12+5 13+4 2

8+13 6+11 14+5 3

7+14 6+13 5+12 10 9 8 7 15+6 4

4+13 11 5

A 1+16 2+15 3+14 12 11 10 9 8 7 6

A* Search

Page 256: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

11+10 12+9 13+8 7 6 5 4 3 2 1 B

10+11 1

9+12 7+10 8+9 9+8 10+7 11+6 12+5 13+4 2

8+13 6+11 14+5 3

7+14 6+13 5+12 10 9 8 7 15+6 4

4+13 11 5

A 1+16 2+15 3+14 12 11 10 9 8 7 6

A* Search

Page 257: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

11+10 12+9 13+8 14+7 6 5 4 3 2 1 B

10+11 1

9+12 7+10 8+9 9+8 10+7 11+6 12+5 13+4 2

8+13 6+11 14+5 3

7+14 6+13 5+12 10 9 8 7 15+6 4

4+13 11 5

A 1+16 2+15 3+14 12 11 10 9 8 7 6

A* Search

Page 258: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

11+10 12+9 13+8 14+7 15+6 5 4 3 2 1 B

10+11 1

9+12 7+10 8+9 9+8 10+7 11+6 12+5 13+4 2

8+13 6+11 14+5 3

7+14 6+13 5+12 10 9 8 7 15+6 4

4+13 11 5

A 1+16 2+15 3+14 12 11 10 9 8 7 6

A* Search

Page 259: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

11+10 12+9 13+8 14+7 15+6 16+5 4 3 2 1 B

10+11 1

9+12 7+10 8+9 9+8 10+7 11+6 12+5 13+4 2

8+13 6+11 14+5 3

7+14 6+13 5+12 10 9 8 7 15+6 4

4+13 11 5

A 1+16 2+15 3+14 12 11 10 9 8 7 6

A* Search

Page 260: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

11+10 12+9 13+8 14+7 15+6 16+5 17+4 3 2 1 B

10+11 1

9+12 7+10 8+9 9+8 10+7 11+6 12+5 13+4 2

8+13 6+11 14+5 3

7+14 6+13 5+12 10 9 8 7 15+6 4

4+13 11 5

A 1+16 2+15 3+14 12 11 10 9 8 7 6

A* Search

Page 261: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

11+10 12+9 13+8 14+7 15+6 16+5 17+4 18+3 2 1 B

10+11 1

9+12 7+10 8+9 9+8 10+7 11+6 12+5 13+4 2

8+13 6+11 14+5 3

7+14 6+13 5+12 10 9 8 7 15+6 4

4+13 11 5

A 1+16 2+15 3+14 12 11 10 9 8 7 6

A* Search

Page 262: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

11+10 12+9 13+8 14+7 15+6 16+5 17+4 18+3 19+2 1 B

10+11 1

9+12 7+10 8+9 9+8 10+7 11+6 12+5 13+4 2

8+13 6+11 14+5 3

7+14 6+13 5+12 10 9 8 7 15+6 4

4+13 11 5

A 1+16 2+15 3+14 12 11 10 9 8 7 6

A* Search

Page 263: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

11+10 12+9 13+8 14+7 15+6 16+5 17+4 18+3 19+2 20+1 B

10+11 1

9+12 7+10 8+9 9+8 10+7 11+6 12+5 13+4 2

8+13 6+11 14+5 3

7+14 6+13 5+12 10 9 8 7 15+6 4

4+13 11 5

A 1+16 2+15 3+14 12 11 10 9 8 7 6

A* Search

Page 264: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

A* search

optimal if - h(n) is admissible (never overestimates the

true cost), and - h(n) is consistent (for every node n and

successor n' with step cost c, h(n) ≤ h(n') + c)

Page 265: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

Adversarial Search

Page 266: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

XO X

OXOX

Page 267: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

XO X

OXOX

Page 268: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

Minimax

Page 269: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

O X X

O O

O X X

X O X

O O X

X X O

O X

X O

X O X

1-1 0

Page 270: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

Minimax

•MAX (X) aims to maximize score.

•MIN (O) aims to minimize score.

Page 271: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

Game

• S0 : initial state

• PLAYER(s) : returns which player to move in state s

• ACTIONS(s) : returns legal moves in state s

• RESULT(s, a) : returns state after action a taken in state s

• TERMINAL(s) : checks if state s is a terminal state

• UTILITY(s) : final numerical value for terminal state s

Page 272: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

Initial State

Page 273: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

PLAYER(s)

PLAYER( ) = X

XPLAYER( ) = O

Page 274: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

ACTIONS(s)

X O

O X X

X OACTIONS( ) = { , }

O

O

Page 275: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

RESULT(s, a)

X O

O X X

X ORESULT( , ) =O

O X O

O X X

X O

Page 276: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

TERMINAL(s)

O

O X

X O XTERMINAL( ) = false

O X

O X

X O XTERMINAL( ) = true

Page 277: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

UTILITY(s)

O X

O X

X O XUTILITY( ) = 1

O X X

X O

O X OUTILITY( ) = -1

Page 278: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

VALUE: 1

O X OO X XX X O

Page 279: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

X OO X XX O

PLAYER(s) = O

O X OO X XX O

X OO X XX O O

MIN-VALUE:0

O X OO X XX X O

X X OO X XX O O

VALUE:0

VALUE:1

MAX-VALUE:1

MAX-VALUE:0

Page 280: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

X OO X XX O

O X OO X XX O

X OO X XX O O

MIN-VALUE:0

O X OO X XX X O

X X OO X XX O O

VALUE:0

VALUE:1

MAX-VALUE:1

MAX-VALUE:0

PLAYER(s) = O

Page 281: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

PLAYER(s) = X

X O

O X XX O

O X O

O X XX O

X O

O X XX O O

MIN-VALUE:0

O X O

O X XX X O

X X O

O X XX O O

VALUE:0

VALUE:1

MAX-VALUE:1

MAX-VALUE:0

X OO XX O

X X O

O XX O

X X O

O X OX O

X X O

O XX O O

MIN-VALUE:-1

X X O

O X XX O O

VALUE:0

VALUE:-1

MAX-VALUE:0

X O

O XX X O

VALUE:1

MAX-VALUE:1

Page 282: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

9

5 3 9

Page 283: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

9

5 3 9 2 8

8

8

Page 284: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

Minimax

• Given a state s:

•MAX picks action a in ACTIONS(s) that produces highest value of MIN-VALUE(RESULT(s, a))

•MIN picks action a in ACTIONS(s) that produces smallest value of MAX-VALUE(RESULT(s, a))

Page 285: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

Minimax

function MAX-VALUE(state): if TERMINAL(state): return UTILITY(state) v = -∞ for action in ACTIONS(state): v = MAX(v, MIN-VALUE(RESULT(state, action))) return v

Page 286: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

Minimax

function MIN-VALUE(state): if TERMINAL(state): return UTILITY(state) v = ∞ for action in ACTIONS(state): v = MIN(v, MAX-VALUE(RESULT(state, action))) return v

Page 287: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

Optimizations

Page 288: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

4

5 2

2 64

3

9 73

4

4 58

Page 289: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

4

5 ≤2

2

≤3

9 3

4

4 58

Page 290: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

Alpha-Beta Pruning

Page 291: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

255,168total possible Tic-Tac-Toe games

Page 292: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

288,000,000,000

total possible chess gamesafter four moves each

Page 293: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

total possible chess games(lower bound)

2900010

Page 294: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

Depth-Limited Minimax

Page 295: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

evaluation function

function that estimates the expected utility of the game from a given state

Page 296: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier
Page 297: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

https://xkcd.com/832/

Page 298: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

Search

Page 299: Introduction to Artificial Intelligence · Revised Approach •Start with a frontier that contains the initial state. •Start with an empty explored set. •Repeat: •If the frontier

Introduction to Artificial Intelligence

with Python