• 沒有找到結果。

Numeric Preference Expressions

Consistent Service Composition in a Smart Home

2. Representing and unifying user preferences: In a Pervasive environment such as the Smart Homes, users should be able to describe their preferences

5.2 Specifying and Unifying User Preferences

5.2.2 Numeric Preference Expressions

Numeric attributes are different from enumerative ones in that they are numerically comparable and that they can be constrained by specifying intervals (i.e. upper and lower bounds). As a result, numeric expressions must support more operators than that are supported in enumerative ones. Specifically, there are only two operators

supported in Enumerative Preference Expressions: ”==” and ”!=”, whereas Numeric Preference Expressions uses additional operators such as ”>”, ”<”, ”≤”, ”≥”, and

¬”.

Again, Numeric Preference Expressions can also be mandatory or negotiable. A Mandatory Numeric Preference Expression (MNPE) is a numeric preference expression whose criteria must be met. For example, the MNPE:

((> 20∧ ≤ 30)∨ < 10) (5.6)

can be used to specify the selection criteria of size of an LCD display whose size is either between 20 to 30 inches or smaller than 10 inches.

On the other hand, the Negotiable Numeric Preference Expression (NNPE) is the numeric preference expression that contains ”negotiable” semantics. Similar to NEPE, an NNPE is also composed of a P segment and an N segment which are delimited by a colon mark. For example, the following expression

((> 20∨ < 10)∧! = 25 :≫) (5.7)

is capable of specifying a selection criteria and a negotiable expression for an LCD display, where the former is that the size should be either larger than 20 inches or less than 10 inches and must not equal 25 inches, whereas the later is the expression after the colon mark (”:”), i.e. the N segment with the notation ”≫”, which means the size is the greater the better. Note that theN segment of an NNPE is useful when the user only wants to specify a vague constraint for an attribute. For instance, ≫, ≪, and ≈ denote ”the greater the better”, ”the less the better”, and ”the closer to a specified value the better”. Taking the expression (5.7) as an example, assume that three kinds of display are available, and their sizes are 25, 18, and 12 inches, respectively. The order of preference should be 25, 18 and 12. This is because all of them do not match the P segment of (5.7), so that according to the N segment, their preferences will be

Listing 5.5: The BNF of Mandatory Numeric Preference Expression (MNPE)

Listing 5.6: The BNF of Negotiable Numeric Preference Expression (NNPE) N N P E : : = LogicExpr ? ( : N egotiationExpr ) ?

N egotiationExpr : : = ≈ NUMBER

| ! ≈ NUMBER

| ≫

| ≪

LogicExpr : : = BinaryExpr | UnaryExpr | NegateExpr BinaryExpr : : = ’ ( ’ LogicExpr BinaryOp LogicExpr ’ ) ’ N egateExpr : : = ¬ BinaryExpr

U naryExpr : : = U naryOp NUMBER BinaryOp : : = ∧ | ∨

U naryOp : : = == | != | ≥ | ≤ | > | <

ranked in descending order. The BNF of MNPE and NNPE are shown in Listing 5.5 and Listing 5.6, respectively.

Again, unification rules are required if there are more than one Numeric Preference Expressions. Not surprisingly, the unification rules for Numeric Preference Expressions are different from enumerative ones because they are now integration of numerical interval as well as comparative operators rather than lists of strings. However, it can be shown that the integration of numerical intervals and operators can actually be reduced to a few types of compact forms so that specific unification rules for these compact forms can still be derived to integrate Numeric Preference Expressions efficiently.

The first step of unifying MNPE is to convert the expressions into Conjunctive Normal Forms (CNF) which is a conjunction of clauses, where a clause is a disjunction of logical terms (e.g. > 30∨ < 20). Theoretically, every logical expression can be

converted into an equivalent CNF expression by repeatedly applying distributive law and De Morgan’s laws.

Let us denote an MNPE and a logical term as ζ and ρ, respectively, then any ζ can be converted into the following CNF, denoted as ˆζ:

ζ =ˆ

