Table of Contents


Defining variables

Variables are declared in the Variables( ... ) section of a ruleset; this section appears immediately after any ruleset option statements.

There are four types of variables that you can define. Of these, Boolean, Numeric, and Symbolic operate in the normal boolean way. Continuous is the fuzzy variable type over which fuzzy sets can be defined, and "pure" fuzzy rulesets will restrict themselves to the Continuous variable type only. However, if you understand the implications of mixing boolean logic with fuzzy logic, rulesets may use any of these variable types.

On this page...


Boolean

Boolean variables can have one of two values: either true or false. You must specify an initial value for the variable when you declare it.

Syntax

   <variableName> Boolean ( True | False )
      

Parameters

       <variableName>
Is an identifier that names the variable.

Example

   isMale Boolean(True)
      
Return to top

Continuous

Continuous variables are defined over a domain of continuous numbers. Within this range of numbers, one or more fuzzy sets must be defined; therefore, the SetDefinitions(...) statement with at least one fuzzy set definition is always required to follow a Continuous variable declaration.

The keyword "to" is optional or it may be replaced with a comma.

Syntax

   <variableName> Continuous (<low> [to | ,] <high> )
      SetDefinitions( <fuzzySetDeclarations>+ )
      

Parameters

       <variableName>
Is an identifier that names the variable.
       <low>
Specifies the lowest value that this variable can be assigned.
       <high>
Specifies the highest value that this variable can be assigned.
       <fuzzySetDeclarations>
Specifies the fuzzy sets defined over this variable.

Examples

   Percent_Complete Continuous(0 to 100) SetDefinitions( ... )
   Percent_Complete Continuous(0,100)    SetDefinitions( ... )
   Percent_Complete Continuous(0 100)    SetDefinitions( ... )
      
Return to top

Numeric

Numeric variables can be assigned any numeric value; internally, they are represented as Doubles.

Syntax

   <variableName> Numeric ( <initialValue> )
      

Parameters

       <variableName>
Is an identifier that names the variable.
       <initialValue>
Is a number that is the initial value of the variable.

Examples

   NumberOf_Enrollees Numeric(50)
   PercentComplete Numeric( 0.34 )
   decrementAmount Numeric(-5.0)
   incrementAmount Numeric(+10 )
      
Return to top

Symbolic

Symbolic variables essentially hold string data. However, these variables may not be assigned any arbitrary string; they must be assigned a value from a predefined list of values that you declare along with the variable. While you can declare numbers in the list of symbols, numbers are treated as strings. This means that the numbers 1 and 1.0, for example, are two different symbols and they do not compare equally.

You must define at least one symbol for a symbolic variable. The initial value of a symbolic variable is Fs_NULL_Fs. However, you may not test for this value, or assign this value unless you explicitly declare it in the symbol list for the variable.

Syntax

   <variableName> Symbolic ( <symbols>+ )
      

Parameters

       <variableName>
Is an identifier that names the variable.
       <symbols>
Is a list of one or more symbols (identifers and numbers), any one of which can be assigned to the variable at any given time.

Examples

   Color Symbolic( black, green, green.and.black, orange.and.black )
   Legs  Symbolic( 6, 8 )
   Shape Symbolic( elongated, round )
      
Return to top
Rule language table of contents.
Fuzzy editor table of contents.
Fuzzy System table of contents.

Last modified: Wed Apr 19 11:35:11 CDT 2000