You are on page 1of 6

Using Fuzzy Technology

in Ambient Intelligence Environments


Giovanni ACAMPORA and Vincenzo LOIA

Dipartimento di Matematica e Informatica


Università di Salerno, 84084 Fisciano (Salerno) ITALY, e-mail:(gacampora, loia)@unisa.it

Abstract—Ambient Intelligence (AmI, shortly) gathers best back, is capable to modify the corresponding actions
results from three key technologies, Ubiquitous Computing, have been or will be performed.
Ubiquitous Communication, and Intelligent User Friendly Inter-
faces. The functional and spatial distribution of tasks is a natural
We have designed and implemented an intelligent home envi-
thrust to employ multi-agent paradigm to design and implement
AmI environments. Two critical issues, common in most of ap- ronment populated by intelligent appliance agents skilled to
plications, are (1) how to detect in a general and efficient way perform distributed and adaptive “transparent” fuzzy control.
“context” from sensors and (2) how to process contextual infor- The agents interact and coordinate their activities using the
mation in order to improve the functionality of services. In this Fuzzy Mark-up Language [3] (FML) as abstract protocol over
work we experiment a framework where hybrid techniques (dis- shared resources, independently from hardware constraints.
tributed fuzzy control, mobile agents, fuzzy rules induction algo-
The agents compose an abstract layer that binds the instru-
rithms) are mixed to gain flexibility and uniformity.
Keywords: Distributed Fuzzy Control, Mark-up Languages, mental scenario with the services, assuring efficiency and
Agents, Fuzzy Rule Induction Algorithms. adaptivity. This approach allows AmI designers to achieve
useful goals :
I. INTRODUCTION
• to customize the control strategy on specific hardware
When designing AmI Environments [1], different methodolo- through an automatic procedure;
gies and techniques have to be used, ranging from materials • to distribute fuzzy control flow in order to minimize
science, business models, network architectures, up to human global deduction time and better exploit the natural dis-
interaction design. However, as key technologies, AmI is tributed knowledge repositories;
characterizes by: • to acquire, at run time, the user’s behavior and environ-
• Embedded. Devices are (wired or unwired) plugged into ment status in order to apply context-aware adaptivity;
the network. The resulting system consists of several and
multiple devices, compute equipments and software sys- In the remainder of this paper, we will describe our solution
tems that must interact among them. Some of the devices that attempts to solve these complicated problems.
are “simple” sensors, other ones are “actuator” owning a First, we will describe how we have used XML-derived tech-
crunch of control activity on the environment (central- nologies in order to define FML, a markup language skilled
heating, security systems, lightning system, washing ma- for defining detailed structure of fuzzy control independent
chines, refrigerator, etc.). The strong heterogeneity from its legacy representation. Then, we will show the gain
makes difficult a uniformed policy-based management. achievable in terms of distribution and concurrent execution
• Context aware. This term appeared for the first time in by means of agent technology. As last issue, we will describe
[2], where the authors defined context as location, identi- an adaptive methodology, based on inductive computation,
ties of nearby people and objects, and changes to those that allows fuzzy rules to modify themselves according to
objects. Many research groups have been investigating user’s behaviors.
on context-aware applications, but there is no common
understanding what ‘context’ and ‘context awareness’ II. FUZZY MARK-UP LANGUAGE
exactly means. Roughly, the system should own a certain
ability to recognize people and the situational context. Legacy Fuzzy Environment module permits to create a fuzzy
• Personalized. AmI environments are designed for peo- controller using a legacy representation. An example of Leg-
ple, not generic users. This means that the system should acy Fuzzy Environment module is Matlab™ that produce a
be so flexible to tailor itself to meet human needs. .fis file to represent the fuzzy control system. The obtained
• Adaptive. The system, being sensible to the user’s feed- legacy fuzzy controller is passed to the FML Converter mod-

0-7803-9158-6/05/$20.00 © 2005 IEEE. 465 The 2005 IEEE International Conference on Fuzzy Systems
ule that translates it into a markup-based description (fml lan- controller basic concepts of FLC into a tree structure, as
guage). Next step concerns the real implementation of the shown in Figure 1, where each node can be modeled as a
fuzzy controller on specific hardware. XSLT [4] modules are FML tag, and the link father-child represents a nested relation
used to convert fml fuzzy controller in a general purpose between related tags. Currently, we are using FML for model-
computer language using an XSL [5] file containing the trans- ing two well-known fuzzy controllers: Mamdani and Takagi-
lation description. At this level, the control is executable for Sugeno-Kang (TSK) [9].
the hardware.

