heuristics in ai search

25
Heuristics in AI Search

Upload: hanae-french

Post on 02-Jan-2016

87 views

Category:

Documents


3 download

DESCRIPTION

Heuristics in AI Search. http://www.computerworld.com/softwaretopics/software/story/0,10801,99340,00.html AI agents used to smooth wrinkles in housing project A Chicago agency has turned to Agentis Software for help. Choosing a Good Heuristic. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Heuristics in AI Search

Heuristics in AI Search

Page 2: Heuristics in AI Search

http://www.computerworld.com/softwaretopics/software/story/0,10801,99340,00.html

AI agents used to smooth wrinkles in housing project

A Chicago agency has turned to Agentis Software for help

Page 3: Heuristics in AI Search

Choosing a Good Heuristic

• For a given problem, there might be many different heuristics one can choose.

• However, some heuristics are better than others.

• We say the heuristic is better if it needs few nodes to examine in the search tree.

• We also call this kinds of heuristics are better informed.

Page 4: Heuristics in AI Search

Efficiency is Very important in Picking a Heuristic

• It is very important to consider the efficiency of running the heuristic itself.

• More information about a problem may mean more time to process the information.

Page 5: Heuristics in AI Search

Examples about Heuristic

• The 8 (N) -puzzle problem.

• The 8-puzzle - also known as the sliding-block/tile-puzzle - is one of the most popular instrument in the artificial intelligence (AI) studies.

• It belongs to AI exercises commonly referred as toy-problems.

Page 6: Heuristics in AI Search

8-Puzzle

Page 7: Heuristics in AI Search

Demo of the 8-Puzzle

• http://www.permadi.com/java/puzzle8/index.html

• http://sciris.shu.edu/~borowski/Puzzle/Puzzle.html

Page 8: Heuristics in AI Search

It is a Popular Game, too.

• Toy problems - as the name implies - are somewhat fun. 

• They are not real-world problems, but they're useful because they are simple to define and confined. 

• It means that an exact description of the problems are possible, and all the factors that affects the problem are known (there is no need to worry about unpredictable factors such as weather or terrain).

Page 9: Heuristics in AI Search

8-Puzzle

• The 8-puzzle, along with chess, tic-tac-toe, and backgammon, has been used to study new search algorithms, neural-network, and  path-finding. 

• It's usually one of the first instrument that computer-scientists use to test a new search algorithm.

Page 10: Heuristics in AI Search

Heuristic Involved in 8-Puzzle

• We known that typically, it takes about 20 moves to get from a random start state to the goal state.

• Therefore, the search tree has a depth of 20.

• The branching factor will depends on the location of the blank square.

Page 11: Heuristics in AI Search

Branching Factor (B)

• When the blank square is in the middle of the grid, B=4;

• When the blank square is on the edge, B=3;

• When the blank square is in a corner, B=2.

• The average B=3

Page 12: Heuristics in AI Search

General Approach

• Most of the search tree have majority of the nodes in the deepest level; it means searching spends most of its time examining these nodes.

• In general, for a tree of depth d with a branching factor of B, the total number of nodes is:

Page 13: Heuristics in AI Search

• 1 root node

• B nodes in the first layer

• B nodes in the second layer

• :

• :

• B nodes in the n layer

• Hence, the total number of nodes is:

• 1 + B + B + B + …, + B

2

n th

21 3 d

Page 14: Heuristics in AI Search

Sum of Nodes

• Obviously, that is a geometric progression with the sum as:

• Sum of Nodes = for a tree of depth of 2 and B = 3,

Sum of nodes = = 13

1 - Bd + 1

1 - B

1 - 27

1 - 3

Page 15: Heuristics in AI Search

The Search Tree

• The search tree will be looked as:

Page 16: Heuristics in AI Search

For 8 – Puzzle with d=20 and B=3

• We would have a tree that has to examine around 3.5 billion states.

• However, for the given problem,

• We only have 9! = 362,880 possible states.

• This state number reduction is from the problem itself, and it can be considered as h0

Page 17: Heuristics in AI Search

More Heuristics

• H1 – How many tiles are in the wrong place.

• We will find for the following example:

7 6

4 3

2 5 8

1

Page 18: Heuristics in AI Search

More Heuristics

• H1 – How many tiles are in the wrong place in comparison with the final goal is 8

1

6

4

32

5

8

7

Page 19: Heuristics in AI Search

An Improved Heuristic H2

• H2 – How far each tile has to move to get to its correct goal state;

Page 20: Heuristics in AI Search

More Heuristics

• H2 (node)= 2+2+2+2+3+3+1+3 = 18

7 6

4 3

2 5 8

1

2 2

2 2 3

3 1 3

Page 21: Heuristics in AI Search

And, More Heuristics H3

• H3 = H2 + (2 x k (node)), where k is a function that is equal to the number of direct swaps that need to be made between adjacent tiles to move them into the correct sequence.

Page 22: Heuristics in AI Search

Admissible ?

• To be useful as a heuristic, the heuristic must never over-estimate the cost of changing from a given state to the goal state. Such a heuristic is defined as being admissible.

Page 23: Heuristics in AI Search

Heuristic Function f

• A heuristic function is a function that when applied to a node gives a value that represents a good estimate of the distance of the node from the goal.

• For two nodes m and n,

• If f (m) < f (n), m is said more likely to be on an optimal path than n to the goal node.

Page 24: Heuristics in AI Search

H1, H2, and H3 in 8-puzzle

• Obviously, all of them are admissible,

• And we also have:

• H3 is more informed than H2 and H2 is more informed than H1

Page 25: Heuristics in AI Search

Relaxed Problem

• A Relaxed Problem is a version of a problem that has fewer Constraints.