Skip to content

Commit

Permalink
Code and doc fixes for fuzzy addons (#175)
Browse files Browse the repository at this point in the history
Reviewed & Co-authored-by: Markus Neteler <[email protected]>
  • Loading branch information
mankoff authored May 25, 2020
1 parent 83e8a26 commit 9a587e4
Show file tree
Hide file tree
Showing 7 changed files with 151 additions and 130 deletions.
6 changes: 3 additions & 3 deletions grass7/raster/r.fuzzy.logic/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ int main(int argc, char *argv[])
G_add_keyword(_("fuzzy logic"));
module->description =
_("Performs logical operations on membership images created with "
"r.fuzzy or different method. Use families for fuzzy logic.");
"r.fuzzy.set or different method. Use families for fuzzy logic.");

par_inputx = G_define_standard_option(G_OPT_R_INPUT);
par_inputx->description = _("x operand (membership map)");
Expand All @@ -68,7 +68,7 @@ int main(int argc, char *argv[])
par_operation->options = "AND,OR,NOT,IMP";
par_operation->answer = "AND";
par_operation->multiple = NO;
par_operation->required = YES;
par_operation->required = NO;
par_operation->description = _("Fuzzy logic operation");

par_family = G_define_option();
Expand All @@ -77,7 +77,7 @@ int main(int argc, char *argv[])
par_family->options = "Zadeh,product,drastic,Lukasiewicz,Fodor,Hamacher";
par_family->answer = "Zadeh";
par_family->multiple = NO;
par_family->required = YES;
par_family->required = NO;
par_family->description = _("Fuzzy logic family");

if (G_parser(argc, argv))
Expand Down
38 changes: 22 additions & 16 deletions grass7/raster/r.fuzzy.logic/r.fuzzy.logic.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ <h2>OPTIONS</h2>
range 0 :1 and may require null values. Otherwise program will print error
message and stops.
</dd>
<dt><b>xmap</b></dt>
<dt><b>ymap</b></dt>
<dd>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 optional bit is required for all operation except
Expand Down Expand Up @@ -47,40 +47,46 @@ <h2>OPTIONS</h2>
<h2>OUTPUTS</h2>
<dl>
<dt><b>output</b></dt>
<dd>Map containing result of two-values operations. Multivalued operations will
be available in the future. Map is always of type FCELLS and contains values
<dd>Map containing 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</dd>
</dl>

<h2>SEE ALSO</h2>

<em>
<a href="r.fuzzy.html">r.fuzzy</a>,
<a href="r.fuzzy.set.html">r.fuzzy.set</a> addon,
<a href="r.fuzzy.system.html">r.fuzzy.system</a> addon,
<a href="r.mapcalc.html">r.mapcalc</a>
</em>


<h2>REFERENCES</h2>

Zadeh, L.A. (1965). Fuzzy sets. Information and Control 8 (3): 338–353.
doi:10.1016/S0019-9958(65)90241-X. ISSN 0019-9958.<p>
<ul>
<li>Jasiewicz, J. (2011). A new GRASS GIS fuzzy inference system for massive data analysis.
Computers & Geosciences (37) 1525-1531. DOI <a href="https://doi.org/10.1016/j.cageo.2010.09.008">https://doi.org/10.1016/j.cageo.2010.09.008</a>

<li>Zadeh, L.A. (1965). "Fuzzy sets". Information and Control 8 (3): 338-353.
<a href="https://doi.org/10.1016/S0019-9958(65)90241-X"><a href="https://doi.org/10.1016/S0019-9958(65)90241-X"</a>. ISSN 0019-9958.

Nov&aacute;k, Vil&eacute;m (1989). Fuzzy Sets and Their Applications. Bristol: Adam Hilger.
ISBN 0-85274-583-4.<p>
<li>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.<p>
<li>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:
<li>Klir, George J.; St Clair, Ute H.; Yuan, Bo (1997). Fuzzy set theory:
foundations and applications. Englewood Cliffs, NJ: Prentice Hall. ISBN
0133410587.<p>
0133410587.

Meyer D, Hornik K (2009a). Generalized and Customizable Sets in R. Journal of
Statistical Software, 31(2), 1-27. URL https://www.jstatsoft.org/v31/i02/.<p>
<li>Meyer D, Hornik K (2009a). Generalized and Customizable Sets in R. Journal of
Statistical Software, 31(2), 1-27. DOI <a href="https://doi.org/10.18637/jss.v031.i02">https://doi.org/10.18637/jss.v031.i02</a>

Meyer D, Hornik K (2009b). sets: Sets, Generalized Sets, and Customizable Sets.
R package version, URL https://CRAN.R-project.org/package=sets.<p>
<li>Meyer D, Hornik K (2009b). sets: Sets, Generalized Sets, and Customizable Sets.
R~package version~1.0, URL <a href="http://CRAN.R-project.org/package=sets">http://CRAN.R-project.org/package=sets</a>.
</ul>

