Search with Fuzzy Numbers 1 Fuzzy Numbers - CiteSeerX

2 downloads 15 Views 204KB Size Report
numbers). First results and experiences in using this search algorithm in a chess ... show why the use of fuzzy numbers makes sense .... -5 -4 -3 -2 -1 0 1 2 3 4 5.

Search with Fuzzy Numbers Christian Postho Dept. of Mathematics and Computer Science University of The West Indies St. Augustine TRINIDAD & TOBAGO E-mail: [email protected] Michael Schlosser Dept. of Computer Science Chemnitz-Zwickau University of Technology D-09107 Chemnitz GERMANY E-mail: [email protected] 

Andreas Junghanns University of Alberta Dept. of Computing Science Edmonton/AB CANADA T6G 2H1 Email: [email protected]


The application of knowledge which can be considered only incompletely and imprecisely and the combination of this knowledge by means of evaluation functions results in uncertain values. In many search algorithms, this uncertainty simply is ignored by using only the resulting (crisp) value. It is assumed that the consideration of this uncertainty in search algorithms will give better results. The paper presents methods and an application which allow to represent and to process uncertainty and imprecision. A new application of fuzzy numbers in relation to search algorithms and heuristics is proposed. The evaluation functions do not supply a simple crisp value, but a fuzzy number representing the uncertainty of the evaluation of the problem state. The consequences of applying fuzzy numbers for search algorithms are discussed (a new back-up paradigm, new priority relations between alternative possibilities evaluated by fuzzy numbers). First results and experiences in using this search algorithm in a chess program are nally given.

 This paper has been supported in part by the German Ministry for Research and Technology (BMFT) within the joint project (BMFT-Verbundprojekt)GOSLER under grant no. 01 IW 101 C.

1 Fuzzy Numbers The Fuzzy-Set-Theory was developed by Zadeh to primarily express linguistical fuzziness. First we will show why the use of fuzzy numbers makes sense within the domain of search supported by heuristics. To guess the height of somebody standing beside a car, one could possibly think as follows: A car is about 1.5 m high and the man is about 25 cm taller than the car. Therefore the man is about 1.75 m tall. Most of this thinking will usually be done unconsciously, some rule of thumb might be applied. If this guessing would be told to another person, like: There was a man, about 1.75 m tall: : : the person would surely infer, that the height might be more or less than 1.75 m, but would never bet on it. The knowledge we use within evaluation functions is like this rules of thumb and most of the so-called \intelligent" guesses of programmers are nothing else than the attempt to press unconscious (thinking) processes into rules. This can work very well. Scientists have found many procedures to obtain knowledge we can rely on, but one problem remains: The knowledge we have can fail in some (hopefully very rare) cases, leading to wrong estimation of problem states or to misguidance of the search. The estimation problems have their roots in special features of the problem states in question. We can say, that the evaluation

of problem states with certain properties produces uncertain values. Like the person who is told the guessed height of the man we should not bet on this uncertain values. Estimation problems are avoided in conventional computer chess programs by applying quiescence search. The quiescence search is an attempt to let the evaluation function evaluate just those problem states, that do not have such unstable features. This (coward) way of avoidance is one possible way to cope with the problem. The second way is to calculate with this uncertainty. In everyday life guessing is often connected with additional comments, telling something about the quality of the estimation. The di erence between \He is exactly 1.75 m tall." and \He is about 6 foot tall." is just the notion of how exact we know the height of the man. If we can nd a way to estimate the possible deviation of the real value (\delphic value") given by an oracle (in our example just a tape measure) to the guess the evaluation made, we could express the uncertainty mathematically. We should now have a look at fuzzy numbers. Since the amount of theory is overwhelming, we will concentrate on the part we need. A fuzzy number is theoretically a membership function. The function represents the membership grade of x (any number) to the notion f (e. g. \about y", \at least t" or \nearly z"). The membership grades lay in [0,1]. For reasons of computability we use a parameter representation. Figure 1 shows examples of fuzzy numbers. One can see, that three parameters are necessary to represent a fuzzy number x~: 1. the realistic value x, 2. the pessimistic value x and 3. the optimistic value x . 1



?A ? A ? A ? A ? A ? A x x x


Fuzzy theory describes how to calculate with the kind of numbers represented above. We will present here just the operations we will need in the later discussion: maximum and negation of fuzzy numbers.

