Fuzzy Variable
Verb: fuzzyVariable
Available from: <Enterprise>
Defines a fuzzy variable, also known as a linguistic variable, based on the fuzzy sets specified in their Labels.
Syntax
fuzzyVariable --left(Numeric) --right(Numeric) --labels(FuzzySet) (Fuzzy)=value
Inputs
Script | Designer | Required | AcceptedTypes | Description |
---|---|---|---|---|
--left | Left | Required | Number | Maximum range on the left side of the plan the variable represents. |
--right | Right | Required | Number | Maximum range on the right side of the plan the variable represents. |
--labels | Labels | Required | Fuzzy Set | Fuzzy sets to be represented in the concept formed in the variable. |
Outputs
Script | Designer | AcceptedTypes | Description |
---|---|---|---|
value | Result | Fuzzy | Fuzzy variable composed of fuzzy sets informed in their Labels. |
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
The Begin Fuzzy command starts the fuzzy logic set, and the End Fuzzy command terminates it.