r.fuzzy.logic
Performs logical operations on membership images created with r.fuzzy.set or different method. Use families for fuzzy logic.
r.fuzzy.logic xmap=name [ymap=name] output=name [operator=string] [family=string] [--overwrite] [--verbose] [--quiet] [--qq] [--ui]
Example:
r.fuzzy.logic xmap=name output=name
grass.script.run_command("r.fuzzy.logic", xmap, ymap=None, output, operator="AND", family="Zadeh", overwrite=None, verbose=None, quiet=None, superquiet=None)
Example:
gs.run_command("r.fuzzy.logic", xmap="name", output="name")
grass.tools.Tools.r_fuzzy_logic(xmap, ymap=None, output, operator="AND", family="Zadeh", overwrite=None, verbose=None, quiet=None, superquiet=None)
Example:
tools = Tools()
tools.r_fuzzy_logic(xmap="name", output="name")
This grass.tools API is experimental in version 8.5 and expected to be stable in version 8.6.
Parameters
xmap=name [required]
x operand (membership map)
ymap=name
y operand (membership map)
output=name [required]
Resulting map
operator=string
Fuzzy logic operation
Allowed values: AND, OR, NOT, IMP
Default: AND
family=string
Fuzzy logic family
Allowed values: Zadeh, product, drastic, Lukasiewicz, Fodor, Hamacher
Default: Zadeh
--overwrite
Allow output files to overwrite existing files
--help
Print usage summary
--verbose
Verbose module output
--quiet
Quiet module output
--qq
Very quiet module output
--ui
Force launching GUI dialog
xmap : str, required
x operand (membership map)
Used as: input, raster, name
ymap : str, optional
y operand (membership map)
Used as: input, raster, name
output : str, required
Resulting map
Used as: output, raster, name
operator : str, optional
Fuzzy logic operation
Allowed values: AND, OR, NOT, IMP
Default: AND
family : str, optional
Fuzzy logic family
Allowed values: Zadeh, product, drastic, Lukasiewicz, Fodor, Hamacher
Default: Zadeh
overwrite : bool, optional
Allow output files to overwrite existing files
Default: None
verbose : bool, optional
Verbose module output
Default: None
quiet : bool, optional
Quiet module output
Default: None
superquiet : bool, optional
Very quiet module output
Default: None
xmap : str | np.ndarray, required
x operand (membership map)
Used as: input, raster, name
ymap : str | np.ndarray, optional
y operand (membership map)
Used as: input, raster, name
output : str | type(np.ndarray) | type(np.array) | type(gs.array.array), required
Resulting map
Used as: output, raster, name
operator : str, optional
Fuzzy logic operation
Allowed values: AND, OR, NOT, IMP
Default: AND
family : str, optional
Fuzzy logic family
Allowed values: Zadeh, product, drastic, Lukasiewicz, Fodor, Hamacher
Default: Zadeh
overwrite : bool, optional
Allow output files to overwrite existing files
Default: None
verbose : bool, optional
Verbose module output
Default: None
quiet : bool, optional
Quiet module output
Default: None
superquiet : bool, optional
Very quiet module output
Default: None
Returns:
result : grass.tools.support.ToolResult | np.ndarray | tuple[np.ndarray] | None
If the tool produces text as standard output, a ToolResult object will be returned. Otherwise, None
will be returned. If an array type (e.g., np.ndarray) is used for one of the raster outputs, the result will be an array and will have the shape corresponding to the computational region. If an array type is used for more than one raster output, the result will be a tuple of arrays.
OPTIONS
- xmap
Name of input x membership operand. This map must be of type FCELL with range 0 :1 and may require null values. Otherwise program will print error message and stops. - ymap
Name of input y membership operand. This map must be of type FCELL with range 0 :1 and may require null values. Otherwise program will print error message and stops. This map is required for all operations except NOT. - operator
Fuzzy set operators are a generalization of crisp set operators. There is more than one possible generalization of every operator. There are three operations: fuzzy complements, fuzzy intersections, and fuzzy unions. Additional implication operator is also provided. - fuzzy intersection (AND) use T-norm of given family for calculation;
- fuzzy union (OR) use T-conorm of given family for calculation;
- fuzzy complement (NOT) fuzzy negation usually 1-x;
- fuzzy implication (IMP) use residuum of given family if available;
- family
T-norms, T-conorms and residuals are a generalization of the two-valued logical conjunction, disjunction and implication used by boolean logic, for fuzzy logic. Because there is more than one possible generalisation of logical operations, r.fuzzy.logic provides 6 of the most popular families for fuzzy operations: - Zadeh with minimum (Godel) t-norm and maximum T-conorm;
- product with product T-norm and probabilistic sum as T-conorm;
- drastic with drastic T-norm and drastic T-conorm;
- Łukasiewicz with Łukasiewicz T-norm and bounded sum as a T-conorm;
- Fodor with nilpotent minimum as T-norm and nilpotent maximum as T-conorm;
- Hamacher (simplified) with Hamacher product as T-norm and Einstein sum as T-conorm; There is no residuum for drastic and Hamacher families. For more details see Meyer D, Hornik K (2009); T-norms;
OUTPUTS
- output
Map containing the result of two-values operations. Map is always of type FCELL and contains values from 0 (no membership) to 1 (full membership). Values between 0 and 1 indicate partial membership
SEE ALSO
r.fuzzy.set, r.fuzzy.system, r.mapcalc
REFERENCES
- Jasiewicz, J. (2011). A new GRASS GIS fuzzy inference system for massive data analysis. Computers & Geosciences (37) 1525-1531. DOI https://doi.org/10.1016/j.cageo.2010.09.008
- Zadeh, L.A. (1965). "Fuzzy sets". Information and Control 8 (3): 338-353. https://doi.org/10.1016/S0019-9958(65)90241-X. ISSN 0019-9958.
- 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. DOI https://doi.org/10.18637/jss.v031.i02
- Meyer D, Hornik K (2009b). sets: Sets, Generalized Sets, and Customizable Sets. R\~package version\~1.0, URL https://cran.r-project.org/package=sets.
AUTHOR
Jarek Jasiewicz
SOURCE CODE
Available at: r.fuzzy.logic source code
(history)
Latest change: Sunday Aug 17 09:42:07 2025 in commit aaa9867