<h2>AUTHOR</h2>
Jarek Jasiewicz
Expand Down
12 changes: 6 additions & 6 deletions grass7/raster/r.fuzzy.set/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ int main(int argc, char *argv[])
par_side->options = "both,left,right";
par_side->answer = "both";
par_side->multiple = NO;
par_side->required = YES;
par_side->required = NO;
par_side->description = _("Fuzzy range");

par_type = G_define_option();
Expand All @@ -80,27 +80,27 @@ int main(int argc, char *argv[])
par_type->options = "Linear,S-shaped,J-shaped,G-shaped";
par_type->answer = "S-shaped";
par_type->multiple = NO;
par_type->required = YES;
par_type->required = NO;
par_type->description = _("Type of fuzzy boundaries");
par_type->guisection = _("Default options");

par_shape = G_define_option();
par_shape->key = "shape";
par_shape->type = TYPE_DOUBLE;
par_shape->options = "-1,1";
par_shape->options = "-1-1";
par_shape->answer = "0.";
par_shape->multiple = NO;
par_shape->required = YES;
par_shape->required = NO;
par_shape->description = _("Shape modifier: -1 to 1");
par_shape->guisection = _("Default options");

par_height = G_define_option();
par_height->key = "height";
par_height->type = TYPE_DOUBLE;
par_height->options = "0,1";
par_height->options = "0-1";
par_height->answer = "1.";
par_height->multiple = NO;
par_height->required = YES;
par_height->required = NO;
par_height->description = _("Membership height: 0 to 1");
par_height->guisection = _("Default options");

Expand Down
56 changes: 31 additions & 25 deletions grass7/raster/r.fuzzy.set/r.fuzzy.set.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ <h2>OPTIONS</h2>
require null values.
</dd>
<dt><b>points</b></dt>
<dd>A list containing 4 (A,B,C,D) or 2 A,B) points defining set boundaries.
Points must not to be in map range, but it may lead to only 0 o 1 membership for
the whole map. For "both" side parameters range between A and D defines base,
<dd>A list containing 4 (A,B,C,D) or 2 (A,B) points defining set boundaries.
Points do not have to be in map range, but this may lead to only 0 o 1 membership for
the whole map. For side parameter "both", range between A and D defines base,
but range between B and C core of the fuzzy set. Between A and B and C and D are
set's boundaries. If side is "both" it require 4 points, else 2 points.
<center>
Expand All @@ -16,7 +16,7 @@ <h3>Fuzzy set definition:</h3>
</center>
</dd>
<dt><b>side</b></dt>
<dd>Option indicate if set is fuzzified of both sides (both), left or right
<dd>Option indicates if set is fuzzified of both sides (both), left or right
side. See description for details.
<center>
<h3>Boundary definition:</h3>
Expand All @@ -42,7 +42,7 @@ <h2>FUZZY SET PARAMETERS</h2>
<dt><b>shape</b></dt>
<dd>Optional shape modifier. Range from -1 to 1. The default value is 0 and
should not be changed in most of the time. The negative values indicate more
dilatant set, the positive values more concentrate set. See description for
dilatant set, the positive values more concentrate set. See NOTES for
details.
<center>
<h3>Impact of shape parameter on shape boundary:</h3>
Expand All @@ -51,22 +51,22 @@ <h3>Impact of shape parameter on shape boundary:</h3>
</dd>
<dt><b>height</b></dt>
<dd>Optional height modifier. Range from 0 to 1. The default value is 1 and
indicate full membership between points B and C. If height is lesser than one the
indicates full membership. If height is less than one the
maximum membership is equal to height. See image: Fuzzy set definition.</dd>
</dl>

<h2>DESCRIPTION</h2>

<h4>Definition of fuzzy set</h4>
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
introduced Fuzzy sets as an extension of the classical notion of sets. 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 assessment of the
membership of elements in a set. A membership function valued in the real unit
interval [0, 1]. Classical sets, are special cases of the membership functions
of fuzzy sets, if the latter 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
fuzzy set theory usually called crisp sets. Fuzzy set theory can be used in
a wide range of domains in which information is imprecise, including many
GIS operations.


Expand All @@ -78,10 +78,10 @@ <h4>Calculation of boundary shape</h4>
<b>Linear:</b> the membership is calculated according following equation:<br>
<pre><code>
value <= A -> x = 0
A< value > B -> x = (value-A)/(B-A)
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
C < value > D -> x = (D-value)/(D-C)
value >= D -> x = 0

where x: membership
</code></pre>
Expand Down Expand Up @@ -117,31 +117,37 @@ <h4>Calculation of boundary shape</h4>
<h2>SEE ALSO</h2>

<em>
<a href="r.fuzzy.logic.html">r.fuzzy.logic</a>,
<a href="r.fuzzy.logic.html">r.fuzzy.logic</a> addon,
<a href="r.fuzzy.system.html">r.fuzzy.system</a> addon,
<a href="r.mapcalc.html">r.mapcalc</a>,
</em>


<h2>REFERENCES</h2>

