• 沒有找到結果。

The physical distance between two devices: The shortest physical distance between two devices respectively controlled by two candidate nodes in the smart

Consistent Service Composition in a Smart Home

Theorem 6. (The compact forms of disjunctive clauses) All disjunctive clauses can be reduced to one of the eight compact forms shown in Table 5.4

1. The physical distance between two devices: The shortest physical distance between two devices respectively controlled by two candidate nodes in the smart

home. The closer two devices are to each other, the more interferences between them there can be.

2. The similarity of effects: The similarity between two different effects produced by the physical devices controlled by two different nodes. For instance, the effects of playing music and text-to-speech, respectively, are similar : both of them produce sounds. In this thesis, the effects of devices are represented by ontological concepts (see Fig. 5.17) which can be obtained in their Capability Descriptors.

3. The intensity of the effect: The intensity, ranging from 0 to 1, of the effect is an attribute pre-defined by the system administrator. The higher the intensity of the effect is, the more likely that the device that produce the effect to interfere with other devices.

To calculate the distance between devices (nodes), an undirected graph is created based on a given floor plan, which considers each room as a vertex and edges two vertices if the corresponding two rooms are adjacent. As a result, the distance between

Figure 5.17: The Effect ontology in a Smart Home

device a and device b, denoted D(a, b), can be obtained by calculating the number of edges contained in the shortest path between two vertices. Note that it is assumed that the floor plan is given and that the location of nodes can be obtained by examining the attributes in the Capability Descriptors. The distance is ∞ if the node does not control any devices (i.e. sensors or actuators) at all. For each candidate node, the device is calculated against all activated nodes. After that, the least value is chosen as the representative value since the nearest node is more likely to cause interference.

Meanwhile, the similarity values of effects among nodes are obtained by calculating the semantic relevance of effects. This work adopts the approach proposed by Yu et al. [144] to estimate the semantic relevance of effects. In this approach, the semantic

relevance between two effects, which are ancestor/descendant, is defined by a function, S(ex, ey) =

d(Ancestor(eˆ x, ey)) dˆmax ,

where the function Ancestor(ex, ey) returns the ancestor node of the two, ˆdmax is the maximum depth of the ontology, and ˆd(e) is the depth of the effect e. Otherwise, if the effects do not have ancestor/descendant relationships, then

S(ex, ey) =

d(N CA(eˆ x, ey)) dˆmax ,

where N CA(ex, ey) is the Nearest Common Ancestor (NCA) of ex and ey. Note that the depth of the root is defined as 1.

Taking the ”Effect” ontology in Figure 5.17 as an example, the semantic similarity between V isualEf f ect and Artif icialLightEf f ect is

S(V isualEf f ect, Artif icialLightEf f ect) =

d(V isualEf f ect)ˆ dˆmax = 2

4 = 0.5.

Likewise, the semantic similarity of BoundedV isualEf f ect and DryEf f ect is S(BoundedV isualEf f ect, DryEf f ect) =

d(N CA(BoundedV isualEf f ect, DryEf f ect))ˆ dˆmax

=

d(Ef f ect)ˆ

dˆmax = 0.25,

since BoundedV isualEf f ect and DryEf f ect do not have a ancestor/descendant re-lationship. After the similarity values are calculated, the highest value is chosen as the representative value since the most similar node is more likely to cause interference.

In this work, Fuzzy sets are modeled by Sigmoid functions and Gaussian distribution functions (see Fig. 5.18, 5.19, and 5.20). The Sigmoid function is of the form

AL1(x) = 1

1 + et·(x−u), (5.20)

where L1 is the label of a Fuzzy set; t and u are parameters pre-defined for a specific membership functions of the Fuzzy set L1. t is used to adjust the shape of func-tion, where as u is used to adjust the offset from the origin. Likewise, the Gaussian

Table 5.7: Membership functions for Fuzzy sets of ”distance” and default parameter values

Label Membership Function Default Parameter Values Close Sigmoid (5.20) t =−17 and u = 1.4 Average Gaussian (5.21) m = 2 and σ = 0.25˜ Far Sigmoid (5.20) t = 10 and u = 2.5

Table 5.8: Membership functions for Fuzzy sets of ”intensity” and default parameter values

