$ set_name {side; points; boundary_shape; hedge; height }
An example of fuzzy sets definiton:
$ moderate {both; 90,100,120,130; sshaped; 0; 1}Special notes about sets definition for output map:
$ moderate {both; 0,20,20,40; linear; 0; 1}
IF elev IS high AND distance IS low THEN probability IS small where: antecetends: elev IS high; distance IS low consequent: probability IS smallThe rule file has his own syntax. Because module creates only one result map, the map name is ommited. Every rule starts with $ and consist of consequent name and antecedents in braces { }. All maps and sets used in atecednets must be included in the maps file. At the begining of the calculation program checks if all names and sets are included in maps file. Names of the rules must be same as sets names of the output map. The rules file use following symbols:
An example of fuzzy rules definiton:
$ small {distance = high & elev = high}
Family | T-NORM (AND) | T CONORM (OR) |
---|---|---|
ZADEH | MIN(x,y) | MAX(x,y) |
PRODUCT | x*y | x + y -x * y |
DRASTIC | IF MAX(x, y) == 1 THEN MIN(x, y) ELSE 0 | IF (MIN(x, y) == 0) THEN MAX(x, y) ELSE 1 |
LUKASIEWICZ | MAX((x+y-1),0) | MIN((x+y),1) |
FODOR | IF (x+y)>1 THEN MIN(x,y) ELSE 0 | IF (x+y<1) THEN MAX(x,y) ELSE 1 |
HAMACHER | IF (x==y==0) THEN 0 ELSE (x*y)/((x+y)-x*y) | (x+y)/(1+x*y) |
Linear: the membership is calculated according following equation:
value <= A -> x = 0
A< value > B -> x = (value-A)/(B-A)
B <= value >= C -> x = 1
C< value > D -> x = (D-value)/(D-C)
value >= D -> x = 0
S-shaped, G-shaped and J shaped: use following equation to sommoth
boundary:
sin(x * Pi/2)^2 (for S-shaped)
tan(x * Pi/4)^2 (for J-shaped)
tan(x * Pi/4)^0.5 (for G-shaped)
where:
x current fuzzy value
A,B,C,D inflection point,
Fuzzy sets are sets whose elements have degrees of membership. Zadeh (1965) introduced Fuzzy sets as an extension of the classical notion of set. Classical membership of elements in a set are binary terms: an element either belongs or does not belong to the set. Fuzzy set theory use the gradual membership of elements in a set. A membership function use values in the real unit interval [0, 1]. Classical sets, are special cases of the membership functions of fuzzy sets and only take values 0 or 1. Classical sets are in fuzzy set theory usually called crisp sets. The fuzzy set theory can be used in a wide range of domains in which information is imprecise, such as most of the GIS operations.
Suppose we want to determine the flood risk on some area (Spearfish dataset) using two maps: distance to streams and elevation above streams. We can write some common sense rules:
IF elevation IS low AND distance IS near THEN risk IS very high IF elevation IS low OR distance IS near THEN risk IS probable IF elevation IS high AND distance IS far THEN risk IS lowIn clasical boolean sense, we would taken some limits of ideas "near" "far" etc, but what about walues near the limit? The fuzzy set uses partial memberships which abolish these restrictions. In that sense to set "near" belongs all areas with distance no more than 100 m with full membership and from 100 to 200 m with partial membership greater than 0. Over 200 m we can assume that is not near. This allow to formulate fuzzy rules for distance map:
near: BELOW 100 = 1; FROM 100 TO 200 = {1 TO 0}; ABOVE 200 = 0;To recive final map program calculate partial fuzzy set for all rules and next agregate it into one fuzzy set. These fuzzy sets are created on value sequence called universe. Every set has the number of elements equal to universe resolution. Such set cannot be stored as map so finally is deffuzified with method choosen by user.
First we need two maps created with r.stream package:
r.watershed -f elevation=elevation.10m@PERMANENT accumulation=accum r.mapcalc 'accum_abs=abs(accum)' r.stream.extract elevation="elevation.10m@PERMANENT" threshold=1000 stream_rast="stream" direction="dirs" r.stream.order stream=streams dir=dirs horton=horton r.mapcalc horton3=if(horton>2,1,0) r.stream.distance stream=horton3 dir=dirs dem=elevation.10m@PERMANENT distance=distance elevation=elevationNext, to perform analysis we need two files: one with definition of map used in analysis and definition of fuzzy sets for every map, and second with fuzzy rules. For this example:
MAPS
#flood.map %elevation $ low {right; 2,4; sshaped; 0; 1} $ moderate {both; 2,4,5,10; sshaped; 0; 1} $ high {left; 5,10; sshaped; 0; 1} %distance $ near {right; 30,70; sshaped; 0; 1} $ medium {both; 30,70,100,150; sshaped; 0; 1} $ far {both; 100,150,200,300; sshaped; 0; 1} $ veryfar {left; 200,300; sshaped; 0; 1} %accum_abs $ low {right; 500,5000; sshaped; 0; 1} $ $ high {left; 500,5000; sshaped; 0; 1} #output map %_OUTPUT_ $ none {both; 0,20,20,40; linear; 0;1} $ low {both; 20,40,40,60; linear; 0;1} $ moderate {both; 40,60,60,80; linear; 0;1} $ high {both; 60,80,80,100; linear; 0;1} $ veryhigh {both; 80,100,100,120; linear; 0;1}
RULES:
#flood.rul $ none {distance = veryfar | elevation = high} $ low {distance ~ near & accum_abs = high} $ moderate {(distance = medium | distance = far) & (elevation = low | elevation = moderate)} $ high {(distance = medium & elevation = low)|(distance = near & elevation = moderate)} $ veryhigh {distance = near & elevation = low}finally we need run r.fuzzy.system:
A) r.fuzzy.system maps=~/flood.map rules=~/flood.rul family=Zadeh defuz=centroid imp=minimum res=100 output=flood_z_cent B) r.fuzzy.system maps=~/flood.map rules=~/flood.rul family=drastic defuz=max_of_highest imp=minimum res=100 output=flood_d_max C) r.fuzzy.system maps=~/flood.map rules=~/flood.rul family=Hamacher defuz=mean_of_highest imp=minimum res=100 output=flood_h_meanResulting map should look like this below.
Novák, Vilém (1989). Fuzzy Sets and Their Applications. Bristol: Adam Hilger. ISBN 0-85274-583-4.
Klir, George J.; Yuan, Bo (1995). Fuzzy sets and fuzzy logic: theory and applications. Upper Saddle River, NJ: Prentice Hall PTR. ISBN 0-13-101171-5.
Klir, George J.; St Clair, Ute H.; Yuan, Bo (1997). Fuzzy set theory: foundations and applications. Englewood Cliffs, NJ: Prentice Hall. ISBN 0133410587.
Meyer D, Hornik K (2009a). \Generalized and Customizable Sets in R." Journal of Statistical Software, 31(2), 1{27. URL http://www.jstatsoft.org/v31/i02/.
Meyer D, Hornik K (2009b). sets: Sets, Generalized Sets, and Customizable Sets. R~package version~1.0, URL http://CRAN.R-project.org/package=sets.
Last changed: $Date$