A. Fuzzy Markup Language (FML) & Fuzzy Logic


Control (FLC)
Since Zadeh’s coining of the term fuzzy logic [6] and Mam-
dani’s early demonstration of Fuzzy Logic Control (FLC) [7],
an enormous progress has been done by the scientific com-
munity in the theoretical as well as application fields of FLC.
Trivially, a fuzzy control allows the designer to specify the
control in terms of sentences rather than equations by replac-
ing a conventional controller, say, a PID (proportional-
integral-derivative) controller with linguistic IF-THEN rules.
The main components of a fuzzy controller are:

• Fuzzy Knowledge Base Figure 1 - Fuzzy Control Tree


• Fuzzy Rule Base
In order to model the Controller node of fuzzy tree, the FML
• Inference Engine
tag <FUZZYCONTROL> is created (this tag opens any
• Fuzzification sub-system
FML program). <FUZZYCONTROL> uses three tags: type,
• Defuzzification sub-system
defuzzyfyMethod and ip. The type attribute permits to specify
the kind of fuzzy controller, in our case Mamdani or TSK;
The Fuzzy Knowledge Base contains the knowledge used by
defuzzyfyMethod attribute defines the defuzzification method;
human experts. The Fuzzy Rule Base represents the set of re-
ip is used to define the location of controller in the computer
lations among fuzzy variable defined in the controller system.
net-work. Considering the left sub-tree, the knowledge base
The Inference Engine is the fuzzy controller component able
component is encountered. The fuzzy knowledge base is de-
to extract new knowledge from fuzzy knowledge base and
fined by means of the tag <KNOWLEDGEBASE> which
fuzzy rule base.
maintains the set of fuzzy concepts used to model the fuzzy
Extensible Markup Language (XML) [8] is a simple, very
control system. <FUZZYVARIABLE> defines the fuzzy
flexible text format derived from SGML (ISO 8879). Origi-
concept, for example “Luminosity”; <FUZZYTERM> de-
nally designed to meet the challenges of large-scale electronic
fines a linguistic term describing the fuzzy concept, for ex-
publishing, nowadays XML plays a fundamental role in the
ample “low”; the set of tags defining the shapes of fuzzy sets
exchange of a wide variety of data on the Web, allowing de-
are related to fuzzy terms. The attributes of
signers to create their own customized tags, enabling the defi-
<FUZZYVARIABLE> tags are: name, scale, domainLeft,
nition, transmission, validation, and interpretation of data be-
domainRight, type, ip. The name attribute defines the name of
tween applications, devices and organizations. If we use
fuzzy concept (i.e. time of the day); scale defines how to to
XML, we take control and responsibility for our information,
measure the fuzzy concept (i.e. hour); domainLeft and do-
instead of abdicating such control to product vendors. This is
mainRight model the universe of discourse of fuzzy concept
the motivation under FML proposal: to free control strategy
in terms of real values (i.e. [0000, 2400]); the role of variable
from the device. FML uses:
(i.e. independent or dependent variable) is defined by type
attribute; ip locates the position of fuzzy knowledge base in
• XML in order to create a new markup language for FLC
the computer network.
• DTD in order to define the legal building blocks of an <RULEBASE permits to build the rule base associated with
XML document. the fuzzy controller. The other tags related to this definiton
• XSLT in order to convert fuzzy controller description are: <RULE>, <ANTECEDENT>, <CONSEQUENT>,
into a programming language code. <CLAUSEA>, <CLAUSEC>, <VARIABLE>, <TERM>,
<TSKPARAM>. The meaning of these tags appears evident
In this way, we can map a detailed logical structure of a fuzzy and we do not further detail here.

466 The 2005 IEEE International Conference on Fuzzy Systems


