End Fuzzy

Verb: endFuzzy

Available from: <Enterprise>

Ends a fuzzy logic set initiated by the Begin Fuzzy command.

Syntax

endFuzzy

Example

A fuzzy logic set is initiated using the Begin Fuzzy command, with Intervals = 1000. Then the Fuzzy Variable command creates fuzzy logic through a variable to measure the service quality of a restaurant. The End Fuzzy command terminates the set.

defVar --name low --type FuzzySet
defVar --name medium --type FuzzySet
defVar --name good --type FuzzySet
defVar --name serviceQuality --type Fuzzy
defVar --name foodQuality --type Fuzzy
defVar --name littleTip --type FuzzySet
defVar --name reasonableTip --type FuzzySet
defVar --name generousTip --type FuzzySet
defVar --name tip --type Fuzzy
defVar --name foodGrade --type Numeric --value "7.5"
defVar --name serviceGrade --type Numeric --value 6
defVar --name tipValue --type Numeric
beginFuzzy --intervals 1000
   fuzzySet --function "Trapezoidal" --shape "Number" --edge "Right" --m1 0 --m2 5 low=value
   fuzzySet --function "Trapezoidal" --shape "Triangular" --m1 3 --m2 5 --m3 7 medium=value
   fuzzySet --function "Trapezoidal" --shape "Number" --edge "Left" --m1 5 --m2 10 good=value
   fuzzyVariable --left 0 --right 10 --labels "${low} ${medium} ${good}" serviceQuality=value
   fuzzyVariable --left 0 --right 10 --labels "${low} ${medium} ${good}" foodQuality=value
   fuzzySet --function "Trapezoidal" --shape "Number" --edge "Right" --m1 0 --m2 12.5 littleTip=value
   fuzzySet --function "Trapezoidal" --shape "Triangular" --m1 6.25 --m2 12.5 --m3 18.75 reasonableTip=value
   fuzzySet --function "Trapezoidal" --shape "Number" --edge "Left" --m1 12.5 --m2 25 generousTip=value
   fuzzyVariable --left 0 --right 25 --labels "${littleTip} ${reasonableTip} ${generousTip}" tip=value
   
//The food was rancid or the service was poor.
   fuzzyRule --name "Terrible food or service" --condition "${foodQuality} IS ${low} OR ${serviceQuality} IS ${low}" --variable ${tip} --set ${littleTip}
   
//The service was reasonable.
   fuzzyRule --name "Average service" --condition "${serviceQuality} IS ${medium}" --variable ${tip} --set ${reasonableTip}
   
//The food was delicious or the service was good.
   fuzzyRule --name "Great Food or Service" --condition "${foodQuality} IS ${good} OR ${serviceQuality} IS ${good}" --variable ${tip} --set ${generousTip}
endFuzzy
setVar --name "${foodQuality}" --value "${foodGrade}"
setVar --name "${serviceQuality}" --value "${serviceGrade}"
evaluate --expression "${tip}" tipValue=value
logMessage --message "Tip Value: ${tipValue};\r\nFood Grade: ${foodGrade};\r\nService Grade: ${serviceGrade}" --type "Info"

Remarks

Begin Fuzzy is required to start the fuzzy logic set.

See Also

  • Begin Fuzzy
  • Fuzzy Rule
  • Fuzzy Sets
  • Fuzzy Variable