Table of Contents


Designating variables as input and output

For maximum flexibility, the fuzzy inference engine can accept values for designated variables from other Java programs through an external input buffer, and it can write variables' values to an external output buffer when inferencing is complete. The InputVariables and OutputVariables statements allow you to designate which defined variables are to receive input from and write output to the external buffers.

On this page...


InputVariables

You can give your variables initial values during inferencing by using assertions in your rules, but this isn't very practical. For example, you might code someRule: a = 1 to assign the variable a the value of 1. But this means that every time the ruleset is processed, the variable a starts out with the value of 1. Sometimes you may want the variable to start out with the value of 2 or 3 or 100 or some other value. You can accomplish this with the InputVariables statement, which is used to identify those variables whose initial values are to be obtained from an external input buffer just before inferencing starts.

Syntax

   InputVariables ( <variableNames>* )
      

Parameters

       <variableNames>
Is a list of zero or more identifiers that name previously defined variables. If there is an input buffer at runtime, the first element in the input buffer is assigned to the first named variable, the second element in the input buffer is assigned to the second named variable, and so on. If there is no input buffer at runtime, or if there are not enough values in the input buffer, a runtime error is signaled. Extra values in the buffer are ignored.

Note that if you leave the InputVariables statement empty, the inference engine will not expect to have an input buffer at runtime, and will not do any related error checking.

Note, too, that variables can also take on values that are the result of calling Sensors. See the Fuzzy Rule Language Documentation for details.

Examples


   InputVariables()       // No input variables expected at runtime

   InputVariables(a, b)   // Input buffer must contain at least two
                          //   values: the first value is assigned
                          //   to variable a, the second value to b.

   InputVars ( c d )      // Input buffer must contain at least two
                          //   values: the first value is assigned
                          //   to variable c, the second value to d.
      

InputVariables is a required statement although its content may be empty.

Return to top

OutputVariables

Similar to the InputVariables statement is the OutputVariables statement. Use this statement to designate those variables whose values are to be placed into an external output buffer after inferencing is complete, so that the values may be read by another Java program.

Syntax

   OutputVariables ( <variableNames>* )
      

Parameters

       <variableNames>
Is a list of zero or more identifiers that name previously defined variables. At the end of inferencing, the first element placed in the output buffer is the value of the first named variable, the second element placed in the output buffer is the value of the second named variable, and so on.

If you leave the OutputVariables statement empty, the inference engine will not write any values to an output buffer.

Note that variable values can be passed to other programs by calling Effectors. See the Fuzzy Rule Language Documentation for details.

Finally, you should know that the value of a fuzzy (or Continuous) variable is always presented to the external world as a defuzzified crisp value.

Examples


   OutputVariables()      // No output variables written at runtime

   OutputVariables(a, b)  // Output buffer will contain two elements:
                          //   the first element is the value of 
                          //   variable a, the second element the
                          //   value of variable b.

   OutputVars ( c c )     // Output buffer will contain two elements:
                          //   the first element is the value of
                          //   variable c, the second element is
                          //   also the value of variable c.
      

OutputVariables is a required statement although its content may be empty.

Return to top
Rule language table of contents.
Fuzzy editor table of contents.
Fuzzy System table of contents.

Last modified: Wed Apr 19 11:32:55 CDT 2000