B. Distributed Fuzzy Control sible to associate a fuzzy control activity (knowledge base
and eventually the rule base) on a single host (in our example
Just to give a concrete example, considering automatic light-
localhost). In this naïve example, a centralized Mamdani
ing system, we can model the knowledge base and rule base
fuzzy controller is produced, but in real cases, a distributed
FML code portion, and in particular the lamp light level as
approach is performed, as illustrated in Figure 2.
follows (Mamdani method):
This feature is useful to obtain several advantages:
<!DOCTYPE FUZZYCONTROL SYSTEM "fml.dtd">
<FUZZYCONTROL defuzzymethod = "CENTROID" a) to parallelize the fuzzy inference engine reducing infer-
ip = "localhost" type = "MAMDANI">
<KNOWLEDGEBASE IP = "localhost"> ence time and minimizing knowledge base and rule base
<FUZZYVARIABLE occupancy;
domainleft = "0" domainright = "1" b) to manage distributed knowledge environment, i.e. envi-
ip = "localhost" name = "Luminosity"
scale = "Lux" type = "INPUT">
ronments in which the global knowledge is shared on
many points of interested environment, as often happens
<FUZZYTERM name="low"> in AmI;
<PISHAPE
param1 = "0.0"
c) to exploit mobile agents as a natural and efficient tech-
param2 = "0.45"> nology to share data distribution and dispatch running
</PISHAPE> code on a network. This last concept is deepened in the
</FUZZYTERM>
last part of the paper.
<FUZZYTERM name="MEDIUM">
<PISHAPE In order to distribute fuzzy controller components on differ-
param1 = "0.49999999999999994"
ent hosts we need to characterize the independent members of
param2 = "0.44999999999999996">
</PISHAPE> controller. In particular, working with Mamdani we identify
</FUZZYTERM> the following components:
<FUZZYTERM name="HIGH">
<PISHAPE • Fuzzy Controller
param1 = "0.5501" • Knowledge Base
param2 = "1"> • Fuzzy Variable
</PISHAPE>
</FUZZYTERM> • Rule Base
</FUZZYVARIABLE> • Fuzzy Rule

</KNOWLEDGEBASE>
Default value of ip attribute of <FUZZYCONTROL> tag is
<RULEBASE localhost. The internet address value of fuzzy controller is
inferenceengine = "MINMAXMINMAMDANI"
ip = "localhost">
distributed towards the bottom in the parse tree related to
fuzzy program. From this point of view, the internet address
<RULE connector = "AND" ip = "localhost" of other independent components (knowledge base and rule
weight = "1" id = "r1">
<ANTECEDENT>
base), if not defined, is overlapped by network address from
<CLAUSEA not = "FALSE"> <FUZZYCONTROL> tag. This distributive concept is also
<VARIABLE> Luminosity </VARIABLE> extended to the nodes of the parse tree related to the rule base
<TERM> low </TERM>
</CLAUSEA>
and knowledge base: each member of the controller is spread
in a scalable and distributed way, as shown in Figure 2. Com-
<CLAUSEA not = "FALSE"> paring Figures 1 and 2 we better note the strong differences
<VARIABLE> hour </VARIABLE>
<TERM> morning </TERM>
between a centralized controller and a distributed one. In Fig-
</CLAUSEA> ure 1, all components of centralized controller are connected
</ANTECEDENT> by straight lines indicating that all components (knowledge
<CONSEQUENT> base, rule base and related sub components) are maintained
<CLAUSEC not = "FALSE"> on the same host at the same time. Figure 2 shows a distrib-
<VARIABLE>dimmer</VARIABLE> uted fuzzy controller, the whose members, connected by dot-
<TERM>medium</TERM>
</CLAUSEC> ted lines, can be treated concurrently by different processes.
</CONSEQUENT> In particular, Figure 2 shows a distributed fuzzy controller
</RULE>

with Luminosity and Time of the day concepts hosted on
</RULEBASE> 192.168.0.4, Dimmer concept hosted on 192.168.0.8 and the
This crunch of FML code is useful to understand how is pos- rule base shared on 192.168.0.5, 192.168.0.6, 192.168.0.7.

467 The 2005 IEEE International Conference on Fuzzy Systems


