Fuzzy markup language: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 184:
 
 
===The second layer: 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.
 
<source lang="xml">
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
........
<xs:complexType name="KnowledgeBaseType">
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="FuzzyVariable" type="FuzzyVariableType"/>
<xs:element name="TSKVariable" type="TSKVariableType"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
<xs:complexType name="FuzzyVariableType">
<xs:sequence>
<xs:element name="FuzzyTerm" type="FuzzyTermType" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="defuzzifier" default="COG">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="MM|COG|COA|WA|Custom"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="accumulation" default="MAX">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="MAX|SUM"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="scale" type="xs:string" />
<xs:attribute name="domainleft" type="xs:float" use="required"/>
<xs:attribute name="domainright" type="xs:float" use="required"/>
<xs:attribute name="defaultValue" type="xs:float" default="0"/>
<xs:attribute name="type" default="input">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="input|output"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
<xs:complexType name="FuzzyTermType">
<xs:choice>
<xs:element name="RightLinearShape" type="TwoParamType"/>
<xs:element name="LeftLinearShape" type="TwoParamType"/>
<xs:element name="PIShape" type="TwoParamType"/>
<xs:element name="TriangularShape" type="ThreeParamType"/>
<xs:element name="GaussianShape" type="TwoParamType"/>
<xs:element name="RightGaussianShape" type="TwoParamType"/>
<xs:element name="LeftGaussianShape" type="TwoParamType"/>
<xs:element name="TrapezoidShape" type="FourParamType"/>
<xs:element name="SingletonShape" type="OneParamType"/>
<xs:element name="RectangularShape" type="TwoParamType"/>
<xs:element name="ZShape" type="TwoParamType"/>
<xs:element name="SShape" type="TwoParamType"/>
<xs:element name="UserShape" type="UserShapeType"/>
</xs:choice>
..........
</xs:schema>
</source>
 
 
===The third layer: FML Synthesis===
Since an FML program realizes only a static view of a fuzzy system, the so-called eXtensible Stylesheet Language Translator (XSLT) is provided to change this static view to a computable version. In particular, the XSLT technology is used convert a fuzzy controller description into a general-purpose computer language to be computed on several hardware platforms. Currently, a XSLT converting FML program in runnable Java code has been implemented. In this way, thanks to the transparency capabilities provided by Java virtual machines, it is possible to obtain a fuzzy controller modeled in high level way by means of FML and runnable on a plethora of hardware architectures through Java technologies. However, XSLT can be also used for converting FML programs in legacy languages related to a particular hardware or in other general purpose languages.