Here, the logical terms such as > 20, ≤ 30, and < 10 are also called p-terms. The clause that consists of a set of p-terms connected by∨ is called a disjunctive clause (i.e. ∨

j

ρj).

The purpose for converting expressions into CNF is that both ∩ and ∪ satisfy the associativity property so that the logical terms can be unified pairwise. Specifically, after an MNPE is converted into a CNF, all clauses are connected by∩, and all logical terms are connected by ∪. Therefore, logical terms within a clause can be unified pairwise, and the order in which they are unified does not affect the outcome. For example,

11∨ ρ12∨ ... ∨ ρ1k2)

≡ (((((ρ11∨ ρ12)∨ ρ13)∨ ρ14)...∨ ρ1k2))

≡ (((((ρ1k2 ∨ ρ1k2−1)∨ ρ1k2−2)∨ ρ1k2−3)...∨ ρ11)).

The same principle holds for clauses within an MNPE. Taking the MNPE in (5.6) as an example, it can be converted in to the following CNF by applying De Morgan’s laws, that is,

((> 20∧ ≤ 30)∨ < 10) ≡ (((> 20∨ < 10) ∧ (≤ 30∨ < 10)). (5.8)

Now let us turn to the second step. The purpose of this step is to derive the most compact form for each disjunctive clause. In fact, all disjunctive clause can be reduced to one of the eight compact forms shown in Table 5.4 by repeatedly applying the

Table 5.1: Possible pairwise combinations between two numeric p-terms

< x > x == x ! = x

< y < x∨ < y. . . (1) > x∨ < y. . . (2) == x∨ < y. . . (4) ! = x∨ < y. . . (7)

> y > x∨ > y. . . (3) == x∨ > y. . . (5) ! = x∨ > y. . . (8)

== y == x∨ == y. . . (6) ! = x∨ == y. . . (9)

! = y ! = x∨! = y. . . (10)

Table 5.2: Reduction rules for deriving compact forms

No. Case Rule

(1) < x∨ < y if x ≥ y then < x else < y (2) > x∨ < y if x ≤ y then T rue

(3) > x∨ > y if x ≥ y then > y else > x (4) == x∨ < y if x ≤ y then < y

(5) == x∨ > y if x ≥ y then > y (6) == x∨ == y if x == y then == x

(7) ! = x∨ < y if x < y then T rue else ! = x (8) ! = x∨ > y if x > y then T rue else ! = x (9) ! = x∨ == y if x == y then T rue else ! = x (10) ! = x∨! = y if x == y then ! = x else T rue

< y

reduction rules shown in Table 5.2. It can be observed from Listing 5.5 that there are six different operators defined in MEPE, namely, >, <, ≤, ≥, == , and ! =. Among these operators, ≤ and ≥ is semantically equivalent to (< ∨ ==) and (> ∨ ==), respectively. In this way, the number of different operators can be reduced to four:

>, <, ==, and ! =. Consequently, all possible pairwise combinations among numeric p-terms in a disjunctive clauses are 42 = 16. However, as show in Table 5.1, there are actually 10 distinct combinations because of the commutativity of ∨.

Because the logical operator for connecting p-terms in distinctive clauses is ∨, the outcomes of unifications should be with fewer constraints, that is, with greater possible coverage. Taking case (1) shown in Table 5.1 as an example, Figure 5.6-(a) reveals that the coverage of ”< x” is greater than that of ”< y” when x > y, whereas the coverage of ”< y” is greater that of ”< x” when x < y (Figure 5.6-(b)). In case that x is equal to y, one can reduce ”< x∨ < y” to either ”< x”, or ”< y”, which is reduced to ”< x”

in this work, as shown in Figure 5.6-(c). The same procedure for obtaining the rules applies to other cases as well. Specifically, the reduction rules for the cases (1) to (10) listed in Table 5.2 can be diagrammatically and intuitively derived, as illustrated from Figure 5.6 to 5.15, respectively. The deriving procedures for the remaining cases are therefore not elaborated in further detail.

Now let us prove that all disjunctive clauses can be reduced to one of the eight compact forms shown in Table 5.4 (i.e. Theorem 6).