In this way, we can distribute fuzzy rule base in the network sor), communicates its actual status in order to model the en-
and exploit distributed processing by minimizing inference. vironment status when the user’s action occurred.
In order to address in a high-level way the issues of delocali-
zation and concurrency, we map the distributed fuzzy model
coded in FML on a multi-agents system. In particular, the
agents that compose the system are: Stationary Fuzzy Agent
set, Registry Agent, Inference Agent. The set of Stationary
Fuzzy Agent is used to manipulate in a distributed way the
concept coded in FML program and modeled in the distrib-
uted fuzzy controller. These agents represent the run time
containers able to execute the fuzzy logic operator on mod-
eled entity. Stationary Fuzzy Agents are hosted on different
host of network; these hosts represent the Fuzzy Control
Network (FCN). The Inference Agent is a migrating agent
able to apply the classic inference operator, like Mamdani
MinMaxMin or Larson Product on hosts running the Station-
ary Agents.
Due to the delocalization of rules, it is necessary to collect the
partial inference results. This is done by the migration of In- Figure 2 - Distributed Fuzzy Control Tree
ference Agent that gathers the partial results available on each Formally, the AmI feature is composed by two parts, as
Stationary. Just to give an idea of the gain from shifting from shown in Figure 5, (1) AmI environment status matrix; (2)
a centralized to a decentralized evaluation, we give in Figure user’s actions vector. In particular, the ith column of matrix
3 the results from a testbed done by spreading the control represents the environment status captured during ith user’s
over three computational nodes. On the axis x we report the action execution which is represented by the ith entry of user’s
number of fuzzy rules evaluated, the required inference time, action vector. The size of the user’s action vector (the num-
expressed in milliseconds, is on axis y. ber of columns of AmI environment status matrix) reflects the
required completeness of feature space necessary to trigger
III. CONTEXT-AWARE ADAPTIVITY the learning mode functionality. In practice, the size depends
Such layer implements an evolutionary-based mechanism in on the specific application.
order to customize the services available in the AmI environ-
ment. This goal is achieved by producing new fuzzy rules that
100
correspond to personalized control activities of the involved
components. In particular, for each actuator plugged in the 80
AmI network a software agent implements the adaptive algo-
Inference Time

rithm that produces the corresponding FML control code. The 60


overall process is based on two basic functionalities: learning 40
mode and control mode. In learning mode, the algorithm cap-
tures the ambient features representing its inputs in order to 20
generate a fuzzy controller coded in FML. In control mode,
the fuzzy controller obtained in the learning mode and associ- 0
13
15
17
19
21
23
25
27
29
31
33

