XFL3: The Xfuzzy 3 specification language

Crisp function definition

Crisp functions are used to describe mathematical operations among variables with non-fuzzy values. These functions can be assigned to crisp modules which can be included in the modular hierarchy of fuzzy systems. The structure of a crisp function definition in a function package is as follows:

		crisp identifier { blocks }                     

The blocks that can appear in a crisp function definition are alias, parameter, requires, inputs, java, ansi_c, cplusplus and source.

The block alias is used to define alternative names to identify the function. Any of these identifiers can be used to refer the function. The syntax of the block alias is:

		alias identifier, identifier, ... ;                    

The block parameter allows the definition of those parameters which the function depends on. The last identifier can be followed by brackets to define a list of parameters. Its format is:

		parameter identifier, identifier, ..., identifier[] ;                    

The block requires expresses the constraints on the parameter values by means of a Java Boolean expression that validates the parameter values. The structure of this block is:

		requires { expression }                     

The block inputs defines the number of input variables of the crisp function by means of a Java expresion which must return an integer value. The syntax of this block is:

		inputs { Java_function_body }                     

The blocks java, ansi_c and cplusplus describe the function behavior by means of its description as a function body in Java, C and C++ programming languages, respectively. The variable 'x[]' contains the values of the input variables. The format of these blocks is the following:

		java { Java_function_body } 
		ansi_c { C_function_body } 
		cplusplus { C++_function_body } 

The block source is used to define Java code that is directly included in the class code generated for the function definition. This code allows to define local methods that can be used into other blocks. The structure is:

		source { Java_code }                    

The following example shows the definition of a crisp function which sums N input values.

 crisp addN {
        parameter N;
        requires { N>0 }
        inputs { return (int) N; }
        java { 
         double a = 0;
         for(int i=0; i<N; i++) a+=x[i];
         return a;
        }
        ansi_c { 
         int i;
         double a = 0;
         for(i=0; i<N; i++) a+=x[i];
         return a;
        }
        cplusplus { 
         double a = 0;
         for(int i=0; i<N; i++) a+=x[i];
         return a;
        }
       } 

For comments, patches, bug reports, etc contact us at:   xfuzzy-team@imse-cnm.csic.es

©IMSE-CNM 2018