250 likes | 363 Views
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.
E N D
http://www.computerworld.com/softwaretopics/software/story/0,10801,99340,00.htmlAI agents used to smooth wrinkles in housing project A Chicago agency has turned to Agentis Software for help
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.
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.
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.
Demo of the 8-Puzzle • http://www.permadi.com/java/puzzle8/index.html • http://sciris.shu.edu/~borowski/Puzzle/Puzzle.html
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).
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.
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.
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
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:
2 • 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 n th 1 2 3 d
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 d + 1 1 - B 1 - B 1 - 27 1 - 3
The Search Tree • The search tree will be looked as:
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
More Heuristics • H1 – How many tiles are in the wrong place. • We will find for the following example: 7 6 4 3 1 2 5 8
More Heuristics • H1 – How many tiles are in the wrong place in comparison with the final goal is 8 2 3 1 8 4 7 6 5
An Improved Heuristic H2 • H2 – How far each tile has to move to get to its correct goal state;
More Heuristics • H2 (node)= 2+2+2+2+3+3+1+3 = 18 7 6 2 2 4 3 1 3 2 2 2 5 8 3 1 3
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.
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.
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.
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
Relaxed Problem • A Relaxed Problem is a version of a problem that has fewer Constraints.