35
ated to a specific actuator, is executed using the AmI Multi-
Number of Fuzzy Rules
Agents System, as shown in Figure 4. These two phases are
managed by two independent agent classes, so distributed and Centralized Fuzzy Controller Distributed Fuzzy Controller
concurrent processing is achieved, even though some coordi- IV.
nation is required, as better discussed later.
First, it is necessary to defined the feature space on which the Figure 3 - Decentralized vs. Centralized Inference (red
adaptive layer works on. The features, captured in learning line represents the distributed approach, the blue line the
mode, correspond to user’s actions (for example, temperature centralized one)
setting) added with the status of AmI environment. In particu-
lar, each actuator (for instance, a lighting switch) plugged in The adaptive algorithm can be sketched in 7 steps, as shown
the network, communicates its status change in accordance to in figure 6. We refer to the approach described in [10], that
the user’s action and, each sensor (for instance, a lighting sen- we choose as generic model to generate fuzzy rules.

468 The 2005 IEEE International Conference on Fuzzy Systems


dered user’s action vector. In particular the ith similarity value
si is:
­ diff i
°1 − for diff i ≤ C * σ s ,
si = ® C * σ s
°̄0 otherwise
where C is a control parameter used to modify the shape of
membership functions of similarity. Starting from similarity
values it is possible to cluster user’s actions applying the
α - cut method:
If si < α then divide the two adjacent data into
different group ;
else put them into the same group.
Starting from the obtained clusters, it is possible to compute
the fuzzy set related to user’s actions. The fuzzy shape used
to model such action is a triangular fuzzy shape defined by
means of (a, b, c) triangle vertex points. In particular, we as-
sume that the center point b lies at COG (center-of-gravity) of
the group with membership value at 1. Next, we have to find
the membership values of two boundary user’s actions in the
Figure 4 - AmI Multi-Agents System group, where “boundary user’s actions” mean the minimum
and maximum user’s actions in the group. The two extreme
ª temp1 temp 2 ... ... ... temp #data −1 temp #data º points a and c of the output membership fuzzy set can be
« lux lux 2 ... ... ... lux # data −1 lux #data »
« 1 » found through the extrapolation of b and the two boundary
« ... ... ... ... ... ... ... » values. In particular, if ui ,ui+1, … , uk are the sorted user’s ac-
« »
« ... ... ... ... ... ... ... » tions in jth group, then the central vertex bj in this group is de-
« presence1 presence 2 ... ... ... presence# data −1 presence #data » fined as:
« »
¬ extTemp1 extTemp 2 ... ... ... extTemp #data −1 extTemp #data ¼ si + si +1 s + sk −1
ui * si + ui +1 * + ... + uk −1 * k −2 + uk * sk −1
(userAction1 userAction 2 ... ... ... userAction # data −1 userAction # data −1 ) bj = 2 2
s + si +1 si +1 + si + 2 sk −2 + sk −1
Figure 5 - AmI Generic Feature si + i + + sk −1
2 2 2
Essentially, first we generate the feature space relates to the The minimum similarity value in the group is chosen as the
actuator device (step 1), then the user’s actions are trans- membership value of the two boundary points ui and uk. Then,
formed into clusters (representing similar actions) and fuzzy the following formulas are used to calculate μ j (ui ) and
sets are extracted for each cluster (step 2). th
μ j (uk ) , where μ j is the membership functions of the j group:
do {
step 1.do { μ j (ui ) = μ j (uk ) = min( si , si +1 ,..., sk −1 )
update temperature feature space (tfs)
} while ( # tfs is not meaningful ) Now, it is possible to compute the a and c vertex points
step 2. Cluster and Fuzzify the user’s action through interpolation procedure, considering the points (b j ,1) ,
vector;
step 3. Construct an initial membership functions (u , μ (u )) and (u , μ (u )):
i j i i j i
for AmI status matrix;
step 4. rulebase = Construct the initial decision b j − ui uk − b j
a = bj − ; c = bj +
table; 1 − μ j ( ui ) 1 − μ j (u k )
step 5. rulebase = Simplify the initial decision
table; After computing the fuzzy sets and membership functions re-
step 6. FMLRuleBase = toFML(rulebase); lated to model the user behavior, we need to fuzzy model the
step 7. Start new Agent
ControlMode(FMLRuleBase);
input scenario as defined by the environment status matrix.
} while ( true ) First action is to compose the fuzzy set (triangle (a,b,c)), for
each row of the input matrix. Since we assume
Figure 6 - Adaptive Algorithm b − a = c − b = the smallest predefined unit , let a 0 the
Similar actions are detected by standard derivation ( σ s )of smallest value for the element characterizing the row of the
difference values between adjacent data ( diffi ) inside the or- input matrix, and a n be the biggest value. With

469 The 2005 IEEE International Conference on Fuzzy Systems


ai − ai −1 = ai +1 − ai = the smallest predefined unit , we sion table. In particular, for operations 1 and 2, if
are able to identify the fuzzy set. ( ai , bi , ci ) and (a j , b j , c j ) are the membership functions for
A typical initial membership function is showed in Figure 7. the ith attribute and d i and d i +1 are the corresponding position
values, then the new membership function is
( a i , (bi + b j ) 2 , c j ) . For operation 3 and 4, if
( a i , bi , c i ), ( a j , b j , c j ) and (a k , bk , c k ) are the membership
functions for the ith attribute and d i −1, d i and d i +1 are the cor-
responding position values, then the new membership func-
tion is ( ai , (bi + b j + bk ) 2 , c k ) . For operation 5, if
( a i , bi , ci ), ( a j , b j , c j ) and (a k , bk , c k ) are the membership
functions for the ith attribute and d i −1, d i and d i +1 are the cor-
responding position values, the new membership functions
Figure 7 - Input membership functions
are (ai , bi , ci ) and ( a k , bk , c k ) . At this point, it is possible
The next step describes the construction of the decision table.
to derive decision rules from the reduced decision table. Let
In particular, we build a multi-dimensional decision table
(each dimension represents a corresponding AmI status en-
cell ( d 1,d 2,..., dm ) = Ri be a generic entry of decision table. Us-
tity) according to the initial membership function. ing such entry it is possible to derive the rule:
Let cell be defined as the contents of a positions (d1, d2,…,dm) If input1 = d1 and input2 = d2 and … and inputm = dm
in the decision table, where m is the dimension of table and di Then output = Ri
is the position value. Each cell in table may be empty, or may
contain a fuzzy region of the user’s action space. V. CONCLUSIONS
For sake of simplicity, let us suppose R1, R2, …, Rl be the
clusters returned by the first step. The adaptive algorithm In this work we reported our experience in mixing soft com-
puting approaches with agent technology, that represented the
eliminates the redundant and unnecessary relations by delet-
basis of a general architecture suitable for AmI systems. De-
ing row and/or column of the decision table. permits to mini-
vice independence and transparency is achieved thanks to a
mize the number of rules of AmI controller and obtains a
fuzzy-oriented mark-up language (FML) able to manage
compact FML program. The optimization procedure is based fuzzy concepts, fuzzy rules and fuzzy inference engine di-
on five operations: rectly. Adaptivity strategy is applied in order to dynamically
Operation 1: if cells in two adjacent columns (or rows) in decision table
reconfigure the domotic services according to new user’s hab-
are the same, it is possible to merge these two columns or rows; its and status of home sensors.
Operation 2: if two cells are the same or if either of them are empty in
two adjacent columns (rows) and at least one cell in both the columns VI. REFERENCES
(rows) is not empty, then it is possible to merge these two columns
(rows) into one; [1] E. Aarts, “Ambient Intelligence: A Multimedia Perspective, IEEE Mul-
Operation 3: if all cells in a column (row) are empty and if cells in two timedia”, pp. 12-18, 2004.
adjacent columns (rows) are the same, then it is possible to merge these [2] B. Schilit, M. Theimer, “Disseminating Active Map Information to
three columns (or rows) into one; Mobile Hosts”. IEEE Network, 8, No. 5, pp. 22-32, 1994.
Operation 4: if all cells in a column (row) are empty and if cells in its [3] G. Acampora, L. Ippolito, V. Loia, P. Siano, “Achieving Transparency
two adjacent columns (rows) are the same or either of them is empty, and Adaptivity in Fuzzy Control Framework: an application to Power
then it is possible to merge these three columns (rows) into one; Transformers Predictive Overload System”, FUZZIEEE 2004, 25-29
Operation 5: if all cells in a column (row) are empty and if all the non- July 2004, Budapest, Hungary, IEEE Press.
empty cells in column (row) to its left have the same region, and all the [4] “XSLT Requirements Version 2.0”, W3C Working Draft 14/02/01
http://www.w3.org/TR/2001/WD-xslt20req-20010214
non-empty cells in the column (row) to its right have the same region,
[5] “Extensible Stylesheet Language (XSL) Version 1.1.”, W3C Working
but one different from the previously mentioned region, then it is possi-
Draft 17/12/03. http://www.w3.org/TR/2003/WD-xsl11-20031217/.
ble to merge these three columns into two parts.
[6] L. A. Zadeh, “Fuzzy sets”, Information & Control, 8:338-353, 1965.
[7] E. H. Mamdani, “Applications of fuzzy algorithms for simple dynamic
Applying these operations, the numbers the membership func- plants”, Proc. of IEE , vol. 121, pp.1585-1588, 1974.
tions are reduced. This deletion may affect the coherence be- [8] B. DuCharme,“XML: Annotated Specification”, Prentice Hall, 1999.
[9] T. Takagi, M. Sugeno, “Fuzzy identification of systems and its appli-
tween decision table and input fuzzy memberships. In order cations to modeling and control”, IEEE Trans. Systems, Man & Cy-
to assure the coherence, it is necessary to assess the member- bernetics 15(1): 116–132,1985.
ship functions related to the affected dimensions of the deci- [10] T.P.Hong, C.Y.Lee, “Induction of fuzzy rules and membership func-
tions from training examples”, Fuzzy Sets & Systems 84: 33-47, 1996.

470 The 2005 IEEE International Conference on Fuzzy Systems

You might also like