t ; NILS J. NILSSON Artificial Intelligence Group Stanford Research Institute, Menlo Park, California PROBLEM-SOLVING METHODS IN ARTIFICIAL INTElliGENCE : I ! I i i . . i I ~ ,v 111( McGRAW-HILL BOOK COMPANY New York San Francisco St. Louis Johannesburg Kuala Lumpur London New Delhi Panama Rio de Janeiro Singapore Sydney Toronto ~ Dusseldorf Mexico Montreal i :Ci; STATE-SPACE SEARCH METHODS 65 A would certainly have missed it and thus would be inadmissible, contrary to our assumption. Thus, we must assumethat algorithm A "knew" that there ~as no lesscostly p.aththrough noden.) The i. : actual cost of an optImal path constraIned to go through node ,[ n is ;1 f(n) It , = g(n) 4- h(n) from which we can state that h(n) = f(n) - ~ ' g(n) Now, as argued above, algorithm A knows that f(n) ~ f(8) and therefore it knows that h(n) ~ f(8) - g(n) Such information available to algorithm A would permit a lower bound estimate of h(n) j(n) ! i. = f(8) - g(n) On the other hand, algorithm A * used the evaluation function , ! J = O(n) 4- h(n) I; We know from Lemma3-3 that . . j(n) ::;: f(8) Thus we know! O(n) 4- h(n) ::;: I J I' ;, I ! t f(8) Therefore, whatever the h function used by A * it must have satisfied t: the inequality ,J 'I, h(n) ::;: f(8) - i O(n) Now, at the time A* expandednoden, O(n) = g(n) by Lemma 3-2 and thus k(n) ::;: f(8) - l I g(n) I I! But now we seethat, at least for noden, algorithm A usedinformation permitting a lower bound on h at least as large as the lower bound used by algorithm A *. Thus A * could not be more informed 1 1 ' 1 than A, contradicting our assumptionand proving the theorem. 1 3-10 THE HEURISTIC POWER OF h The selectionof h is crucial in determining the heuristic power of the I \ ordered-searchalgorithm. Using h = 0 assures admissibility but results i 1 i i, I , -- -p'aJ'apJO 'aq~ JO J'at.\.od °1~s1Jn'aq 'aq~ s'au1WJ'a~'aP ~'Bq~ JO~O'BJJ'aq~ouy "~J'B~S 'aq~ J'B'aU S'Bt.\.~'Bt{~ PU'8 'p'aJJnooo ~U1p'B'aJds Jo ~unow'B ' P'a~1W11 AJ'aA 'B AluO ~1'B0~ 'aq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a~s1sUOO s'apou ~s'aq~1q 'aq~ o~ l'Bnb'a 1,:( ~S'aM'aJ 'aq~ spu'Bdx'a 'A~111q1ss1Wp'B ~u11I1'B~u1'Bw 'I{ uo punoq J'at.\.°1 'aIq1ssod ~U!~~'a8 '~u'a1om'au1 An'BnSn snq~ s1 PU'B qOJ'B'as punq 3~N3E>11l3.lNI "v'I~I:JI.l~'v' NI SaOH.l3W E>NI/\'OS-W3'80~d u1 99 .J ~- - STATE-SPACE SEARCH METHODS 67 1 , I i : i ! I II I ! I;' I , I: : J II j; i '! :1 Ii ! ~, j'; .1: jl Ii' .II, I" : I. i' 1: ' I' " i !II ' i : 'I '" III I'" !" , in : II i I; I .I; , I i ! i /: ' ~ W ' j: f\ . ' , . j.1 I i ! I I . I ;' I ,:: . ; I' " FIG. 3-8 A tree produced by an ordered search. j! I II : t 1,4 : ~ If ( I ! I 68 PROBLEM-SOLVING METHODS IN ARTIFICIAL INTELLIGENCE r! search algorithm is the amount of effort involved in calculating h. The best h would be a function identically equal to h, resulting in an absolute minimum number of node expansions. Such an h could, for example,be determined as a result of a separate complete search at every node, but this obviously would not reduce the total computational effort. Sometimes an h function that is not a lower bound on h is easier to compute than one that is. In these casesthe heuristic power might be doubly improved-because the total number of nodes expanded may be reduced (at the expenseof admissibility) and the computational effort is reduced. In certain casesthe heuristic power of a given h can be increased simply by multiplying it by some positive constant greater than unity. If this factor is very large, the situation is as if O(n) = O. Such a selection, of course,leads to an inadmissible algorithm but one that might nevertheless perform satisfactorily. In fact, one might intuitively supposethat setting O(n) = 0 would increasesearch efficiency in those casesin which any path (not necessarily the least costly) to the goal is desired. In the next section we shall present some results counter to such intuition. To summarize, there are three important factors influencing the heuristic power of an ordered-search algorithm: 1. The cost of the path 2. The number of nodes expanded in finding the path 3. The computational effort required to compute h The selection of a suitable ;. h then permits one to choose for each problem a desirable compromise among these factors to maximize heuristic power. j : 3-11 THE IMPORTANCE OF 0 '! In many problems, we merely desire to find somepath to a goal node and are unconcerned about the cost of the resulting path. (Weare, of course, concerned about the amount of search effort required to find .a path.) In such situations, intuitive arguments can be given both for including 0 in the evaluation function and for ignoring it. Intuitive argument for ignoring 0 When merely any path to a goal is desired, 0 can be ignored since, at any stage during the search, we don't care about the costs of the paths developed thus far. We care only about the remaining search effort required to find a goal node, and this searcheffort, while possibly dependent on the h values of the open nodes, is certainly independent of the 0 values of the open nodes. Therefore, for such problems we should use as the evaluation function J = h. ,