2.1 Maximum of Fuzzy Numbers 1

0 1

0 1

B  B  B  B  B  B y y y



~3 ~4

Z? ? ZJJ  ? Z ? ? Z J ? ?  Z J ? JZZ ?  J Z



?J ? J ? J  = max(~ 3 ; ~4Z) Z  Z Z 






max(~ ~4) @  3 ;





0 1 2 3 4 5 6 7 8 9 10 

0 1 2 3 4 5 6 7 8 9 10 

0 1 2 3 4 5 6 7 8 9 10

Figure 2: Maximum operation with two fuzzy numbers



The realistic value is (generally) the value which the conventional evaluation function returns1 . The See [Jun94] for explanation!

2 Operators for Fuzzy Numbers


Figure 1: Examples for fuzzy numbers, the sharp number (~z ) is a special case of this concept


lower or pessimistic value and the upper or optimistic value have to be estimated additionally. The chosen representation allows the expression of almost all notions one can use in everyday conversation.

Figure 2 shows how to compute the maximum of two fuzzy numbers. As is to be seen we have to approximate the result to press it again into the parameter form, because fuzzy numbers (better: their membership functions) are not closed with respect to the maximum operation shown here. Mathematically expressed: ~ N) ~ = max((m; m ; m ); (n; n ; n )) max(M;  (max(m; n); max(m ; n ); max(m ; n ))

2.2 Negation of Fuzzy Numbers y~ x~ 1  S

? ?

? ?


S  S



C  C


@ @

@ @-

-5 -4 -3 -2 -1 0 1 2 3 4 5 Figure 3: Negation of two fuzzy numbers


Figure 3 shows how to negate fuzzy numbers, no approximation is necessary.

M~ = (m; m ; m ) = (?m; ?m ; ?m ) The easy computation because of the parameter representation is obvious.

3 Search with Fuzzy Numbers If we use fuzzy numbers within search algorithms we have to consider some consequences. 1. To get fuzzy numbers we have to change the evaluation function. 2. Values for nonleaf nodes have to be calculated in a di erent way than the conventional simple min/max operation (because the sons are evaluated with fuzzy numbers). 3. The old \best"-criterion (min/max) for the move selection is not suitable any more for fuzzy numbers, because of the nontrivial cases of overlapping membership functions of fuzzy numbers2. 4. Backward-Pruning, one of the most powerful enhancements used by alpha-beta, has to be modi ed.

3.1 A New Evaluation Function

While conventional evaluators produce just one (sharp) number, we need here three parameters representing the fuzzy number. As earlier mentioned the realistic value is nearly the result of former evaluation functions. We need additional (domaindependent) knowledge to estimate the pessimistic and optimistic parameters of the fuzzy number. 2

See later section!

We are aware of some features of chess positions that make the usual kind of static evaluation functions more or less unreliable. We call them unclear features, as proposed in [Hor87]. These are (among others):  attacked,  pinned or  trapped pieces,  king safety and  passed pawns. Normal knowledge acquisition techniques are useful to compose new heuristics for guessing the optimistic and pessimistic values of the fuzzy number, but this will not be our concern here in this paper. Conventional evaluation functions usually use features like those given above while evaluating problem states and add bonus and subtract penalty points for encountered good or bad properties, respectively. This way, positive and negative uncertainty may delete each other.

3.2 A New Back-Up Paradigm

Because the evaluation of internal (nonleaf) nodes is calculated by the values of their sons and these values are no longer normal, but fuzzy numbers, we need a new way of calculating the values of internal nodes. We propose the maximum operation for fuzzy numbers as given in the theory. The realistic, pessimistic and optimistic value of the internal node is the maximum of the realistic, pessimistic and optimistic values of all its sons, respectively.

3.3 A New Move Selection Criterion

The upper diagram in gure 4 shows the problems while choosing the \best" among several alternative moves evaluated with fuzzy numbers. We propose an optimist/pessimist consideration for choosing among alternatives and model this behavior by applying the term of \risk"3. An absolute optimist is acting/playing with full risk, ignoring the chance of a bad result, whereas the pessimist will always assume the worst. We propose to model \risk" as a (real) number in the range from 0 to 1, 0 means no risk at all (pessimist) and 1 means full risk (optimist). Back to gure 4: We have now a criterion to choose among the possible alternatives given by

3 For earlier discussion of the term \risk" in connection with search see [Hor87].



A~ "B~ "C~

@" B B "" " " B" @ B " " @B " " B " " B [email protected] " "  " " B B @ " "  B B @

- X 0 1 2 3 4 5 6 7 8 9 10 1risk 0:83 e B~ C~ 0:23 (( A~ - X 0 0 1 2 3 4 5 6 7 8 9 10 point of reference 8 6 7 B~ 6 C~ 5 4 bb A~ 3 2 1 0 risk 0 0:23 0:831

Figure 4: Example for using \risk" as a move selection criterion their fuzzy numbers. The extreme optimist (risk=1) will make move B, because move B is most promising, the possibly biggest loss is completely ignored. The extreme pessimist (risk=0) will choose move A, since move A has the best pessimistic value - if each move will actually turn out to be the worst the evaluator predicted (their pessimistic value), move A will really be the best one to choose. How about those who are not just optimistic or pessimistic, but calculating with certain amount of risk, say 0.75 or 0.5? We need points of reference for each fuzzy number to decide whether a number is greater than another. The discussion about the two extreme points of view gave us intuitively the reference points for the optimist (the optimistic value) and the pessimist (the pessimistic value). Figure 5 gives an example of a function for mapping a certain risk with the corresponding reference point of a fuzzy number. We considered the scaled integral above the membership function of the fuzzy number as an

, risk 1 R

ZZ 2 A(x)dx

0:7 Z m ?m

Z m?m 0:5 Z (x)

A m ?m Z

Z 0:15 Z

- X 0 0 1 2 3 4 5 6 7 8 m m m ref (0:15) ref (0:5) ref (0:7)

Figure 5: Scaled integral above the fuzzy number as mapping function adequate function. The extreme cases (optimist/pessimist) are enclosed as discussed above. Figure 4 gives an example of how the acceptance of a certain risk will a ect the move selection. Each of the three moves is under special circumstances a good choice. The pessimist who wants to take a risk of less than 0:23 will choose move (position) A. The optimist, taking a risk greater than 0:83, will choose the move leading to position B. All others will make move C.

3.4 Determination of Risk

As stated in [Hor87] the global situation of the game in uences the will to take a risk4 . The more advantage a player has the less risk he is willing to take. Whereas the disadvantaged player will take a risk according to the severity of the global situation of the game to turn the fate. Figure 6 shows two possible functions for calculating the risk from the advantage/disadvantage the player has. risk 1 0.5 -

-4 -3 -2 -1 0 advantage 1 2 3(in pawns) 4 risk 1 PP PP PP 0.5 PPP -4 -3 -2 -1 0



1 2 3(in pawns) 4 advantage

Figure 6: Example functions to determine risk 4 The application of risk there is somewhat di erent from the one we propose here.

3.5 A New Backward-Pruning Criterion

Since backward pruning is one of the most important improvements of the classical minimax algorithm, we should pay attention to this concept with respect to fuzzy numbers in order not to loose the eciency gain connected with it. The basic idea of backward pruning is, that special parts of game trees do not in uence the value of the root node. Therefore we have to be assured, that there is no in uence from the subtree in question. Because each node has three parameters, there are three ways to e ect the root value we have to check. If all three parameters can not change the corresponding parameter of the root node, we can prune the subtree. As proposed in section 3.2, each parameter is independently maximized as done in the conventional minimax algorithm. We see, that conventional pruning techniques, like alpha/beta-variables, can be applied independently from the other parameters. This leads directly to the conclusion, that we have to extend the alpha/beta-variables to fuzzy numbers and if all three corresponding parameters of the fuzzy numbers (alpha or beta and the value of the node currently under consideration) ful l the conventional pruning criteria, we can omit the subtree(s) in question.

arguments can now be made for each parameter: Because C is a minimum node the parameters can become only smaller than they are now (after examining node G). Since the root is a maximum node and all parameters of node C are already smaller than the corresponding parameters of the root node, there is no way G can in uence the value at the root node. If node F had an optimistic value greater than 4 (which is the optimistic value of alpha at node C), than node G would have to be examined. This is exactly the same consideration of classical backward pruning, but extended to all three parameters. One problem arising here is, that fewer cuto s can be made, because the cuto criterion is harder. Recent tests, made by the rst author, suggest however, that the gain of the better move selection more than just compensates this e ect. Because there are many possible ways of tuning this approach, there is hope to do even better.

4 Examples

The former sections presented general tools for handling fuzzy numbers in search. They will serve for extending (nearly) any search algorithm by the concept of uncertainty connected with the evaluation of a problem state. A major portion of the work reported here was in implementing the chess program \CHESSITZ". Its  straightforward implementation could not produce 1 B world class speed, but was still a useful tool to test 0 2 B4 6 8 10- X the ideas shown above. The classical alpha-beta was implemented rst   MAX ) A b " b " and then extended by the above discussed concept 1 1 b " B B b " of fuzzy numbers. 0 2 B4 6 8 10-X#B ( MIN ) Cb0 2 B 4 6 8 10- X The evaluation function used (the one proposed E  bb by Hartmann in [Har87]) was extended to guess the #  b E   D# G uncertainty as described above and to return a fuzzy  E 1 1  number. E A ?  The actual features used in this function are E A  X 0 2 4 6 8 10 0 2 4 6 8 10- X E   E  F  attacked pieces, 1 1 B B  king safety and 0 2 B4 6 8 10-X 0 2 B 4 6 8 10- X  passed pawns. Figure 7: Example for backward-pruning at node C They were designed in a rough and simple way. There is no claim being made, that the function Nevertheless the later discussed examFigure 7 shows an example. Node G is not rel- ispleswellwillbuilt. show, evant for the value of the root node. Why? Alpha works well5. that even this probably bad function has the value (1,3,4) when the algorithm visits node numbers presented here correspond with the numC. After examining node F node C gets the value bersThe in the original paper - newer versions of \CHESSITZ" (0,2,3). Each of the parameters of node C is less will give slightly di erent results because of debugging and than (or equal to) the corresponding parameter of tuning. For description of the new function please refer to alpha (0 < 1 and 2 < 3 and 3 < 4). Conventional the original paper [Jun94]!

j k j j j j j


4.1 1st Example

The following example is taken from [Sue79] (pg. 113) and is called there a \wild position". The game was played between Averbakh and Goldenov in Minsk 1952. 1

               ?  

White to move Because there is no possibility to express the property of \wildness" with a single number, the conventional alpha-beta will not be aware of the highly unclear situation. Additional quiescence search is necessary to clear the situation. This will cost computation and under time pressure or far from the root will probably omitted, resulting in the back-up of an uncertain value. This position might serve as an example for the above mentioned e ect of mutual deletion of bonus and penalty points in conventional evaluators leading to an incorrect estimate. On the other hand the fuzzy evaluator returns (-492,-42,458). This fuzzy number tells the algorithm about the evaluation problem(s).

4.2 2nd Example

evaluator returns (-835,15,315). This takes the possible pawn promotion into account (-835) and considers the possible capture of the black bishop (315).

4.3 3rd Example

This example is intended to show how the actual search deals with the uncertainty (see gure 8). The example is a position which occurred during the analysis of the position 101 from [Rei58]. The propagation is done in a negamax-like way. The rst level is not of great importance, but to show the trivial case of move selection. The move selection decision of the algorithm at node 10 is much more interesting6 . How would classical alpha-beta decide? It would choose \black pawn g7-g5", because -127 is the greatest of the realistic values of all fuzzy numbers, with which the classical alpha-beta had to decide clearly wrong as we know. The vague hope (the successful promotion is not yet within the horizon of the search) for promotion of the pawn that is backed up in the number 484 (optimistic value of node 21) raises the reference point well above the -127 of node 20. Black is down by two pawns. This causes the desire to take a risk of 0.76, which is high, but we feel it is adequate. This will make black's play if it had a sense for hope - black hopes to promote the pawn to turn the fate, risking an even worse position, because the pessimistic value of node 21 (the actual chosen) is with -190 more than half a pawn equivalent worse than -127, the pessimistic value of node 20.

The next chess position will give an example for how \classically" the classical evaluation function fails. This position is taken from [Hor87] where it serves the same purpose and is originally an analysis of the position 101 from [Rei58]. 2

  ?   ?        

White to move While the conventional static evaluation function will return 48 (100 is the equivalent of one pawn), which considers white nearly half a pawn up, we can easily see, that white's material advantage does not mean anything. The new created fuzzy

6 Supposed the search would start there and had the same information as given in the gure.


  ?     ?    S S

                              legend: #

[risk] m m m reference point [stat.evaluation]



Rd1-f1: 0,76 10 127 -484 127 -184 S S 





S Kh1-g2 S 11 S



-1387 -1412 -1387 -1399 @@ : : : @@

S kg8-h8 pe4-e3 0,2233 SS 22 20 21 -127 -162 -31997 -127 -127 -190 484 -31997 -31997 H    S HH @ ? -127 HH -31997   159 S @ ?  : : : @@ ::: S HH  ? :::  ?  

Kh1-g2   31 




Ph2-h4 HH Rf1-c1 HH S  0,67 30 S 33  H 34 158 162 63 147 15 -592 158 -603 162 -484 63 -619 190 -484 15 H   -237 ? -241 S HH  -225 -246 @@ -248 LL  H ?  S   H ::: : : : LL : : : @@ ::: S HH ? :::    ? 

bc3-f6  pg7-g5    40 41   -63 -78 -63 -63 -78 -78 -63 -78

Rf1-f3 32

pe3-e2 42 -128 -428 484 +54 (-672,128,428)



pg7-g6 HH ph7-h5 HH S 43 S H 44 -86 -98 -86 -86 -98 -98 -86 -98

Figure 8: Chess position with critical part of the search tree

5 Remarks Up to now we discussed the way to model uncertainty. But we can furthermore try to use the knowledge about the uncertainty to remove it. After evaluating the problem state we know how reliable the estimation is. The algorithm can decide at this point whether to extend the search (all sons or selectively, as quiescence search does) to remove the uncertainty or not. This decision could be done with respect to search depth and/or the remaining time. One can think of omitting the removal of uncertainty during the rst iterations to save time with the hope that the uncertainty will disappear while it is backed up in the game tree because better alternatives have shown up with less or even without uncertainty. But even if no further search will be done, the algorithm will take the uncertainty into account while the move selection is done, if the uncertainty will reach this layer of nodes in the game tree. Because the removal of uncertainty costs e ort, the knowledge about uncertainty, given in the parameters of the fuzzy number, could be used to estimate the computational e ort connected with the evaluation of this subtree. Those estimates may serve for work distribution algorithms, leading to better work balances and less communication between processes. There is a wide eld for further research.

6 Conclusion And Future Work In this paper the general usefulness of fuzzy numbers to express uncertainty was shown. Although this attempt is very new, the results are promising. The advantage of this model lies in the low computational costs due to the parameter representation of the fuzzy numbers, without loosing expressiveness. One major disadvantage is that more domaindependent knowledge is necessary. The obvious fact that the uncertainty of the evaluation depends on the evaluation itself makes it even worse. Future work has to be done at least on the following topics:  nding good heuristics for guessing the uncertainty connected with the evaluation of a problem state,  application of machine learning to the problem of uncertainty,  nding dependencies between evaluation function (to estimate the realistic value) and the

evaluation of the uncertainty,  application of fuzzy numbers within parallelization,  up to now just sharp operations (though with approximation) where used, one could try to nd fuzzy operations to model ideas like opponent model search (e.g. preferring positions that have fewer good responses for the opponent),  the whole problem of risk has to be worked on further in order to make this concept applicable for other than the domain of games,  extend other search algorithms by the concept of fuzzy numbers,  development of methods to guide the search using the knowledge given in the fuzzy numbers. We hope that this method will not be just one more academic method without life and application. Only further research and application will show the value and usefulness of the concept of fuzzy numbers in search.

References [Har87] D. Hartmann. Notions of evaluation functions tested against grandmaster games. In D. F. Beal, editor, Advances in Computer Chess 5, Leiden, The Netherlands, 1987. [Hor87] H. Horacek. Reasoning with uncertainty. In D.F. Beal, editor, Advances in Computer Chess 5, Noortwijkhoot, The Netherlands, 1987. [Jun94] A. Junghanns. Methoden zur Verbesserung von Suchalgorithmen. Master's thesis, Technische Universitat Chemnitz-Zwickau, Chemnitz, 1994. [Rei58] F. Reinfeld. Win at Chess. Dover Books, 1958. [Sue79] A. Suetin. Schachlehrbuch fur Fortgeschrittene. Sportverlag Berlin, 1979.