Interactive machine acquisition of a fuzzy spatial relation

Interactive machine acquisition of a fuzzy spatial relation

Computers & Geosciences Vol. 16, No. 6, pp. 857-872. 1990 Pnnted in Great Britain. All rights reserved 0098-3004 90 $3.00 + 0.00 Copyright ~ 1990 Per...

881KB Sizes 18 Downloads 95 Views

Computers & Geosciences Vol. 16, No. 6, pp. 857-872. 1990 Pnnted in Great Britain. All rights reserved

0098-3004 90 $3.00 + 0.00 Copyright ~ 1990 Pergamon Press pie

INTERACTIVE MACHINE ACQUISITION OF A FUZZY SPATIAL RELATION VINCENT B. ROBINSON Institute for Land Information Management and Centre for Surveying Science, University of Toronto. Erindale College. Mississauga, Ontario. Canada L5L IC6 (Received 6 February 1990)

Abstract--The modeling of spatial relations is fundamental to the development of intelligent geographical information systems for applications in the geosciences. However, some spatial relations have an inherent fuzziness about them that is dit~cult to formalize. This paper presents a method and program for machine acquisition of fuzzy base relation near. Techniques from artificial intelligence such as adaptive parameter adjustment, generate and test, and heuristic search are used in a program to interrogate a user and construct a fuzzy base relation. Base spatial relations acquired through this program can be used subsequently to populate the knowledge base of a fuzzy knowledge-based system and provide more realistic answers to geographical queries, Key Words: Natural language, Spatial terms, Nearness, C language, Fuzzy sets,

INTRODUCTION Modeling spatial relations is of fundamental importance in the development of intelligent geographical information systems (Robinson, Frank, and Karimi, 1987). It also has been of some interest in the area of artificial intelligence. Freeman (1973) discussed several fundamental issues in the modeling of spatial relations. Some spatial relations were incorporated as linguistic terms in an experimental database constructed to illustrate Warren and Pereira's (1982) natural language question answering system, CHAT80. Similarly, Pereira, Sabatier, and de Oliveira (1982) developed ORBI as an expert system for environmental evaluation through natural language (Pereira, Sabatier, and de Oliveira, 1982) that used some spatial relations as linguistic terms. In addition to attempts at natural language approaches, a number of spatial query languages have been developed that are similar to Chamberlin and Boyce's (1974) SEQUEL (e.g. Frank, 1982; Barrera and Buchmann, 1981). There are other systems such as the Map Analysis Package (Tomlin and Tomlin, 1981) that uses a subset of the English language to pass commands to a geographic information system. However, in most systems the meaning of each command must be unambiguous. Thus, they are limited in their ability to represent the approximate nature of some spatial relations such as near. Some spatial relations have an inherent fuzziness about them that is difficult, if not impossible, to specify. One of those spatial relations is near. Denofsky (1976) recognized the problem of specifying the concepts of near and far. Rather than attempt to represent the fuzziness of terms such as near and f a r , two alternative approaches may be used. One is

to rely on the user to unambiguously specify the meaning of a spatial relation. Another approach is to provide an arbitrary definition of relations. However, these may not be responsive to the meaning desired on the part of the user of geographical information systems. This paper reports on another approach, one that attempts to preserve the approximate representation of near and acquire it through machine interrogation of a user. Robinson, Blaze, and Thongs (1986a; 1986b) have discussed the problem of approximate representations of spatial relations such as near in P R U F (Possibilistic Relational Uniform Fuzzy) and testscore semantics (Zadeh, 1978, 1981). Many of the ideas on fuzzy logic inference contained in PRUF, test-score semantics, and work of Baldwin and others (Baldwin, 1986; Baldwin and Pilsworth, 1980; Baldwin and Zhou, 1984) have been incorporated in a general fuzzy relational inference language (FRIL). Basic to these frameworks is the theory of fuzzy subsets. Fundamental to fuzzy subset theory (Zadeh, 1965; Kaufmann, 1975) is the concept of a fuzzy subset defined as

A = t,,~(x)/x

(I)

where A is a fuzzy subset in universe of discourse U and/z~ : U - - . M is a membership function that takes on values in an ordered set M called the membership set and/~a(x) indicates the grade of membership of x in A. For example, let U = [0, oo] be the universe of discourse and x being the base variable distance, then the membership function of short may be expressed as

857

short =

exp(-flx/x),

B> 0

(2)

858

V . B . ROBINSON

which can be thought of as corresponding to "not" A. 1.0

0.5

Definition 2. The intersection of fuzzy subsets A and B

~ j short 9

A n B = ~" [~.~(x) ^ l~8(x)]/x ,)t = ft, min[/t~ (x),/.ta(x)]/x

,15

Figure 1. Idealized example of fuzzy membership function for short. where for each of the distances in U there is a grade of membership. The negative exponential function assigns small values of x high grades of membership in short set whereas large values of x are assigned small values reflecting low grades of membership. The constant /~ is derived empirically and serves to calibrate the meaning of short. Say that U = [0, 9, 25, 32, 45], then the fuzzy subset short may be expressed as 5