<p>Zadeh, L.A. (1965). "Fuzzy sets". Information and Control 8 (3): 338–353.
doi:10.1016/S0019-9958(65)90241-X. ISSN 0019-9958.</P>
<ul>
<li>Jasiewicz, J. (2011). A new GRASS GIS fuzzy inference system for massive data analysis.
Computers & Geosciences (37) 1525-1531. DOI <a href=https://doi.org/10.1016/j.cageo.2010.09.008">https://doi.org/10.1016/j.cageo.2010.09.008</a>

<p>Novák, Vilém (1989). Fuzzy Sets and Their Applications. Bristol: Adam Hilger.
ISBN 0-85274-583-4.</P>
<li>Zadeh, L.A. (1965). "Fuzzy sets". Information and Control 8 (3): 338–353.
<a href="https://doi.org/10.1016/S0019-9958(65)90241-X"><a href="https://doi.org/10.1016/S0019-9958(65)90241-X"</a>.

<p>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.</P>
<li>Novák, Vilém (1989). Fuzzy Sets and Their Applications. Bristol: Adam Hilger.
ISBN 0-85274-583-4.

<p>Klir, George J.; St Clair, Ute H.; Yuan, Bo (1997). Fuzzy set theory:
<li>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.

<li>Klir, George J.; St Clair, Ute H.; Yuan, Bo (1997). Fuzzy set theory:
foundations and applications. Englewood Cliffs, NJ: Prentice Hall. ISBN
0133410587.</P>
0133410587.

<p>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/.</P>
<li>Meyer D, Hornik K (2009a). Generalized and Customizable Sets in R. Journal of
Statistical Software, 31(2), 1-27. DOI <a href="https://doi.org/10.18637/jss.v031.i02">https://doi.org/10.18637/jss.v031.i02</a>

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.<p>
<li>Meyer D, Hornik K (2009b). sets: Sets, Generalized Sets, and Customizable Sets.
R~package version~1.0, URL <a href="http://CRAN.R-project.org/package=sets">http://CRAN.R-project.org/package=sets</a>.
</ul>

<h2>AUTHOR</h2>
Jarek Jasiewicz
Expand Down
2 changes: 1 addition & 1 deletion grass7/raster/r.fuzzy.system/flood.map
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ $ veryfar {left; 200,300; sshaped; 0; 1}

%accum_abs
$ low {right; 500,5000; sshaped; 0; 1}
$ $ high {left; 500,5000; sshaped; 0; 1}
$ high {left; 500,5000; sshaped; 0; 1}

#output map

Expand Down
12 changes: 6 additions & 6 deletions grass7/raster/r.fuzzy.system/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*
* MODULE: r.fuzzy.system
* AUTHOR(S): Jarek Jasiewicz <jarekj amu.edu.pl>
* PURPOSE: Full fuzzy logic standalone classification system with few fuzzy logic families
* PURPOSE: Fuzzy logic classification system with several fuzzy logic families
* implication and defuzzification and methods.
* COPYRIGHT: (C) 1999-2010 by the GRASS Development Team
*
Expand Down Expand Up @@ -62,7 +62,7 @@ int main(int argc, char **argv)
G_add_keyword(_("raster"));
G_add_keyword(_("fuzzy logic"));
module->description =
_("Full fuzzy logic standalone classification system with few fuzzy "
_("Fuzzy logic classification system with multiple fuzzy "
"logic families implication and defuzzification and methods.");

file_vars = G_define_standard_option(G_OPT_F_INPUT);
Expand All @@ -80,7 +80,7 @@ int main(int argc, char **argv)
par_family->type = TYPE_STRING;
par_family->options = "Zadeh,product,drastic,Lukasiewicz,Fodor,Hamacher";
par_family->answer = "Zadeh";
par_family->required = YES;
par_family->required = NO;
par_family->description = _("Fuzzy logic family");
par_family->guisection = _("Advanced options");

Expand All @@ -90,7 +90,7 @@ int main(int argc, char **argv)
par_defuzzify->options =
"centroid,bisector,min_of_highest,max_of_highest,mean_of_highest";
par_defuzzify->answer = "bisector";
par_defuzzify->required = YES;
par_defuzzify->required = NO;
par_defuzzify->description = _("Defuzzification method");
par_defuzzify->guisection = _("Advanced options");

Expand All @@ -99,15 +99,15 @@ int main(int argc, char **argv)
par_implication->type = TYPE_STRING;
par_implication->options = "minimum,product";
par_implication->answer = "minimum";
par_implication->required = YES;
par_implication->required = NO;
par_implication->description = _("Implication method");
par_implication->guisection = _("Advanced options");

par_resolution = G_define_option();
par_resolution->key = "res";
par_resolution->type = TYPE_INTEGER;
par_resolution->answer = "100";
par_resolution->required = YES;
par_resolution->required = NO;
par_resolution->description = _("Universe resolution");
par_resolution->guisection = _("Advanced options");

Expand Down
Loading

0 comments on commit 9a587e4

Please sign in to comment.