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.
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.
InputVariables ( <variableNames>* )
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.
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 topSimilar 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.
OutputVariables ( <variableNames>* )
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.
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