Label Membership Function Default Parameter Values Small Sigmoid (5.20) t =−30 and u = 0.3 Medium Gaussian (5.21) m = 0.5 and σ = 0.1˜ Large Sigmoid (5.20) t = 30 and u = 0.7

distribution functions is of the form

AL2(x) = exp(−(x − ˜m)2

σ2 ), (5.21)

where L2 is the label of the membership function, and ˜m is the mean and σ is the standard deviation of the distribution. Tables 5.7, 5.8, and 5.9 show respectively how the Fuzzy sets of ”distance”, ”intensity”, and ”similarity” are defined. The default parameter values are pre-defined based on empirical experiences of the system designer, which can be adjusted afterwards by users or by automatic fuzzy learners such as ANFIS [75].

Figures 5.18, 5.19, and 5.20 depict respectively the Fuzzy sets for ”distance”, ”inten-sity”, and ”similarity” diagrammatically after the membership functions and parameter values are applied.

Table 5.9: Membership functions for Fuzzy sets of ”similarity” and default parameter values

Label Membership Function Default Parameter Values Dissimilar Sigmoid (5.20) t =−25 and u = 0.4 Average Gaussian (5.21) m = 0.5 and σ = 0.1˜ Similar Gaussian (5.21) m = 0.75 and σ = 0.75˜ Nearly The Same Sigmoid (5.20) t = 35 and u = 0.8

Figure 5.18: Fuzzy sets of ”distance”

Figure 5.19: Fuzzy sets of ”intensity”

Figure 5.20: Fuzzy sets of ”similarity”

Table 5.10: Membership functions for Fuzzy sets of ”interference” and default param-eter values

Label Membership Function Default Parameter Values Critical Sigmoid (5.20) t = 40 and u = 0.8

Serious Gaussian (5.21) m = 0.75 and σ = 0.75˜ Average Gaussian (5.21) m = 0.4 and σ = 0.1˜ Insignificant Sigmoid (5.20) t =−40 and u = 0.2

Similarly, the output of Fuzzy inference is also represented by Fuzzy sets, as shown in Table 5.10 and Figure 5.21.

Listing 5.9 shows the algorithm used to estimate the interference degree of a candi-date Worker Node w. This algorithm use Mamdani’s approach for Fuzzy inference [95], where the MIN-MAX model is used for aggregation and accumulation and the results are defuzzified by calculating COG (Center Of Gravity). To ensure the completeness and consistency of rules, one rule is defined for each combination of Fuzzy variables.

Consequently, there are totally 3× 3 × 4 = 36 rules defined (3 for both variables of distance and intensity, and 4 for similarity).

5.4.2 Scoring Candidate Worker Nodes

As mentioned in Section 5.3, the Type-based Node Searching phase is essentially to search for the sets of Worker Nodes whose types are identical to the ones specified in Preference Descriptors. Specifically, assuming that there are k desired Worker Nodes specified in a Service Request, then there are k Preference Descriptors, that is, {P ( ewi)}ki=1, and k sets of candidate Worker Nodes whose types are the same with the ones specified in {P ( ewi)}ki=1, namely, {Wτ1, Wτ2, ..., Wτk} = {Wτi}ki=1, where τi is the type specified in P (wei).

Figure 5.21: Fuzzy sets of ”interference”

Listing 5.9: Estimating the degree of interference Procedure E s t i m a t e I n t e r f e r e n c e D e g r e e

Input

A: A list of attribute sets of all activatedWorker Nodes Aw: The attribute set of the candidate Worker Node Local

distance, ∆similarity, δintensity

Return

ι∈ [0, 1] : The interference degree Begin

For e a c h A∈ A

distance[A]← D(Aw[location], A[location])

similarity[A]← S(Aw[ef f ect], A[ef f ect]) End ;

δintensity ← Aw[intensity]

ι←Mamdani(min(∆distance), max(∆similarity), δintensity) End ;

The objective of the Candidate Scoring and Selection phase is therefore to calculate a score for each w ∈ Wτi, and then to pick out the one with the highest score as the recommended candidate. The score is calculated based on how well the attribute values of a candidate satisfies the Attribute Preference Descriptors (cf. Definition 12).

We quantify the issue mentioned above by defining the concept of Delta Value for attributes.

Definition 17. (Delta Value) The Delta Value δ is a measure of difference between