Dept. Computer Science, Korea Univ. Intelligent Information System Lab A I (Artificial Intelligence) Professor I. J. Chung
Dept. Computer Science, Korea Univ. Intelligent Information System Lab Artificial Intelligence2 AI (Artificial Intelligence) Heuristic function Estimate of distance of a path from the given node to the goal node. Nearest neighbor heuristic Select the locally superior alternative at each step n! → n 2 : number of different paths among the n cities=(n-1)! ① Select a starting city ② To select the next city. Check the all cities not yet visited, and select the one close-set to the current city. Go to it next ③ Repeat ② until all cities have been visited.
Dept. Computer Science, Korea Univ. Intelligent Information System Lab Artificial Intelligence3 AI (Artificial Intelligence) AND/OR Graph Problem decomposition : problem reduction HTP (Hanoi Tower Problem) Split the original problem into sub-problems until the original problem is reduced to a set of trivial primitive problems.
Dept. Computer Science, Korea Univ. Intelligent Information System Lab Artificial Intelligence4 AI (Artificial Intelligence) AND/OR graph : structure to model the problem reduction
Dept. Computer Science, Korea Univ. Intelligent Information System Lab Artificial Intelligence5 AI (Artificial Intelligence) Objective of problem reduction Produce eventually primitive problems whose solutions are obvious. To solve the problem A, we have 3 alternative paths : (B&C) or (D&E) or (F)
Dept. Computer Science, Korea Univ. Intelligent Information System Lab Artificial Intelligence6 AI (Artificial Intelligence) e.g
Dept. Computer Science, Korea Univ. Intelligent Information System Lab Artificial Intelligence7 AI (Artificial Intelligence) AND/OR graph with problem reduction Objective of problem reduction Produce eventually primitive problem whose solutions are obvious
Dept. Computer Science, Korea Univ. Intelligent Information System Lab Artificial Intelligence8 AI (Artificial Intelligence) AND/OR graph Structure modeling of the problem reduction One of the nodes in the graph, called the s.n., corresponding to the original problem Those nodes in the graph corresponding to the primitive description Algorithm of AND/OR graph shows that the structure node is solved
Dept. Computer Science, Korea Univ. Intelligent Information System Lab Artificial Intelligence9 AI (Artificial Intelligence) The nonterminal node which has no successors in an AND/OR graph: unsolvable node If a nonterminal has OR successor, it ’ s unsolvable if and only if all of its successors are unsolvable. If a nonterminal has AND successor, it ’ s unsolvable if and only if at least one of its successors is unsolvable. e.g. : AND/OR graph & problem reduction
Dept. Computer Science, Korea Univ. Intelligent Information System Lab Artificial Intelligence10 AI (Artificial Intelligence) Algorithm for Heuristic Search Best First Search Simplest way to implement heuristic search : hill climbing H/C : expand the current node & evaluate its children. : the best child is selected for further expansion. : neither its siblings nor its parent are retained. : search halts when it reaches a state that is better than any of its children. : 1) erroneous heuristic -> ∞ paths that fail ( ∵ it keeps no history, recovery) 2) local minima Combination of DFS and BFS (follow a single path at a time with switching paths whenever some alternative path looks more promising than the current one.)
Dept. Computer Science, Korea Univ. Intelligent Information System Lab Artificial Intelligence11 AI (Artificial Intelligence) algorithm 1)OPEN ← {initial state} 2)Until (a goal is found |OPEN = ) 2.1) pick a best node E in OPEN 2.2) generate the children & E 2.3) for ∀ children do : a)if it is the first node never generated before, add it to OPEN and record its parent. b)if it has been generated before, change the parent if this new path is better than the previous one
Dept. Computer Science, Korea Univ. Intelligent Information System Lab Artificial Intelligence12 AI (Artificial Intelligence) Evaluation function f(n) = g(n) + h(n) g(n) : length of the path from the initial state to the state(node) n. h(n) : heuristic estimate of the distance from state n to a goal.
Dept. Computer Science, Korea Univ. Intelligent Information System Lab Artificial Intelligence13 AI (Artificial Intelligence) A * -algorithm. A search algorithm is admissible if it ’ s guaranteed to find a optimal path whenever such a path exist . e.g BFS: admissible search strategy. (but too inefficient) f(n) = g(n) + h(n) f : evaluation function g : cost of node n from the initial state h : heuristic estimate of the cost from n to goal If this evaluation function f is used with the best first search, the result is called algorithm A. ^ ^ f = g + h ^ : estimator actual cost
Dept. Computer Science, Korea Univ. Intelligent Information System Lab Artificial Intelligence14 AI (Artificial Intelligence) algorithm A * If algorithm A is used with an evaluation function where h(n) ≤ cost of the minimal path from n to the goal. Note : 1)BFS is A * algorithm. Where f(n) = g(n) + O ie. h(n) = O. 2)set of nodes in A * ⊆ states examined in BFS. 3)if g=h=O ; random search For 2 A * algorithm h 1 & h 2 if h 1 (n) ≤ h 2 (n) for n ∈ S.S. heuristic h 2 is more informed than h 1
Dept. Computer Science, Korea Univ. Intelligent Information System Lab Artificial Intelligence15 AI (Artificial Intelligence) Best First Search Combination of DFS & BFS. DFS : without all competing branches having to be expanded BFS : no dead-end path Follow a path at a time, but switch paths whenever some competing path looks more promising than the current one. e.g step 1 step2 A A B C D 3 5 1
Dept. Computer Science, Korea Univ. Intelligent Information System Lab Artificial Intelligence16 AI (Artificial Intelligence) e.g step 3 step4 A A B C D B C D Step A E F G H E F B C D 5 G H E F I J 2 1
Dept. Computer Science, Korea Univ. Intelligent Information System Lab Artificial Intelligence17 AI (Artificial Intelligence) BFS algorithm. 1)OPEN ← {initial state} 2)loop until (goal state is formed or OPEN == ) 2.1) Select the most promising node from OPEN 2.2) Generate its successors 2.3) for ∀ success s do: 2.3.1) If s has not been generated before, add to OPEN ← OPEN ∪ {s}, and record its parent ) If s has been generated before, change the parent if this new path is more promising than before. Best FS : special case of A * algorithm
Dept. Computer Science, Korea Univ. Intelligent Information System Lab Artificial Intelligence18 AI (Artificial Intelligence) Game playing (search 의 연장 ) Chess, go, TTT, … Structured task to measure Success / Failure Not necessary for large amount of knowledge
Dept. Computer Science, Korea Univ. Intelligent Information System Lab Artificial Intelligence19 AI (Artificial Intelligence) Maxmin search Depth – first /depth – limited search procedure Start at the current position → apply the plausible – move generator one goal : max. the value of E.F. opponent goal : min the value of E.F. One path is explored as far as time allows The static evaluation function is applied to the game position at the last step of the path, and the value be passed up the path.
Dept. Computer Science, Korea Univ. Intelligent Information System Lab Artificial Intelligence20 AI (Artificial Intelligence) A -2 max -6 B C -2 D -4 min E F G H I J K
Dept. Computer Science, Korea Univ. Intelligent Information System Lab Artificial Intelligence21 AI (Artificial Intelligence) / pruning Partial solution can be abandoned early. : lower bound on max. node : upper bound on min. node A 3 (>3) max 3 B C -5 (<-5) min D E F G max 3 5 – 5 G 의 값에 관계없이 C 노드의 e.f. 의 값은 – 5 따라서 we don ’ t have to generate the node G.
Dept. Computer Science, Korea Univ. Intelligent Information System Lab Artificial Intelligence22 AI (Artificial Intelligence) A >3 max 3 B C 4 min 3 D 5 E F 5 G 8 H 4 max 0 I J M N min K L max 0 7