Fuzzy markup language: Difference between revisions

Content deleted Content added
Tags: Mobile edit Mobile web edit Advanced mobile edit
m Task 70: Update syntaxhighlight tags - remove use of deprecated <source> tags
Line 68:
In order to make an example, consider the ''Tipper Inference System'' described in Mathwork Matlab Fuzzy Logic Toolbox Tutorial. This Mamdani system is used to regulate the tipping in, for example, a restaurant. It has got two variables in input (''food'' and ''service'') and one in output (''tip''). FML code for modeling part of knowledge base of this fuzzy system containing variables ''food'' and ''tip'' is shown below.
 
<sourcesyntaxhighlight lang="xml">
<?xml version="1.0" encoding="UTF-8"?>
<FuzzyController name="newSystem" ip="127.0.0.1">
Line 96:
............
</FuzzyController>
</syntaxhighlight>
</source>
 
A special tag that can furthermore be used to define a fuzzy shape is <code><UserShape></code>. This tag is used to customize fuzzy shape (custom shape). The custom shape modeling is performed via a set of <code><Point></code> tags that lists the extreme points of geometric area defining the custom fuzzy shape. Obviously, the attributes used in <code><Point></code> tag are x and y coordinates.
Line 107:
Let us see how FML defines a rule base with this rule.
 
<sourcesyntaxhighlight lang="xml">
<RuleBase name="Rulebase1" activationMethod="MIN" andMethod="MIN" orMethod="MAX" type="mamdani">
<Rule name="reg1" connector="or" operator="MAX" weight="1.0">
Line 129:
............
</RuleBase>
</syntaxhighlight>
</source>
 
Now, let us see a Takagi-Sugeno-Kang system that regulates the same issue. The most important difference with Mamdani system is the definition of a different output variable ''tip''. The <code><TSKVariable></code> tag is used to define an output variable that can be used in a rule of a Tsk system. This tag has the same attributes of a Mamdani output variable except for the ''domainleft'' and ''domainright'' attribute because a variable of this kind (called tsk-variable) hasn't a universe of discourse. The nested <code><TSKTerm></code> tag represents a linear function and so it is completely different from <code><FuzzyTerm></code>. The <code><TSKValue></code> tag is used to define the coefficients of linear function. The following crunch of FML code shows the definition of output variable ''tip'' in a Tsk system.
 
<sourcesyntaxhighlight lang="xml">
<?xml version="1.0" encoding="UTF-8"?>
<FuzzyController name="newSystem" ip="127.0.0.1">
Line 156:
..........
</FuzzyController>
</syntaxhighlight>
</source>
 
The FML definition of rule base component in a Tsk system doesn't change a lot. The only different thing is that the <code><Clause></code> tag doesn't have the modifier attribute.
Line 166:
Let us see how FML defines a rule base with this rule.
 
<sourcesyntaxhighlight lang="xml">
<RuleBase name="Rulebase1" activationMethod="MIN" andMethod="MIN" orMethod="MAX" type="tsk">
<Rule name="reg1" connector="or" operator="MAX" weight="1.0">
Line 188:
............
</RuleBase>
</syntaxhighlight>
</source>
 
===FML Grammar===
The FML tags used to build a fuzzy controller represent the set of lexemes used to create fuzzy expressions. However, in order to realize a well-formed XML-based language, an FML context-free grammar is necessary and described in the following. The FML context-free grammar is modeled by XML file in the form of a XML Schema Document (XSD) which expresses the set of rules to which a document must conform in order to be considered a ''valid'' FML document. Based on the previous definition, a portion of the FML XSD regarding the knowledge base definition is given below.
 
<sourcesyntaxhighlight lang="xml">
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
Line 350:
..........
</xs:schema>
</syntaxhighlight>
</source>
 
===FML Synthesis===