increasing search efficiency using multiple heuristics

4
Information Processing Letters 30 (1989) 33-36 North-Holland 16 January 1989 INCREASING SEARCH EFFICIENCY USI.NG MULTIPLE HEURISTICS P.P. CHAKRABARTI, S. GHOSE, A. PANDEY and S.C. DE SARKAR Department of Computer Science and Engineering,Indian Institute of TechnoIogy, Kharagw 721303, India Communicated by David Gries Received 16 November 1987 Revised 19 kmwy 1983 and 25 May 1988 Keywords: Artificial intelligence, search algorithms, heuristic evaluation functions, admissibility, efficiency 1. Introduction The trade-off between the quality of solution and the efficiency of the heuristic is of major concern in heuristic search algorithms like A* [3,4]. In such algorithms, heuristic estimates that guarantee minimal cost solutions (admissibility), that is, the ones for which the estimates are under- estimates, often do not direct the search efficiently in terms of the number of nodes generated. On the other hand, heuristics that are very efficient in terms of the number of nodes generated (a widely accepted measure of efficiency because of the cost of node expansion in AI problems) do not, in general, guarantee admissibility. In this paper, we show how to use two heuris- tics for the same problem. One (called “the first heuristic”) is an efficient estimate but does not guarantee admissibility. This is used to minimize the number of nodes expanded. The other (called “the second heuristic”) is an underestimate and guarantees admissibility. A 2-pass variation of A* called QA(c) has been developed combining these two heuristics. Results using the &puzzle problem show that though this combined approach may not guarantee admissibility for arbitrary Q, QA(c) performs better than A* using the second (admis- sible) heuristic, especially for harder problems. 2. Notations and defiitions S = n, m = g = c(m, n) = 8vo = h*(n) = h”(s) = g(n) = hi(n) = h2(n) = fwo = fwo = f *oo = P, P’ = M(P) = Q = p* = GL = 0020-0190/89/$3.50 6 1989, Elsevier Science Publishers B.V. (North-Holland) start node; nodes in the search graph; goal node; cost of arc from node m to im - mediate successor n; cost of the minimal cost path from s to n; cost of the minimal cost path from n to 8; cost of the minimal cost solution; estimate of g*(n); estimate of h*(n) using the first heuristic; estimate of h*(n . using the second heuristic; g(n) + hi(n); g(n) + h2(n); g*(n) + h*(n); path from s to goal = (s = no, nl,. . . , nk = g); m;wl f I( n)], for all nodes n on path P; min[M + (P’)], for all P’; minimal cost path from s to goal; M(P) where P is the solution ob- tained by Pass 1 of QA(r). 33

Upload: pp-chakrabarti

Post on 28-Aug-2016

219 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Increasing search efficiency using multiple heuristics

Information Processing Letters 30 (1989) 33-36 North-Holland

16 January 1989

INCREASING SEARCH EFFICIENCY USI.NG MULTIPLE HEURISTICS

P.P. CHAKRABARTI, S. GHOSE, A. PANDEY and S.C. DE SARKAR

Department of Computer Science and Engineering, Indian Institute of TechnoIogy, Kharagw 721303, India

Communicated by David Gries Received 16 November 1987 Revised 19 kmwy 1983 and 25 May 1988

Keywords: Artificial intelligence, search algorithms, heuristic evaluation functions, admissibility, efficiency

1. Introduction

The trade-off between the quality of solution and the efficiency of the heuristic is of major concern in heuristic search algorithms like A* [3,4]. In such algorithms, heuristic estimates that guarantee minimal cost solutions (admissibility), that is, the ones for which the estimates are under- estimates, often do not direct the search efficiently in terms of the number of nodes generated. On the other hand, heuristics that are very efficient in terms of the number of nodes generated (a widely accepted measure of efficiency because of the cost of node expansion in AI problems) do not, in general, guarantee admissibility.

In this paper, we show how to use two heuris- tics for the same problem. One (called “the first heuristic”) is an efficient estimate but does not guarantee admissibility. This is used to minimize the number of nodes expanded. The other (called “the second heuristic”) is an underestimate and guarantees admissibility. A 2-pass variation of A* called QA(c) has been developed combining these two heuristics. Results using the &puzzle problem show that though this combined approach may not guarantee admissibility for arbitrary Q, QA(c) performs better than A* using the second (admis- sible) heuristic, especially for harder problems.

