Dept Computer Science Korea Univ Intelligent Information System

  • Slides: 22
Download presentation
Dept. Computer Science, Korea Univ. Intelligent Information System Lab. A I (Artificial Intelligence) Professor

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. A I (Artificial Intelligence) Professor I. J. Chung 2021 -03 -09 1

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. AI (Artificial Intelligence) Heuristic function

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. 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. 2021 -03 -09 Artificial Intelligence 2

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. AI (Artificial Intelligence) AND/OR Graph

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. 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. 2021 -03 -09 Artificial Intelligence 3

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. AI (Artificial Intelligence) AND/OR graph

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. AI (Artificial Intelligence) AND/OR graph : structure to model the problem reduction 2021 -03 -09 Artificial Intelligence 4

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. AI (Artificial Intelligence) Objective of

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. 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) 2021 -03 -09 Artificial Intelligence 5

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. AI (Artificial Intelligence) e. g

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. AI (Artificial Intelligence) e. g 2021 -03 -09 Artificial Intelligence 6

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. AI (Artificial Intelligence) AND/OR graph

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. AI (Artificial Intelligence) AND/OR graph with problem reduction Objective of problem reduction Produce eventually primitive problem whose solutions are obvious 2021 -03 -09 Artificial Intelligence 7

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. AI (Artificial Intelligence) AND/OR graph

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. 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 2021 -03 -09 Artificial Intelligence 8

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. AI (Artificial Intelligence) The nonterminal

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. 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 and only if all of its successors are unsolvable. If a nonterminal has AND successor, it’s unsolvable and only if at least one of its successors is unsolvable. if if e. g. : AND/OR graph & problem reduction 2021 -03 -09 Artificial Intelligence 9

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. AI (Artificial Intelligence) Algorithm for

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. 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. ) 2021 -03 -09 Artificial Intelligence 10

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. AI (Artificial Intelligence) algorithm 1)

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. 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 2021 -03 -09 Artificial Intelligence 11

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. AI (Artificial Intelligence) Evaluation function

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. 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. 2021 -03 -09 Artificial Intelligence 12

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. AI (Artificial Intelligence) A*-algorithm. A

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. 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 2021 -03 -09 Artificial Intelligence 13

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. AI (Artificial Intelligence) algorithm A*

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. 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 2021 -03 -09 Artificial Intelligence 14

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. AI (Artificial Intelligence) Best First

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. 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 A step 2 A B C D 3 5 1 2021 -03 -09 Artificial Intelligence 15

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. AI (Artificial Intelligence) e. g

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. AI (Artificial Intelligence) e. g step 3 A B C D Step 5 3 step 4 A B C D 5 A 5 E F G H E F 4 6 6 5 4 6 B C D 5 G H E F 6 5 6 2021 -03 -09 I J 2 1 Artificial Intelligence 16

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. AI (Artificial Intelligence) BFS algorithm.

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. 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. 2. 3. 2) 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 2021 -03 -09 Artificial Intelligence 17

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. AI (Artificial Intelligence) Game playing

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. AI (Artificial Intelligence) Game playing (search 의 연장) Chess, go, TTT, … Structured task to measure Success / Failure Not necessary for large amount of knowledge 2021 -03 -09 Artificial Intelligence 18

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. AI (Artificial Intelligence) Maxmin search

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. 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. 2021 -03 -09 Artificial Intelligence 19

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. AI (Artificial Intelligence) -6 B

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. AI (Artificial Intelligence) -6 B E F G 9 -6 0 2021 -03 -09 A -2 max C -2 D -4 min H I 0 -2 Artificial Intelligence J K -4 -3 20

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. AI (Artificial Intelligence) / pruning

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. AI (Artificial Intelligence) / pruning Partial solution can be abandoned early. : lower bound on max. node : upper bound on min. node A 3 (>3) 3 B D 3 2021 -03 -09 max C -5 (<-5) min E F 5 – 5 G max G의 값에 관계없이 C노드의 e. f. 의 값은 – 5 따라서 we don’t have to generate the node G. Artificial Intelligence 21

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. AI (Artificial Intelligence) A >3

Dept. Computer Science, Korea Univ. Intelligent Information System Lab. AI (Artificial Intelligence) A >3 max 3 B 3 D C 4 5 E F 5 0 I K 0 2021 -03 -09 G 8 J M 5 L min 7 H 4 N max min 8 max 7 Artificial Intelligence 22