C H A P T E R
Implementation of new IO-methods
2
Fuzzifier’s and Defuzzifier’s job is to transform sharp value into a fuzzyset
respectively to calculate a sharp value out of a given fuzzyset. At present time
„FuzzIT “ supports the singleton- and triangular fuzzification. „On the other
end of the controller“ the user chooses „Center of Gravity“ or „Mittle of
Maxima“ for the defuzzification. The calculation specifications of fuzzfiers are
nearly identically to defuzzifiers. The way is explaind on a fuzzifier.
Using the drop-down list „method“ the user selects a kind of fuzzification (see
Illustration 2-1) For computation of a fuzzyset the fuzzify-method will be invo-
ked (for Defuzzifers the method is called defuzzify ). the method picks the
index of the selected MenuItems out and invokes for its part the final method,
which realizes the fuzzification and/or defuzzification. Index value decides,
which kind of fuzzification is used.
Illustration 2-1
In this Tutorial is to be demonstrated, in which places FuzzIT must be modi-
fied, so that a new fuzzification and/or defuzzification kind becomes available.
1
2 Kapitel 2. Implementation of new IO-methods
Mainly you work on the Fuzzifier and Defuzzifier classes and the .properties
Files, which are responsible for the internationalization.
2.1 GetMethods
In both classes fuzzifier and defuzzifier a method called GetMethods is decla-
red. The method returns a list of Strings. Each string holds the name of availa-
ble fuzzification or defuzzification method. The Illustration 2-2 shows the
listing of getMethods in the fuzzifier class. In order to be able to select a new
(de)fuzzification method in the editing window, an appropriate String1 must be
added to the list. It is recommended to insert each new method name at the end
of the list, thereby the existing allocation of indicies and methods is obtained.
At the same time you have to declare a new constant literal that holds the index
value of the new inserted name.
Illustration 2-2
2.2 Fuzzify and defuzzify
The task of the methods fuzzify and/or defuzzify is to interpret the user inputs
and to invoke the correct (de)fuzzification method. As you see in Illustration 2-
3, both is realized by the SWITCH-statement. The expression getTypeOrMe-
thod returns the index of the momentarily selected (de)fuzzification method.
Depending on its value the appropriate case will be executed. To integrate a
new kind of fuzzification or defuzzification in fuzzify or defuzzify, it is ade-
quate to define a new case statement followed by the constant that provides
index value of this new (de)fuzzification kind. Within case block a last method
is invoked, which realizes the actual (de)fuzzification.
1. To keep „ FuzzIT“ international, it’s approprate to regard the string as a key-
word. This keyword has to be inserted together with a suitable translation to the
.properties files. At present time the languages english and german are suppor-
ted.
Kapitel 2.3. The calculation algorithm 3
Illustration 2-3
2.3 The calculation algorithm
In the last step the actual fuzzification and/or defuzzification algorithm must be
written. For this you have to define a new method, which carries the same name
as in case-block of fuzzify or defuzzify written. The algorithm code must be
written inside this method. Each method should be declared public and final.
Distinctive feature for fuzzification or defuzzification method is the return
value or object. A fuzzification method returns a object of FSet, because the
aim of each fuzzification is to transform a sharp value into a fuzzyset. On the
other side a defuzzification method returns a sharp value, a double. In principle
, before leaving the method by the return-statement, each computed result
should be stored in the fuzzifier or defuzzifier. That is necessarily, some objects
revert to these results. To store a fuzzyset you have to use the method setFuz-
zyIO. For storing a sharp value there is a method called setCrispIO.
4 Kapitel 2. Implementation of new IO-methods