Escolar Documentos
Profissional Documentos
Cultura Documentos
Difference between Hill climbing and Best first search: In Hill Climbing-one move is selected and all others are rejected, never to be reconsidered.
In Best first search-one move is selected but others are kept around so that they can be revisited later if the selected path becomes less promising.
Make a big jump to try to get in a new section. Moving in several directions at once.
Goal
D C B A
10
Goal
4
D C B A
Local heuristic: +1 for each block that is resting on the thing it is supposed to be resting on. -1 for each block that is resting on a wrong thing.
11
2
D C B A
12
C
B
C
B
D
A
C
B
0 A D
13
Goal
6
D C B A
Global heuristic: For each block that has the correct support structure: +1 to every block in the support structure. For each block that has a wrong support structure: -1 to every block in the support structure.
14
-3
C
B
C
B
D
A
C
B
-1 A D
15
A* Method
A* (Aystar) (Hart, 1972) method is a combination of branch & bound and best search, combined with the dynamic programming principle. The heuristic function (or Evaluation function) for a node N is defined as f(N) = g(N) + h(N) The function g is a measure of the cost of getting from the Start node (initial state) to the current node.
It is sum of costs of applying the rules that were applied along the best path to the current node.
The function h is an estimate of additional cost of getting from the current node to the Goal node (final state).
Here knowledge about the problem domain is exploited.
Behavior of A* Algorithm
Underestimation If we can guarantee that h never over estimates actual value from current to goal, then A* algorithm is guaranteed to find an optimal path to a goal, if one exists.
Underestimated
(1+3)B (2+3) E
(1+4)C
(1+5)D
(3+3) F
Example Overestimation
Here h is overestimated
Admissibility of A*
A search algorithm is admissible, if
for any graph, it always terminates in an optimal path from initial state to goal state, if path exists.
If heuristic function h is underestimate of actual value from current state to goal state, then the it is called admissible function. Alternatively we can say that A* always terminates with the optimal path in case
h(x) is an admissible heuristic function.
Evaluation function f (X) = g (X) + h(X) h (X) = the number of tiles not in their goal position in a given state X g(X) = depth of node X in the search tree Initial node has f(initial_node) = 4 Apply A* algorithm to solve it. The choice of evaluation function critically determines search results.
Search Tree
Start State f = 0+4 3 7 6 5 1 2 4 8 up (1+3) 3 7 6 5 2 4 1 8 left (1+5) 3 7 6 5 1 2 4 8 right (2+4) 3 7 6 5 2 4 1 8 right (1+5) 3 7 6 5 1 2 4 8
right
5 3 6 7 2 4 1 8
Goal State
Harder Problem
Harder problems (8 puzzle) cant be solved by heuristic function defined earlier.
Initial State 2 4 7 1 5 6 8 3 1 8 7 Goal State 2 6 3 4 5
A better estimate function is to be thought. h (X) = the sum of the distances of the tiles from their goal position in a given state X Initial node has h(initial_node) = 1+1+2+2+1+3+0+2=12
Problem Reduction
Goal: Acquire TV set
29
A 9 B 3 9 C 4
E 4
F 4
G 5
H 7
E 4
F 4
30
A 14
B 13 C 15
D 5
E 6
G 5
F 3
D 5
E 6
G 10 H 9
F 3
31
Constraint Satisfaction
Many AI problems can be viewed as problems
of constraint satisfaction.
Cryptarithmetic puzzle:
32
Constraint Satisfaction
As compared with a straightforard search
procedure, viewing a problem as one of constraint satisfaction can reduce substantially the amount of search.
33
Constraint Satisfaction
Operates in a space of constraint sets. Initial state contains the original constraints
given in the problem.
34
Constraint Satisfaction
Two-step process: 1. Constraints are discovered and propagated as far as possible. 2. If there is still not a solution, then search begins, adding new constraints.
35
Initial state:
No two letters have the same value.
The sum of the digits must be as shown.
M=1 S = 8 or 9 O=0 N=E+1 C2 = 1 N+R>8 E9
E=2
N=3 R = 8 or 9 2 + D = Y or 2 + D = 10 + Y
C1 = 0
2+D=Y N + R = 10 + E R=9 S =8
C1 = 1
2 + D = 10 + Y D=8+Y D = 8 or 9
D=8
Y=0
D=9
Y=1
36
Constraint Satisfaction
Two kinds of rules: 1. Rules that define valid constraint propagation. 2. Rules that suggest guesses when necessary.
37