Section: User Commands (1)
Updated: 10 Sep 2001
xfj - xfl to Java compiler
takes an xfl file and produces a set of Java source files which implement the fuzzy types and the inference engine defined in xfl as Java classes: one for each type and one for the inference engine. This classes can be used to obtain a Java implementation of the fuzzy inference engine or, combined with any other Java classes, used to produce programs containing fuzzy logic capabilities.
All arithmetic calculations in the Java classes produced by
are carried out in double precision, using Java native "double" variables.
Classes corresponding to xfl types have the same name of the type they implement and offer the following interface:
Three different constructors that initializes the status of the object:
to the center of the universe of discourse, in the case of the parameterless constructor.
to a given crisp value, if the constructor with a single "double" parameter is used.
to a given set of linguistic values, when the constructor that accepts an array of "double" values is used.
One static method for each membership function defined in the type, which calculates the membership degree of a given crisp value. The name of these methods is "toMFName", where "MFName" is the name of the corresponding membership function in the xfl type.
One method for each membership function defined in the type, which returns the current membership degree. The name of these methods is "getMFName", where "MFName" is the name of the correspnding membership function in the xfl type.
An overloaded version of the "equals" method to test for the equality of two objects belonging to the class that implements the xfl type.
A method called "fuzzy", which performs the fuzzification of a given crisp value, updating the object status.
The class corresponding to the inference engine offers the following interface:
A parameterless constructor.
One method for each of the outputs defined for the system, to perform defuzzification. The name of these methods is "outputNameCrisp", where "outputName" is the name of the corresponding output in the xfl system definition. These methods require a fuzzy variable (with the same type the output belongs to) as parameter.
A method with three different signatures. This method is called "iEngine" and carries out the inference process. The three different signatures correspond to the different ways to provide inputs and outputs:
In its first form, "iEngine" accepts inputs and returns outputs in fuzzy representation, i.e., using variables that belong to classes implementing xfl types.
In its second form, "iEngine" accepts crisp ("double") inputs and returns fuzzy outputs.
In its third form, "iEngine" accepts crisp inputs and returns crisp (defuzzified) outputs. In this case, an array of values is used. The mapping between elements in the array and the input/output elements is given by their order in the xfl definition.
Besides these methods, the engine class has a "main" static method that executes an inference using the values of the input variables passed as arguments in the invocation of the class.
Selects the mode of operation:
performs only the syntax and (static) semantics analysis of the xfl source, without producing any output.
generates only the Java source file for the engine class.
generates only the Java source files for the type classes.
(which is the default if no
option is specified) generates all Java source files.
- -O opsfile
as the fuzzy operations file. By default, either the user's operations file ("$HOME/.xfjops") or a system-wide file ("$XFUZZY_LIB/xfjops", where $XFUZZY_LIB is the directory holding the Xfuzzy libraries distribution) is used. The operations file allows the use of specific definitions of T-norms (for the
operator in xfl), T-conorms (for the
operators in xfl), negation functions (for the
operator in xfl), implication functions (for the
operator in xfl) and defuzzification methods (for the
operator in xfl). If no operations file can be accessed,
provides a set of internally defined fuzzy operations: the T-norm
(implementing the standard minimum operator), the T-conorm
(implementing the standard maximum operator), the negation
(implementing the 1-complement operator), the implication
(standard minimum again), and the defuzzification method
(the standard center-of-area method). Furthermore, these are the values used by
when any of the xfl operation selection operators is not present in the source file.
- -o outprefix
as the prefix for the output files. Any valid path component can be used. The default value is "./".
- -e engname
as the name of the class implementing the fuzzy inference engine. Any valid Java class identifier can be used. The default value is "XfIe".
comments to the Java files it generates. This option suppresses this behavior.
- -p packagename
include a package declaration in the output files. If type classes and the engine class are generated separately, it is important to note that the engine class code relies upon the assumption that it belongs to the same package that type classes.
Suppresses the printing of warning messages on stderr.
User's operations file (overriden by the
System-wide operations file (overriden by the user's operations file and the
A guide to xfl,
Xfuzzy user guide
- SEE ALSO