2. Notations and defiitions

S =

n, m = g = c(m, n) =

8vo = h*(n) =

h”(s) =

g(n) = hi(n) =

h2(n) =

fwo = fwo = f *oo = P, P’ =

M(P) =

Q = p* = GL =

0020-0190/89/$3.50 6 1989, Elsevier Science Publishers B.V. (North-Holland)

start node; nodes in the search graph; goal node; cost of arc from node m to im - mediate successor n; cost of the minimal cost path from s to n; cost of the minimal cost path from n to 8; cost of the minimal cost solution; estimate of g*(n); estimate of h*(n) using the first heuristic; estimate of h*(n . using the second heuristic; g(n) + hi(n); g(n) + h2(n); g*(n) + h*(n); path from s to goal = (s = no, nl,. . . , nk = g); m;wl f I( n)], for all nodes n on path P; min[M + (P’)], for all P’; minimal cost path from s to goal; M(P) where P is the solution ob- tained by Pass 1 of QA(r).

33

Page 2: Increasing search efficiency using multiple heuristics

Volume 30, Number 1 INFORMATION PRQCESSING LETTERS 16 January 1989

Assumptions. (i) hi(n) is not admissible but gener- ally expands fewer nodes ihan h2( n) to find a solution.

(ii) h2( n) 6 h*(n) for all nodes n in the search

graph.

3. Algorithm QA(r)

Algorithm QA(c)

Pass 1: Perform search using algorithm A [4], with fl as the heuristic evaluation function. After termination with path P, set GL + M(P).

Pass 2: Perform search using algorithm R* [4] with f2 as the heuristic evaluation function and discarding all newly generated nodes with fl(n) > GL(1 f- C), E > 0.

Theorem 1. If for some choice Q * of E (C < 0), there exist a minimal cost path P* sxh that M( P * ) < Q(1 + C* ), then QA(r * ) pro&es mimimal cost solutions.

Proof. (i) Pass 1 terminates with GL = Q. This proof follows from the result by Bag&i and Mahanti [l] (also in [2]).

(ii) Pass 2 terminates with admissible solutions. Since GL = Q, there exists a minimal cost solution P* suchthatM(P*)~GL(l+~*).Inamanner similar to those in [3] and [4], we can now show that before Pass 2 terminates, there always exists a node in OPEN with f2(n) <f *(s) (because

h2( n) < h*(n)). The proof of admissibility follows from that of A* by Milsson [4]. CI

Let f, be the cost of the solution provided by QA(e) and _x be the number of nodes expanded. Then the following results clearly hold.

(i) If cl >, c2 then f,, <j&. (ii) If el >,c2 and f,, = h*(s), then NE, 2 NC, (disregarding anomalies due to tie resolutions).

4. Experimental results

We now compare the performance of QA with that of A*. The &puzzle problem is used for the experiment. The heuristic estimates are selected from [4].

h2(n) = sum of the distance that each tile is from

“ home”

(P(n) in PI) hl(n)=h2(n)+3S(n)

where S(n) = sequence score obtained by check- ing around the non-central squares in turn, allot- ting 2 for every tile not found by its proper successor and 0 for every other tile; a piece in the centre scores 1.

A total of 65 randomly generated valid start states were used. The length of th.e path and the total number of nodes generated by A * (using h2 as the estimate) and QA(c) for E: = 0,0.05, and 0.1 were determined. The total number of nodes gen-

Table 1 Comparison of performance of QA( c) and A*. d = (Average length of solution provided by QA(c))/(Average optimal solution length of A* ); IJ = (Average number of nodes expanded by QA( c))/(Average number of nodes expanded by A* )

Solution number

Samnle type

Number of samples

