XFL3: The Xfuzzy 3 specification language

Binary function definition

Binary functions can be assigned to the conjunction operator (and), the disjunction operator (or), the implication function (imp), and the rule aggregation operator (also). The structure of a binary function definition in a function package is as follows:

		binary identifier { blocks }                 

The blocks that can appear in a binary function definition are alias, parameter, requires, java, ansi_c, cplusplus, derivative 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 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. Input variables for these functions are 'a' and 'b'. The format of these blocks is the following:

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

The block derivative describes the derivative function with respect to the input variables 'a' and 'b'. This description consists of a Java assignation expression to the variable 'deriv[]'. The derivative function with respect to the input variable 'a' must be assigned to 'deriv[0]', while the derivative function with respect to the input variable 'b' must be assigned to 'deriv[1]'. The description of the derivative function allows to propagate the system error derivative used by the supervised learning algorithms based on gradient descent. The format is:

		derivative { Java_expressions }                             

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 the T-norm minimum, also used as Mamdani's implication function.

binary min {
      alias mamdani;
      java { return (a<b? a : b); }
      ansi_c { return (a<b? a : b); }
      cplusplus { return (a<b? a : b); }
      derivative {
      deriv[0] = (a<b? 1: (a==b? 0.5 : 0));
      deriv[1] = (a>b? 1: (a==b? 0.5 : 0));

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

©IMSE-CNM 2018