short = ~ /t(.~.'i)/x, = I/0 + 0.5/9

+ 0.3/25 + 0.1/32 + 0/45.

(3)

Figure I illustrates how one might depict the fuzzy subset short. As in set theory, there are several basic operations that can be performed on fuzzy subsets. Some are important to the methodology used to acquire a fuzzy representation of a spatial relation. Among the operations relevant to the methodology are the complement, intersection and union, which are defined as: Detinition 1. The complement of fuzzy subset A

A = f [I - l~., (x)l/x. ,/t/

(4)

(5a) (5b)

which corresponds to the connective "and". Definition 3. The union of A and B A wB = f

[ll•(x) v ,us(x)]/x

= [ ' max[ll~(x),/~8(x)],'x

(6a) (6b)

which corresponds to the connective "'or". Baldwin and Zhou (1984; Baldwin, 1986) describe a general query language that uses fuzzy base relations. Fuzzy Relational Inference Language (FRIL) was developed in the context of a general fuzzy knowledge-base system (FKBS) with deductive capabilities. Their FKBS consists of three main parts as in Figure 2. The user acquires information from the system by asking questions through the query language. Queries are sent via the user interface to the base relation problem generator. This is part of the management unit and translates the query into a problem specification, containing base relations only, suitable for the automatic reasoning unit. The translation involves determining all rules and facts relevant to answering the query and transforming this set into basic relations and indicating the solution required. A base relation is a table of facts described later. The problem specification in terms of base Fuzzy Knowledgebase Management Unit

Automatic Fuzzy Reasoning Unit

Figure 2. Main components of fuzzy knowledge-base system (after Baldwin and Zhou, 1984).

Interactive machine acquisition of a fuzzy spatial relation relations and the solution required, or goal, is sent to the reasoning unit for automatic processing. This inferencing procedure returns the solution to the user (Baldwin and Zhou, 1984). The relational model is a convenient tool for describing data and their relationships. Robinson (1988) has discussed some of the implications of fuzzy relational database concepts for geographic databases, but did not explicitly detail how such base relations might be used to represent fuzzy spatial relations. In the relational model, the relation R ( A . B) is defined as a subset of the product space of domains D~ x Ds where A and B are attributes and D.(. Ds domains from which values of the attributes are selected. This definition of the relation can be extended to the fuzzy relation situation by letting R be a fuzzy subset of D.4 x Da. Thus, the fuzzy relation R(A~, A: . . . . . A,,) where A, are attributes is defined by the mapping pR:DtxD:x...xD,,--,U,

computer selects a question unit (QU) out of units of (9 based on a selection criteria and asks the user whether x, belongs to C(x, ~ C) or not (x, ¢ C). The user answers yes or no. Let Fk_ t denote the learned concept of the computer just before the kth Q/A step. When reply of the user to the kth question of whether x, belongs to set C is yes, the computer constructs F ( x ) in its knowledge space 19. As a result of the k th Q/A step, learned concept C,_ t is changed to C, given by c~ = c ~ _ , u r .

METHOD

The method described here is designed for the problem of determining the meaning of a spatial relation such as near using some base variable such as distance. The general methodology uses a questionanswering approach suggested by Nakamura and lwai (1982). In this question-answering scheme it is assumed that 19 is the computer's universe of discourse on a base variable and ~ the user's universe of discourse. The concept to be learned is denoted as C. The computer learns C through a process of question and answer (Q/A) by constructing fuzzy set F, the learned concept, which is a replica of C in 19. The

Ck = C k _ t m - a r .

X, douglas douglas douglas douglas douglas

F(x) = exp(--ccdk~) where st > 0,

(9)

and 7r(x)

= I - r(x)

(10)

where dk~ is the distance of x k from x,. In the described specification the parameter a determines the spread of both functions. The parameter a is adaptive. Initially c~ = In(0.2)/max(dk~)

(I I)

thus those locations farthest from location ~c would be assigned a membership value of 0.2 and those in between will range from 0.2 to 1.0 depending upon the value of the base variable (i.e. distance). During the process ~ is adaptively changed such that = ~no, In(0.50)/dk~ ~k

(yes, In(0.85)/dk~'

(12)

Equation (12) has the effect of drawing an analogy between the "nearness" or "not nearness" ofxk to the key location and those locations similar distances from xk. In Equation (12), if x~ is closer than the previous yes-related x~ then the previous value is used. Thus, the spread of the membership function, as in Equation (9), resulting from an affirmative response is never constricted. To allow for previous

Xk cordele nicholls alma sycamore baxley

0.32 0.73 0.56

ocilla

0.06

0,44

0.05

! douglas

(8)

As an initial approximation, F ( x ) and - a F ( x ) are assumed to be defined as

Table I. Table form of example base relation NEAR(x~,xk) where x is reference location, or key, and xk are locations in relation to reference location NEAR(x,. x~)

(7)

When the reply is no, -1F is developed in knowledge space 19 and constructs C~ from Ck_t using "-aF where

U = [0, 1],

where D, is the domain of possible values of A~. The order of the rows is unimportant. Each row consists of an n-tuple t = (a t , a,. . . . . . a,,) and a membership level l~(t) denoting the degree to which the t satisfies the relation or is compatible with the relation. Thus, a simple spatial relation such as NEAR might be represented as a base relation in the form illustrated in Table I. The problem which this work is directed towards is the acquisition of the IL(t)s for the relation NEAR(x~,x~) where x~ is the reference, or key, location such as douglas in Table I and x, being those locations being related as near to x~ in NEAR(x~, xk).

859

860

V.B. Rom.~so~

answers let x, be the kth QU and x/a QU used before the kth step. If xs exists in the neighborhood of x, in knowledge space O, and the reply to x, is opposite to x: then SRAS supposes that the boundary of user's concept exists between x~ and xs. Thus, the value of = is increased; that is l'(x) is made narrow so F(xj) becomes below (or above) a prescribed value ¢(or 1 -~). Before the next Q/A step -, is set to :q. Each place other than the reference location (x,) is considered to be a candidate as a question unit. Candidates for the kth question unit are limited to those units whose /a > 0.1, have not been used previously as a question unit, and have not been in close proximity to another question unit. It is desirable that QU's be selected so as to conform learned concept C~ to the user's concept of interest C in knowledge space ,--. In order to decide on the appropriate QU, a measure of the fuzziness of a fuzzy concept is used. In previous studies (e.g. Robinson and Wong, 1987) an information theoretic measure (De Luca and Termini, 1972). lk=-~

(/~,In/a,)+[(l.O--/~,)ln(I.O-/,,)]

(13)

i-I

w h i c h takes on the value o f 0 i f / t , = 0 o r ll, = 1 for

all i, was used to measure the fuzziness of the concept. An approximate correspondence between I~ and Kaufmann's index of fuzziness was supported by comparing their behavior during an extensive suite of simulations (e.g. Robinson, Blaze, and Thongs, 1986a). Kaufmann's index of fuzziness also is used as a criteria for stopping the process of concept acquisition, therefore using it as a measure of concept fuzziness makes the criterion for selecting questions consistent with the criterion for determining when the process should terminate. The index of fuzziness suggested by Kaufmann (1975) is defined as =

1, (x,)Jj~

(14)

where S is any ordinary subset in O, O # is the number of units in O, /ak°(x,) is the membership function of fuzzy set C~ and/a'(x,) is the characteristic function of ordinary set S. 14 is a normalized distance in O # dimensional space between Ck and ordinary s e t / : c ( ~ { S } ) nearest to Ck, and does not exceed !.0. Now consider that d(x~) is the projection of an Euclidean distance between Ck and SCk onto the i axis:

d(x,)

= ,uC(x,) - ~SC(x,).

I~ indicates how strongly correlated the fuzzy subset representation is with a crisp, or regular, subset representation (see Fig. 3). The index gives us an indication of how closely the fuzzy concept fits a "crisp", or nonfuzzy, representation. When I~ = 0 then there no longer exists a difference between the fuzzy concept and the crisp concept. Let l y ~ and I,o~) be the measures of fuzziness for the fuzzy sets given by Equation (7) and (8) respectively, lr~k) corresponds to the fuzziness of concept C~ in the kth Q/A step if the user replies yes. !,,~ corresponds to the fuzziness associated with concept Ck in the kth Q/A step if the user replies no. So, let E(lk) be the expectation of I~ which is given by

E(I~) = [71y~,~k,+ r/l,,o,k,]

(I 7)

where ~, and q are weights that reflect the relative likelihood a response will be either yes or no. In this process 7=exp(-2zcd,~)

and

tl=l.0-7

(18)

which has the effect of weighting the average expected fuzziness as a function of the distance from the reference location. This is more consistent with the manner users weight their expectations than simple averaging. That is to say, those closer to x~ have greater 7 and lesser r/ than those farther from x,. E(I,) is calculated only with respect to each candidate unit. Thus, the optimal question unit for kth Q/A step is that which maximizcs{lk- i - E(Ik)}.

(19)

Consider an example where lk_ i is 0.58. E(I,) is calculated for each of three question unit candidates, xl, x2, xj. Say that E(Ik) for Xl = 0.51, x: = 0.53, and x~ = 0.47. The candidate x3 is selected as the next question unit because (0.58 - 0.47) maximizes

{t~_, - E(/~)}.

p.Ck

Crisp Set J

I [O

[H.SCk = 1.0 0.5

I

(15)

The value of d(x,) is a measure of fuzziness of x, with respect to membership in Ck. The definition of SC, is determined by following rules

ltsC(x,) = 0.0 for/aC(x,) < 0.5

(16a) xi

and

l~sC(x,) = 1.0 for/aC(x~) >/0.5.

(16b)

Figure 3. Relationship between crisp subset and fuzzy subset in Kaufmann's index of fuzziness.

Interactive machine acquisition of a fuzzy spatial relation

/

NEAR(x~xk)

/

861

lanoaf

x~

xk

x~ xK

x1 x~

0.41

x~

x3

0.39

xK

xn

012~

0.09

Figure 4. Relationship between fuzzy membership function, locations, and fuzzy base relation. A stopping rule is used to determine when the process should conclude. It is assumed that the computer has accomplished learning the user's concept C when the lk falls under a prescribed value, say p. The computer finishes when /k becomes less than some specified value p. Because I k = 1.0 when there is maximum fuzziness, p is usually set such that 0.3 ~< p ~<0.7. The process stops at step k, where for the first time the relation < p.

(20)

is satisfied. The result is a base relation NEAR(x~, x k) illustrated in Figure 4.

TIlE PROGRAM

A demonstration program [Spatial Relations Acquisition Station (SRAS)] for acquiring the fuzzy spatial relation NEAR is provided in Appendix I. The demonstration version of the program is written in Borland International's Turbo C. It requires the BGI files as SRAS makes use of the builtin graphics functions of Turbo C. Another version of SRAS has been implemented on a Sun 4/110 which exploits the multiwindow, color graphics capabilities of the Unix workstation. In Appendix 2 is a sample data set of cities taken from the Waycross, Georgia USGS I : 250,000 map sheet. The reference location is Douglas, Georgia. There are 29 cities in the data set, each with the city name and associated coordinate pair. Much of the discussion of the program refers to this data set. SRAS first greets the user and asks for the user's initials (Fig. 5). The data set then is read by readdb().

The input data file name is assumed to be data. The number of entries other than references location (x,) and the reference location data are read first. This function also determines the maximum x/y coordinates of the data and makes quadrant assignments. Assigning cities in the data set to quadrants is tantamount to dividing the search space into four regions with only one region at a time subject to the search for a suitable question unit. This has the advantage of reducing the amount of time and computation needed to select each question unit. There is another advantage to dividing the search space in this manner. By rotating legal quadrant assignments, question units are distributed about the search space rather than possibly being clustered in one area (Fig. 6). The next several functions are concerned with setting up the necessary distances and parameters to begin the process. In the function Iocdst distances (d,k) between the cities are calculated and held in matrix Iocdistlillkl. The function calcd accomplishes several things. It is where distances between cities and the reference location (dk~) and the initial ~t are

WELCOME

I am SRAS. a Spatial Relations Acquisition Station What are your initials ? [ ~

Figure 5. Greeting which initiates session with SRAS.

V.B. Rom.~sor~

862

quadrant I

qu~ qu=2

~ R ~ e

0 "" rsnc8

LocationII

lqu

qu

•N•

0

Selecting the Next Qu~tam: ~ s LsWhat I am "l~nkin$ Currem I..¢velof FuzzincM: 0.57Z714 F~.~r~u Goal: 0.40~00

- 5~

Current Best Choice

City: nicholls

Furrtm,u: 0.528919 Evtlmttion of Candidate Qucla~ou

City: a/nut Expected Fuzzitleli_Yea: Expected Fuzzu~u No:

0~-1

Weighted Expected Average Fuzziness:

~

0.506714 0.625827 0..542872

Figure 8. Feedback provided to user during equation selection process.

qu=4

- 3

quadrant2

search is incremented. Should no eligible question units be located qdrnt will inform the user that the session has come to an end for lack of further questions. Before starting the question selection search process, frame__select clears the screen and provides an information frame that provides the user with feedback during question selection process. During the question selection process the slots of the frame are updated so the user can see how the process is progressing. An example of this is illustrated by Figure 8. The cities in the current quadrant are evaluated by qselect according to the methodology specified by Equations (14)-(18). When a question unit has been determined, the index of the unit is passed back to main and is used by question-answer functions such as firstq and qask. There are two functions that handle both the question/answer and concept modification operations. The function firstq handles only the first question/answer function whereas qask handles all subsequent question/answer and concept modification operations. These functions first display the current distribution of cities ( x : ) and their

quadrant3

Figure 6. Effects of quadrant allocation on behavior of SRAS. calculated. The t< is calculated such that for the city farthest from reference location /~(x~)=0.2. From calcd the cc is used in ifms to calculate # for each city(xk). This constitutes SRAS's initial guess for the fuzzy base relation NEAR (Douglas, x) and is presented to the user by b_ guess (see Fig. 7). If the user responds in the affirmative, the relation is written to file journal.sire, lfit is not acceptable SRAS begins the concept formation process by setting p to 0.4 and proceeding to select the first equation unit from quadrant (0). The function qselect is at the heart of SRAS. This is the function that selects the questions to be answered. First it calls qdrnt which increments quadrant to be considered for search. If no eligible question unit candidates are located then the quadrant for

not_near (0-3) sort_of_near(4-5) near (6-8) very_near(9) 7 3

5

7

6

55 7

7

41

6

44

7

7

3 3 2

6

6

7

7

This is my guess at a fuzzy representation of near_Douglas Is this an acceptable approximation, yes or no ? no

Figure 7. Example of initial "best guess" being presented to user. If user responds yes, then process stops here. Process continues if answer is no, as depicted here.

Interactive machine acquisition of a fuzzy spatial relation

X

863

presented in Appendix 3. The first item identifies the user by the initials entered by the user at the beginning of the program. This helps identify the user and can be useful in the construction of multiperson concepts as described by Gaglio, Minciardi, and Puliafito (1985) and applied to the problem of spatial relations by Robinson and Wong (1987). A name, corresponding g-value, and a question unit number for each city are output to journal.sire. This information is useful in postprocess analysis of questionanswering patterns (e.g. see Robinson and Wong, 1987).

o

Pleaseanswery e s or n o to the followingq u e s t l o n ~ Is the cityof nichollsNEAR d o u g l a s (X) ? [ : ~ I Figure 9. Example of SRAS posing question to user.

SUMMARY Several techniques from the field of artificial intelligence were used in the construction of the program. In particular, variations on techniques such as parameter adjustment, generate-and-test, and search heuristics (Rich, 1983). It is based on fuzzy subset theory, thus makes use of one alternative logic that has received some attention in the field of artificial intelligence. Automatic parameter adjustment is used in programming an adaptive ~k which determines the fuzzy membership function F at each step and is used to modify C~. In deciding which city to select for a question the program uses a generate and test approach. Although perhaps a bit simplistic, division of the search space through quadrants and neighborhood constraints were effective search heuristics. This paper has described a method that can capture fuzzy representations of linguistic spatial relations such as near by choosing and asking questions of users. Using exact answers such as yes and no the method constructs a fuzzy base relation. In other words, the program infers a fuzzy base relation from a series of nonfuzzy user responses. The base spatial

compatibility scores ~(xk)] as part of the question posed to the user. This is illustrated in Figure 9. Upon receiving the user's answer it begins the concept modification process. One of the first decisions to make is whether to adjust the value of ak according to Equation (12). After deciding on the value of ak, fuzzy function F, or "-7F, is formed. The concept is updated using fuzzy union or intersection depending upon the user's response according to Equations (7) and (8). After updating g(xk) the function qproc calculates the index of fuzziness for the current base relation. If the index does not fall below the value of p, the process continues by selecting another question. On the other hand, if the index falls below p then SRAS presents the user with the option of ending the process or continuing (see Fig. 10). The user can opt to continue the process even though the fuzziness of the relation has fallen below p. Should this happen, SRAS will adjust p downwards by 0.02 each time. The output file journal.sire is written to disk when the process terminates. An example of journal.sire is

not_near (0-3) sort_of_near (4-5) near (6-8) very_near(g) 1

2

I

I

1

22 4 II

2

3 *

7

4

I

4 I

1

I

I I

2

4

Now. this is what l think you mean by - near Douglas Is this an acceptableapproximation(yes or no) ? Figure 10. Example of SRAS finishing acquisition process by asking user if it is to continue even though program has reduced level of fuzziness below p.

864

V.B. ROBINSON

relations acquired through this program can be used subsequently to populate the knowledge base of a fuzzy knowledge based system such as F R I L (Baldwin and Zhou, 1984) and provide more realistic answers to geographical queries of geoscientists. Further research is required to address the problems of context and scale dependency not addressed directly by the program discussed here (Mark, Svorou, and Zubin, 1987; Denofsky, 1976; Robinson and Lundberg, 1987). The settlement database used to illustrate the operation of S R A S was selected as an example that can relate to a broad range of scientists and users. S R A S can be adapted readily to many situations where spatial relations about specific geoscience data are required. A simplistic example would be to substitute well locations for the city locations and ask which wells are near well a 0 5 9 7 Another example which comes to mind readily is the problem of specifying which leases in a particular formation are near a particular property. Many other examples could be used to illustrate that S R A S addresses a general problem of spatial relations acquisition relevant to a broad range of geosciencc problems.

Acknowledgments--Partial support was provided by Natu-

ral Sciences and Engineering Research Council of Canada and National Science Foundation. The valuable assistance of Dominique Thongs, Richard Wong, and Edward Chew in the course of this project is gratefully acknowledged.

REFERENCES

Baldwin, J. F., 1986, Support logic programming: Intern. Jour. Intelligent Systems, v. I, no. 2, p. 73-104. Baldwin, J. F., and Pilsworth. B., 1980, An axiomatic approach to implication for approximate reasoning using fuzzy logic: Fuzzy Sets and Systems, v. 3, no. 2. 193-219. Baldwin. J. F., and Zhou, S. Q , 1984. A fuzzy relational inference language: Fuzzy Sets and Systems, v. 14, no. 2, p. 155-174. Barrera, R., and Buchmann, A,, 1981, Schema definition and query language for a geographical database system: IEEE Trans. on Computer Architecture, Pattern Analysis and Image Database Management. p. 250-256. Chamberlain, D. D., and Boyce R. F., 1974, SEQUEL: a structured English query language: Proc. ACM SIGFIDET Workshop on Data Description, Access. and Control, Ann Arbor, Michigan., p. 713-775. De Luca, A.. and Termini. S., 1972, A definition of a nonprobabilistic entropy in the setting of fuzzy sets theory: Information and Control. v. 20, no. 3, p. 301-312. Denofsky, M. E., 1976. How near is near? A near specialist: AI Memo No. 344, MIT AI Lab, Cambridge, Massachusetts. 30 p. Frank, A.. 1982. MAPQUERY: data base query language for retrieval of geometric data and their graphical representation: Computer Graphics, v. 16. no. 2, 199 -207.

Freeman, J., 1973, The modelling of spatial relations: Computer Graphics and Image Processing. v. 4, no. 1, p. 156-171. Gaglio, S. R., Minciardi, R., and Puliafito. P. P., 1985, Multiperson decision aspects in the construction of expert systems: IEEE Trans. on Systems, Man. and Cybernetics, v. 15, no. 2, p. 193-204. Kaufmann, A., 1975. Introduction to the theory of fuzzy subsets: Academic Press, New York, 235 p. Mark, D. M., Svorou. S., and Zubin, D., 1987, Spatial terms and spatial concepts: geographic, cognitive, and linguistic perspectives: Proc. Intern. Geographic Information Systems Symposium, Washington, D.C., v. Ii, p. 101-112, Nakamura, K.. and lwai, S.. 1982, Toplogical fuzzy sets as a quantitative description of analogical inference and its application to question-answering systems for information retrieval: IEEE Trans. on Systems, Man, and Cybernetics, v. 12, no. 2, p. 193-204. Pereira. L. M. P., Sebatier. P., and de Oliveira. E., 1982, ORBl--an expert system for environmental resource evaluation through natural language: Report FCT/DI3/82, Departmento de lnformatica. Universidade Nove de Lisboa, 32p. Rich, E., 1983, Artificial intelligence: McGraw-Hill Book Co. New York. 436p. Robinson, V. B., 1988, Implications of fuzzy set theory for geographic databases: Computers, Environment. and Urban Systems, v. 12, no. 2, p. 89-98. Robinson, V. B., Blaze. M., and Thongs. D., 1986a, Man machine interaction for acquisition of spatial relations as natural language concepts, in Opitz B. cd., Geographic Information Systems in government: A. Dcepak Press: Hampton, Virginia v. 2, p. 871-886. Robinson, V. B., Blaze. M., and Thongs, D., 1986b, Representation and acquisition of a natural language relation for spatial information retrieval: Proc. Second Intern. Syrup. on Spatial Data Handling, p. 472--487. Robinson, V. B., Frank, A., and Karimi, tt.. 1987, Expert systems for geographic information systems in resource management: AI Applications in Natural Resources Management, v. I. no. I. p, 47-57. Robinson, V. B,, and Lundberg. G., 1987, Organizational and knowledge base considerations for the design of distributed geographic information systems--lessons from semantic modeling: Proc. Intern. Geographic Information Systems Symposium, Washington, D.C., v. II, p. 245-255. Robinson, V. B., and Wong, R. N., 1987, Acquiring approximate spatial representations of spatial relations: theory and results: Proc. Eighth Intern. Symp. Computer-Assisted Cartography. Baltimore, Maryland, p. 604-622. Tomlin, C. D., and Tomlin, S. M., 1981, An overlay mapping language: presented at Symp. Regional Landscape Planning, Am. Soc. of Landscape Architects. Warren, D. H. D., and Pereira, F. C. N., 1982, An efficient easily adaptable system for interpreting natural language queries: Am. Jour. Comp. Linguistics, v. 8, no. 3-4, p. 110-119. Zadeh, L., 1965, Fuzzy sets: Information and Control, v. 8, p. 339-353. Zadeh, L., 1978, PRUF--a meaning representation language for natural languages: Intern. Jour. ManMachine Studies, v. 10, no. 3, p. 395-460. Zadeh, L., 1981, Test-source semantics for natural languages and meaning representation via PRUF, in Rieger, B.. ed., Empirical semantics: Brockmeyer, Bochum, p. 281-349.

Interactive machine acquisition of a fuzzy spatial relation

865

APPENDIX 1 SRAS Demonstration Turbo C Program #include #include #Include #include #deflne MAXCOL 70 #define MAXROW 18 /* ..............................................................

/* /* /* /* /* /* /* /* /*

Demonstration Verelon of SPAS Written In Borland International's Turbo C by Vincent Roblnson Institute for Land Information Management U n i v e r s i t y o f T o r o n t o - E r i n d a l e Campus with a s s i s t a n c e from Dominique Thongs, Princeton University Richard N. Wong, Princeton University

I* ..............................................................

struct coord l char nam[30]; float x; float y; float dst; float mu; Int qu; int ans; float nel; int symb; Int qd; float I calc; l; struct coord city[78]; double locdist[78][78]; Int nc; char k_label[30]; char user[30]; int qdk; float k_x,k_y; double maxX,maxY; double alpha,far yes; double rho: main ()

*/

*/ */ */ */ */ */ */ */ */ *I

/* Name of p l a c e , no longer t h a n 30 symbols /* x-coordlnate describing location of pl ace /* y-coordinate describing location of place /* distance of place from Cue location /* fuzzy eubaet membership value, between 0-I /* quastlon candidate status indicator /* answer of user to question, 0-no 1-yes /* neighborhood Indicator, mu value /* symbol used to represent mu in map /* quadrant tag NE-O;NW-I;SW-2;SE-3 /* used to create maps

*/ */ */ */ */ */ */ */ */ */ */

/* Clobal Data Structure for City /* interclty distance matrix /* number of c i t i e s /* name of r e f e r e n c e city I* name of user /* current quadrant indicator /* x,y coordinates of reference city /* maximum x/y coordinates over all /* alpha parameter, far yes parameter /* stopping rule parameter rho

*/ */ */ */ */ */ */ */ */ */

/* .............. < Beginning of Main Program > .................. */

int i,k,ktr; char argf; double i max,x e,xa; double fuzun(),fuzlnt(),kauf(); void qask(),locdst(),calcd(),ifms(),mapqueet(), alpha_adJ(),fln(); void qdrnt(),qdrntl(); double abs_val(),qproc(); double I_e[80]; greeting(); readdb( ); locdst(); calcd(); ifms(); b_guess(); neidcl(); rho - 0.4; qdk - 0; k - 0; far_yes - 0 . 0 ;

/* /* /* /* /* /* /* /* /*

greeting user reading City data base calculates euclidean distances calculating distances & alpha initializing membershlp-lnitial guess determines If initial guess is acceptable initializing .nei values to 0 s e t t i n g f u z z i n e e s goal q u a d r a n t initialized

*/ */ */ */ */ */ */ */ */

x_e - q p r o c ( ) ; i _ e [ k ] - x_e; k t r - q s e l e c t (x a ) ; /* selecting first question unit */ city[ktr].qu-l; /* clty[ktr] Is first q u e s t i o n unit */ k - I; firstq(ktr); /* Initial queetlon-answer function */ x_e-qproc(); / * c a l c u l a t i o n o f i ndex o f f u z z i n e s s */ i_e[k]-x_e; /* placing index of fuzziness in array */ ktr-qselect(x_e); /* selecting next question unit's locatlon*/ city[ktr].qu - ++k; / * incrementing k, storing qu tag */

866

V.B. ROBINSON

do {

l

qask(ktr); x_e-qproc(); l_e[k]-x_e; if (x_e < rho) f l n ( x _ e ) ; ktr - qselect(l_e[k]); city[ktr].qu - ++k ; )while (x_.e > rho); I* ................... < End

Jrnl() { FILE *fopen(), *fl; Int I-0;

/* interaction & concept modlflcatlon /* calculation of index of fuzziness /* placing index of fuzziness in array

*/ */ */

/* question selection of city /* placing qu counter in city /* test for ending process of Main Program > .....................

*/ */ */ */

/* writes results output to disk */

if((fl-fopen("Journal.slm","a")) - - N U L L ) { fprlntf(stderr,"cannot open -- Journal.sim exlt(1); } fprintf(fl,"%s\n",user);

-- in append mode\n");

do [ fprlntf(fl,"%s %f ~dkn',clty[i].nam, clty[i].mu, clty[i].qu); ) while (++I < he); f p r i n t f ( f l , " .......................................... \n"); fclose(fl); } void Ifms() /* Inltlallzes fuzzy membership values */ ( Int I-0; do { clty[i].mu - exp((alpha * clty[l].dst)); } while (++I < nc ); ) neldcl()

/* initializing the val cltle[i].nel - 0 */

Int I- O; do { city[l].nel - 0.0;

} while (++I < nc );

) double kauf(x) double x; ( static double kf; If(x >- 0.5) kf - 1.0 - x; else k f - x; r e t u r n (kf); ] qselect(i_e) /* questlon selection */ double l e; ( int i-O; Int k-O; Int q-O; double tc,ntc,yw,nw; double l_yes,l no,l exp,xa; double fuzun(),fuzint(),kauf(); void qdrnt(); yw-O.O; nw-O.O; i yes- 0.0; i no- 0.0; i exp- 1.00; qdrnt(); frame_select(); do { switch ((city[k],qu -- 0 && clty[k].nei < 0.9 && c l t y [ k ] . q d - - qdk)? 0 : i) { case 0: /* q u e s t i o n selection from set of unused candidates */ do { tc - locdlst[i] [k]; tc - exp((alpha * tc)); ntc - 1.0 - tc; tc - fuzun(clty[i].mu, tc); ntc - fuzlnt(city[l].mu, ntc); i__yes +- kauf(tc); i_no +- kauf(ntc); } while (++i < no); l_yes - (2.0 / nc) * i_yee; I no - (2.0 / nc) * i_no; yw - exp( ((2.0 * alpha) * clty[k].dst) ) ; nw - 1.0 - yw; clty[k].l c e l t - ( ( i y e s * yw) +(l_no * nw )); if ( i _ e x p > c ~ t y [ k ] . l _ c a l c ) { i_exp - c l t y [ k ] . i _ c a l c ; q-k; }

I n t e r a c t i v e m a c h i n e a c q u i s i t i o n o f a fuzzy spatial r e l a t i o n

867

gotoxy(35,4); prlntf('~f',i_e); gotoxy(35,5); prlntf("~f',rho); goCoxy(lO,9); prlnt£(" "); gotoxy(lO,9); prlntf('~s=,clCy[q].n~m); gotoxy(63,9); printf('~f',clty[q].i_calc);

gotoxy(lO,16);

prlntf(" "); 8otoxy(lO,16); p r i n t f ( ' ~ s " , c l t y [ k ] . m m ) ; gotoxy(44,18); prlntf("%f",i_yes); gotoxy(44,19); printf("%f",l_no); g o t o x y ( 5 8 , 2 1 ) ; prlntf("%f",clty[k].i_calc); pauz(300);

I - O; i _ y e s - 0.0; i_no - 0.0; break; case I: /* ignoring previous question units */ continue; } } while (++k < nc); return q; /* returning index of next question unit */ } flrstq(k) /* first question c o n c e p t int k; ¢ double fs,dst xy; double fuzint(),fuzun(); Int i-O; city[k].ans - answ(k); do ( dst_xy - locdlst[i][k];

modification & question-answering

*/

fs - exp((alpha*dst_xy)); city[i].nel - fuzun(clty[l].nel,fs); switch ( (clty[k].ans -- 0)? 0:i)

{ case

O:

fs-l.O-fs; city[i].mu - fuzlnt(city[i].mu,fs); break; c a s e I: city[i].mu break;

-

fuzun(city[l].mu,

fs);

} } while(++/

< nc);

void locdst() /* calculates Interclty distance */ { double xl,x2,yl,y2,xx,yy; Int i-O; Int k; do { k - O; xl - clty[13.x ; yl - city[i].y ; do { x2 - c l t y [ k ] . x ; y2 - clty[k].y x l - x 2 ; yy- yl - y2;

;

xx-

locdist[i][k] - sqrt ((xx * xx) + (yy * yy)) ; }while (++k < nc); )while (++i < nc); }

void qask(k) /* question asking and answering simulation followed by */ Int k; /* c o n c e p t modification.., k i s i n d e x of question unit */ { double fs,dst_xy,alpha_x; double fuzlnt(),fuzun(); Int i - O; */ city[k].ans - answ(k); /* interrogating user /* clty[k].ans -I if yes, 0 i f n o */ do { dst_xy - locdlat[i] [k]; f s - exp((alpha*dst_xy)); swltch((fs > 0.05 b& f s < 0.95 && clty[i].qu I - 0 b& city[i].ans l-city[k].ans)? 0 : l) /* switch call to decide whether or not to modify alpha */ CAGEO 16 6-.-I

V. 6. ROEIPNN =.‘a

0:

/*

Alpha-x- -1.0 * (3.lO/dat_xy); if (Alpha-x < AlphA) fs - eXp((AlphA_X l dst_xy)); else fs - exp((SLphA*dst_xy)); break; case 1: fs - exp(AlphA*dst_xy); breAk;

AdAptive pArAmeter Adjustment /* Adjusting paran /* choosing pArAm /* nev parAm /* otherwise /* previous pAran /* nonadaptive parsmeter

city[i].nei - fuxun(city[i].nef,fs): if (city[k].Ans - 0) 1 fs-l.O-fs; city[i].mu - furint(city[l].mu,fs); else ( city[i].mu - fuzun(city(i].mu, fs); )

f/ */ */ +/ +/ */ */

)

) while(++i < nc);

reAddb() 1 FILE *fopen(), *fl; float xl,yl; char knlI301: int Anl;. int i-0; mAX+0; q if ( (fl-fOpen("dAtA","r*))--NULL) ( fprintf(stderr."cAnnot exit(l); 1 fscAnf(fl,'8d",bnc); fscAnf(fl,"8s',k_lSbel);

/* reads the input data set f/

Please try

Good Bye\n");

do

(mAxX < city[i].x) (maICY< clty[i].y)

while (++i < nc); fclose(f1);

ansv(k)

int k;

f void mApquest(); int A,b, Ans; char dummy; void Alpha_Adj(); A-O; b-0; do I mApquest( AnS-yorn(); Svitch(snS)

I

case 0: b - 0; A - 1; Alpha - (-1.0 * 0.6932) / city[k].dst; break; CASe 1: b - 1; A - 1; if (fAr_yes < city[k].dSt) ( far_yes - city[k].dat: AlphA_Adj(k): break; default: 0; b:sik:

) ;hile( A return(b):

I

-

0);

)

869

Interactive machine acquisition of a fuzzy spatial relation yorn ()

{ char reply [2]; Int i; char c; do [ prlntf (" ?'); I - 0; do { while ((c - getchar()) -- ' '); if (i < 2 ) reply [i++] - c; } while ( c I - '\n'); }while (I t- 2 it reply[O] [- 'y' && reply[O] return reply[O] -- 'y';

I- 'n');

} void calcd()

{ double maxdst; int i-O; double xl,yl; maxdst - 0.0; do

} while

xl - city[l].x - k x; yl - clty[i].y - k y; city[l].dst- (xl * xl) + (yl * yl); if (maxdst < c i t y [ i ] . d s t ) maxdst - city[l],dst; (++i < nc); alpha - (-i.0 * 1.60944) / maxdst;

void alpha adJ(k) Int k; [ alpha - (-I.0 * 0.1615)

double qproc()

/ clty[k].det;

}

/* calculating

Kaufman I n d e x of Fuzziness */

{ int i-O; double I k; i k - 0.0; do { tf(ctty[i].mu>-0.5) i_k +- 1.0 - clty[i].mu else t k +-clty[l].mu; } while (++i < nc); i_k - (2.0 / nc) * i _ k ; return i k ;

;

}

void mapquest(k) int k;

{ double convx,convy; int a,b,c,h,ka,kb,ta,tb; convx- maxX/70.O0; convy- maxY/i8.00; kb - ( i n t ) ( k _ x / c o n v x ) ; ka - ( l n t ) ( 2 2 - ( k _ y / c o n v y ) ) ; tb - ( i n t ) ( c i t y [ k ] . x / c o n v x ) ;

ta - ( i n t ) ( 2 2 -( c i t y [ k ] . y / c o n v y ) ) ; clrscr(); gotoxy(kb,ka); printf("X'); gotoxy(tb,te); prlntf("o');

gotoxy(2,22);

p r i n t f ( " P l e a e o a n s w e r y e s o r no to the f o l l o w i n g q u e s t i o n \ n " ) ; printf("Is the c i t y o f %e NEAR ta (X) " , c i t y [ k ] . n a m , k _ l a b e l ) ;

}

greeting() { initgraph(O,O,");

clrscr();

gotoxy(32,9); printf("W E L C 0 M E');

g o t o x y ( 1 5 , 11); p r i n t f ( ' I am SPAS, a S p a t i a l gotoxy(15,15); printf('Whet ere your initials

Relations Acquisition Station'); ? "); acanf(" tsm,user); clrscr();

p r i n t f ( " S P A S : r e " , u s e r ) ; g o t o x y ( 1 5 , 1 0 ) ; p r i n t f ( ' P l e a s o w a i t a few seconds while I g a t h e r my t h o u g h t s " ) ; }

V. B. ROWSON void fin(x_o) double x-e; I int ma; clrscr(); mapr*s(); gotoxy(2.23); printf('Nov, this ia vhat I think you wmby - mar Doulgas - '); gotoxy(2.24); printf("Is this an acceptable approximation (yw or no)'); *nJ - Yom); svitch(ana) 1 c*s* 0: clrscr(); rho - rho - ((rho - x-o) + 0.02); break; c*se 1: frnl0: exit(l); break;

1 1

mapres()

I double convx,convy; int a,b,i,c,h.ka,kb,t~.tb,k; i-0; k-0; CO"ww oaxx/70.00; comy- maxY/10.00; kb - (int)( k_x/convx); ka - (int)(23- (kJ/convy)): clrscr(); gotoxy(kb.ka); printf('*'); do ( if(( city[k].mu >- 0 ) 66 ( city(k1.w < .l)) city[k].mymb- 1; alm if (city[k].rru C .2) city(k].symb - 2; slse if (city[k].mu < .3) city[k].symb - 3: elas if (city[k].m < .4) city[k].nymb - 4; else if (city[k].mu < .5) city[k].aymb - 5; else if (city[k].mu < .6) city(k].mymb - 6; else if (city[i].mu < .7) city[k].syPb - 7; else if (city(k].rm < .8) city[k].spb - 8; elaa if (city[k).mu <- 1) city[k].symb - 9; tb-(int)(city[k].x/convx); ta-(int)(23-(city[k].y/convy)); gotoxy(tb,ta); printf('td",city[k].symb); ) while (+tk < nc); sort_of_n*ar (4-S) gotoxy(l.1); printf(* notpoar (O-3) "); gotoxy(l,24); (9)

near (6-8) vsry_naar

1

b_gu-SO I int ma; mpr*a(); gotoxy(l.23); printf('Thia is my guess at a furry r*prw*ntation of mar_ U".k_labal); gotoxy(1.24); printf('Is this an lccoptabls approximation, yea or no"); mm - YOM); svitch(ans)

1 C.S. 0: clracr(); gotoxy(l5,lO);printf('~proco~dingvithint~r~ctiva~sa~ion"); gotoxy(15,12); printf('Plauo vait vhilm I chooma my firat question"); paux(200); break;

Interactive machine acquisition of a fuzzy spatial relation

871

case 1: clrlcr(); gotoxy(17,10); p r i n t f ( ' N o w , I u n d e r | r ~ n d ~ l a t you mean by - near_Doulgas - " ) ; g o t o x y ( 1 7 , 1 2 ) ; p r i n t f ( ° T h i a ~J the end o f our session, thank y o u ' ) ; Jrnl() ; exit(l); }

frame . e l e c t ( ) { clrscr(); gotoxy(lO,1); p r t n C f ( " S e l e c t i n g the Next q u e s t i o n : This i s Whac I am T h i n k i n g " ) ; gotoxy(5,4); p r l n t f ( ' C u r r e n C Level o f F u z z i n e s s : ' ) ; goCoxy(5,5); prlntf('Fuzzlness. Goal: "); |otoxy($,7); prlntf("Current Best Cholce"); gocoxy(3,9); prlntf('Clty:'); g o t o x y ( 4 0 , 9 ) ; prlntf(" Fuzziness:"); gotoxy(l,12); prlntf(" __'); gotoxy(20,13); p r i n t f ( " Evaluation o£ Candldate Questlon "); gotoxy(3,16); prlnCf("Clty:"); gotoxy(3,18); prlntf("Expected FuzzlnessYQs:'); gotoxy(3,19); prlntf('ExpecCed Fuzzlness NO:'); gotoxy(10,21); prfntf("Welghtld Expected Avara&e Fuzzlnesa:"); }

pauz(kot) let kot; [ let pa-O; do [ gotoxy(2,25); prlntf(" " , p a ) ; }while (++pa < kot); }

void qdrnt() { void qdrntl(); InC k--l; lnt I-0; qdk-qdk+l; if (qdk > 3) qdk - O; do { if (clty[i].qu -- 0 k-clty[i].qd; }while (++i < nc ); i f (k < O) q d r n c l ( ) ; i f (k > - I ) qdk - k; )

ci~[i].nel

<

0.9

6,~ c i t y [ i ] . q d

--

qdk)

vold qdrntl() { lnt kk- -I; lnt i-O ; do (

{

If (clty[l].qu -- 0 ~ clty{i].nel < 0.9 ) ( kk-cltyIi ].qd; i - nc; ) )whlle (++i < nc ); I f (kk > - I ) q d k - kk; i f (kk < O)

c l r a c r ( ) ; ..apres(); g o t o x y ( 2 , 2 3 ) ; prfntf("*** I f i n d no more quemtions to ask ~ \ n ' ) ; gotoxy(2,24); prtntf("Thl- is what I thlnk you mean by exlt(1) ; } }

- near %e " ,k label);

V. B. R O m N ~ N

872 double f , , - l n t ( x l , x 2 ) double x l , x 2 ; I s t a t i c double fz; fz - x2; i f ( x l < x2) fz - x l ;

/* p e r f o ~

• fuzzy i n t e r s e c t i o n */

/* uJtng the Mln-rule of Intersection */

return(fz); }

/ * performs fuzzy union * /

double f u z u n ( x l . x 2 ) double x l , x 2 ; { mtatlc double fz; fz - x2; if (xl > x2) fz - x l ; return(fz); )

APPENDIX

/ * U,ling the Max-rule of Union */

APPENDIX

2

Waycross, Georgia Demonstration Data Set 29 douglas cordele ashburn sylvester doerun moultrle coolidge poulan tifton sycamore lenox adel nashville alapaha ocilla fitzgerald rochelle abeville broxton pearson lakeland willacoochee homerville nlcholls lumber clty hazlehurst waycroes blackshear alma baxley

87 16 26 13 6 15 11 16 37 27 40 44 57 58 57 56 41 52 83 87 70 72 95 103 99 105 125 133 116 124

45 86 62 47 28 16 2 45 41 59 24 13 19 34 53 64 84 88 56 27 4 31 4 47 83 78 21 28 49 70

3

Example of SRAS Output vbr cordele ashburn sylvester doerun moultrle coolidge poulan tlfton sycamore lenox adel nashville alapaha ocilla fitzgerald rochelle abeville broxton pearson lakeland willacoochee homerville nIcholls lumber city hazlehurst waycross blackshear alma baxley

0.175963 0.048618 0.000000 0.050542 0.114912 0.200000 0.001643 0.074495 0.042097 0.147117 0.234934 0.150283 0.000000 0.220771 0.236963 0.238410 0.333051 0.378046 0.209879 0.219859 0.137327 0.000000 0.954951 0.029482 0.000000 0.376452 0.551768 0.376212 0.188199

0 0 2 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 4 1 0 5 0 0 0 0