QA(d Pass 1 only L= 0

QA( c) both passes combined

c = 0.05 c: = 0.1

d n d n d n d n

optimal length 20 optimal length < 20 all

31 1.24 0.37 1.16 0.73 1.07 0.92 1.01 1.00

34 1.24 0.18 1.13 0.35 1.05 0.45 1.01 0.64

65 1.24 0.21 1.14 0.40 1.06 0.52 1.01 3.69

34

Page 3: Increasing search efficiency using multiple heuristics

Volume 30, Number 1 INFORMATION PROCESSING LEmERS 16 January 1989

100 m r

i t

f? w -

h

-W a- *a $Q

Y

0 O-25 0.50 o-75 1-60 t ;A&) /%A*--

(Ratio of nodes expanded by QA(c) to that of A#]

Fig. 1. Distribution of the nz;mber of samples mance relative to A *.

over perfor-

erated by QA(E) was calculated by adding those of the two passes.

It was found that Pass 1 of QA(r) terminated with minimal solutions in 31% cases. This was improved to 54% after Pass 2 with e = 0. QA(c) with Q = 0.05 yielded admissible solutions in 75% cases and E: = 0.1 in 94% cases.

Tabel 1 summarizes the average length of the solution and average number of nodes expanded by QA(E) normalized by the average values yielded by A *. It can be observed that QA( E) performs better than A* in terms of the total number of nodes generated. Moreover, the reduction in the number of nodes is significantly greater for prob- lems with larger solution lengths (that is, harder problems). I-Iowever, the quality of solution does not seem to vary with the problem size and ap- proaches the optimal solution for a reasonably small value of E. Therefore, an arbitrary choice of a small value of E should in general provide near optimal solutions which often suffice.

Figure 1 shows the distribution of the number of samples with respect to the improvement in

node expansions over A* for vmious values of c.

The x-axis is the ratio of the number cf nodes expanded by QA( E) to that of A *. The JW& gives the percentage of number of samples having a better node expansion ratio. As expected, the number of cases in which there is a significant

node reduction decreases with increasing values of E. However, QA(c) continues to outperform A* in the majority of cases even for e = 0.1. Note that, in 9% of ths cases, Pass 1 of QA(e) itself per- formed worse than A*. Also, it was observed (not shown in figure) that the percentages were closer to their respectke Pass 1 values for problems with larger solution lengths.

As expected, the performance of QA(r) in terms of node expansions degrades with increasing val- ues of C, while that with respect to solution length improves. Therefore, the choice of E should be decided by considering this trade-off; the final choice depends both on the relative importance and the problem at hand.

5. Conchsions

In order to calculate the total number of nodes generated by QA, we have added the nodes ex- panded in both passes. But if we save the search graph generated in Pass 1, then only a few extra n&es would have to be generated in Pass 2, decreasing the total number of nodes generated even further.

In cases when two heuristics are not available, a weighted cost function p= (1 - w)g + wh, 0 B w < 1, can be used to generate two evaluation func- tions from a single heuristic. If only an inadmissi- ble heuristic is available, but the proportional error h/h * is bounded above by d (d > O), the choice of any w less th;trz l/(1 + d) can be used to obtain the second evaluation function f2, which is admissible (see [2]). When only an admissible heuristic is available, then choosing w greater thm $ to obtain fl (so that the h component is given more importance seeking a better direction by forsaking admissibility) may prove fruitful.

A one-pass technique can also be used. But the

two-pass strategy is more generalised since it al- 1.0~s for extension to several passes where more

35

Page 4: Increasing search efficiency using multiple heuristics

Volume 30, Number 1 INFORMATION PROCESSING LETTERS

heuristics can be used. Normally, in Artificial References

16 January 1989

Intelligence problems, when several sources of heuristic information are available, an evaluation function is calculated by combining these heuris- tics. But the effectiveness of each individual heur- istic is often lost in combination. The approach presented here allows for utilisation of each heur- istic information separately and communication of bounding information to succeeding passes.

PI

121

[31

141

A. Bag&i and A. Mahanti, Search algorithms under differ- ent kinds of heuristics-a comparative study, J. ACM 30 (1983) 1-21. R. Dechter and J. Pearl, Generalised best-first search strategies and the optimality of A*, J. ACM 32 (1985) 505436. N.J. Nilsson, Problem Solving in Arrificial Intelligence (MC- Graw-Hill, New York, 1971). N.J. Nilsson, Principles of Artificial Intelligence (Tioga, Palo Alto, CA, 1980).