cs 385 fall 2006 chapter 4

Post on 01-Jan-2016

20 Views

Category:

Documents

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

CS 385 Fall 2006 Chapter 4. Heuristic Search. Heuristics. eurisko ("I discover" in Greek) "the study of the methods and rules of discovery and invention." Polya 1945 rules of thumb - PowerPoint PPT Presentation

TRANSCRIPT

1

CS 385 Fall 2006Chapter 4

Heuristic Search

2

Heuristics

eurisko ("I discover" in Greek)

"the study of the methods and rules of discovery and invention." Polya 1945

rules of thumb

"Intelligence for a system with limited resources consists in making wise choices of what to do next." Newell and Simon

Heuristics can

1. choose a most likely solution when exact is impossible (diagnosis)

2. guide a search along the most promising path when the state space is too large for complete search

3

Examples

Tic tac toe: Pick the arc with the most winning paths

Chess: Use a board strength metric (pieces in danger, domination of center)

Soccer:Consider distance to goal, position of opposing team, surprise,...

Homework assignments?

Your life?

4

Figure 4.3: Heuristically reduced state space for tic-tac-toe.

5

Algorithms

1. Hill climbing (gradient search)Select the best child for further expansion.

Don't retain siblings or parent

2. Dynamic programming (Math 305)

3. Best firstStates on the open list sorted by a heuristic evaluation function.

When children are generated, all are added to open, in order

What do you use when you areLost and trying to find your way to Auburn?

Looking for your keys?

Integrating a function?

Other examples?

6

Step EvaluateOpen Closed

1 [A5] [ ]

2 A5 [B4, C4, D6] [A5]

3 B4 [C4, E5, F5, D6] [B4, A5]

4 C4 [H3, G4, E5, F5, D6] [C4, B4, A5]

5 H3 [O2, P3, G4, E5, F5, D6] [H3, C4, B4, A5]

6 O2 [P3, G4, E5, F5, D6] [O2, H3, C4, B4, A5]

7 P3 solution found

best_first_search for Figure 4.4

7

Heuristic search with open and closed states highlighted.

8

Heuristics applied to the 8-puzzle

9

Evaluation function f(n)

f(n) = g(n) + h(n)g(n): length of path from start state to n

h(n): heuristic estimate of the distance from n to goal

What does g do?If n is nearer the root, it is more likely to be on the shorted path to

the goal

This favors equally good states closer to the start

10

Figure 4.9: The heuristic f applied to states in the 8-puzzle.

11

Is there a single evaluation function?

No. Each step may have different reasoning.

E.g. chess, identical states may have different h(n) depending on history.

Real world: the pattern matcher picks the right heuristic to apply at each step.

Financial advisor: add certainty factors ( -1 to 1) to the rulessavings_account(adequate) ^ income(adequate)→ investment(stocks) confidence

0.8

savings_account(adequate) ^ income(adequate)→ investment(combination) confidence 0.5

savings_account(adequate) ^ income(adequate)→ investment(savings) confidence 0.1

What's funny here?

How would you use this?

12

Minimax for Games

You: want to MAX your gains

Opponent want to MIN your gains

Traditional Operations Research:Strategies 1-n for each player

Payoff matrix (i,j)th position is payoff to 1 if 1 picks strategy i and 2 picks strategy j

Game: Each player shows 0 or 1 fingers.

Even sum: player 1 wins $1, odd: player 2 wins $1

Payoff matrix: 1\2 0 1

0

1 1 -1

-1 1

13

Minimax for Games

What about this one?Payoff matrix: 1\2 0 1

0

1

1's reasoning: The worst I can do with strategy 1 is -10

The worst I can do with strategy 2 is 0

The best of the worst is 0

Pick strategy 2

max (min(-10, 0)) → payoff 0

1 -10

2 0

14

Nim

Start with 7 tokens in a pile

Each player divides a pile into an unequal number of tokens

The first player who cannot move, loses

Strategy?

15

Figure 4.19: Minimax for nim(0 = win for MIN, 1= win for MAX)Bold lines indicate forced win for MAX

16

Figure 4.21: Minimax to a hypothetical state space. Leaf states show heuristic values; internal states show backed-up values.

Note, we seem to be using min/max inconsistently

17

Alpha-Beta Pruning

Minimax investigates all paths to ply depth

Sometimes a path is obviously not worth following

Alpha-beta pruning removes those known to be worse than a possible outcome.

18

Figure 4.26: Alpha-beta pruning applied to state space of Figure 4.15. States without numbers are not evaluated.

19

Fig 4.30.

9

20

Figure 4.25

top related