• No results found

6.5 Implementation of a Context-Aware Reconfiguration Process

6.5.1 Pre-Planning of a PKS

For (1), the pre-computation of aPKS state-transition system, the PKS provides the means for a trade-off between pre-computation of an incomplete state space at design-time and on-demand computation at runtime, which is discussed in the following.

At runtime, reconfigurations are enforced by contextual changes in the contex- tual situation of a device C+. Thus, appropriate context-aware criteria for tai- loring incomplete state spaces that suitably cover contextual situations potentially emerging at runtime are derivable by considering contexts c from a set of available

R esour ce C onstraint R untime A d apt a tion

contexts c ∈C. Further, contexts c ∈ C may emerge in a combinatorial manner in such a way that a set of contexts c ∈ C+ ⊆C is active at the same time describing a contextual situation. Corresponding criteria select subsets Ck ⊆ C of context combinations covering any k-wise combination of contexts. If such a combina- tion combination C+iCk is compatible with the context-feature model cfm a

corresponding state si∈S is derived and integrated into the transition system.

For (2), the parameter 0 6 l 6 |F ∪ C| denotes the maximum number of features F and/or contexts C concurrently set to unrestricted (⊥U) during the identification

of partial states. Therefore, for each complete configuration γi ∈ ˆΓcfm that corre-

sponds to a state si∈S obtained in step (1), a set of configurations ˇΓ(i,l) ⊆ ˇΓcfm is

computed containing exactly those partial configurations γ ∈ ˇΓ(i,l) (i) with at most l parameters being set to ⊥Uand

(ii) in which for any possible configuration refinement γ0 ∈ ˆΓcfm of the partial configuration γ with γ0v γ, it holds that γ0 is a complete runtime configu- ration γ0∈ ˆΓcfm.

Hence, each of the 2l possible interpretation combinations of the l unrestricted contexts/features in γ result in a valid configuration. As a consequence, all states corresponding to configurations γ0 being refinement of some partial state in the set Γ(i,l) ⊆ ˇΓcfm are removable from the PKS since they are abstracted by the corresponding partial state.

Algorithm 2 summarizes the pre-computation of a PKS for a given cfm and context-combination parameter k and the parameter for the upper limit of unre- stricted contexts/features l. According to the Definition 6.4 of a PKS, the algo- rithm results in anPKS state-transition system.

Incomplete State Space Computation. To derive an incomplete state space it is required that k > 0, i.e., at least for every single context c ∈ C a corre- sponding configuration is pre-computed that satisfies the requirements imposed by c in cfm. In the lines 5–10, for the set C+ ⊆ Ck of context combinations, cor-

responding complete configurations γ ∈ ˆΓcfm are computed, e.g., by executing a

constraint solver1. If there is no state in the state space S that covers the context combination C+ a new configuration is derived (line 6). If a complete configura- tion γ ∈ ˆΓcfmfor the context-combination C+ is found, the configuration state s for

γis added to the set of statesS (lines 7–8).

The computation of a representative configuration γ for a contextual combina- tion C+ in line 7 abstracts from details such as the selection of a representative state. Multiple selection strategies of a configuration, which satisfies C+ are ap- plicable here, e.g., (i) a random selection, (ii) the configuration, in which the least amount of features are active, or (iii) optimizing non-functional attributes such as costs or stability.

Partial State Abstraction. For an abstraction of a state to a partial state a parameter of l = 0 is permitted. However, in this case, no partial states are com- puted. In case of l > 0, the set ˇΓ(l,i)of partial configurations is computed for every

R esour ce C onstraint R untime A d apt a tion Algorithm 2PKS Pre-Computation 1: Input: cfm ∈FM(F∪C); k, l ∈N; 1 6 k 6 |C|; 0 6 l 6 |F ∪ C| 2: Output:PKS = (P, S, −→) 3: Init: Γcfm := (F ∪ C) → B⊥;S := ∅; −→:= ∅;

4: // Incomplete State Space Computation 5: for all C+ ∈ Ck do 6: if 6 ∃si∈S : C+ ∈Cithen 7: compute γ ∈ ˆΓcfm where ∀c ∈ C+: γ(c) =t 8: S := S ∪ {s} where s = γ holds 9: end if 10: end for

11: // Partial State Abstraction 12: for all si∈S do 13: compute ˇΓ(i,l) 14: S := S ∪ ˇΓ(i,l) 15: end for 16: Γ :={γ0 ∈ ˆΓcfm | ∃γ0∈S, γ0 6= s ∈S : γ0v s} 17: S := S \ Γ

18: // Add Transition Relation 19: for all(s, s0)∈S, s06= s do

20: if s −→ s0 is valid transition then 21: −→:=−→ ∪{s −→ s0}

22: end if 23: end for 24: returnPKS

state si∈ S previously computed in lines 5–10 as described above. These partial

configurations are added to the set of statesS if they correspond to a partial state (line 12–15), i.e., if s(f) = ⊥U or s(c) = ⊥U holds for some features f ∈ F and

contexts c ∈ C, those features and contexts have to be arbitrarily reconfigurable in combination. Thereupon, the set Γ of redundant states, i.e., complete config- uration states being subsumed by some newly added partial states, are removed from the set of states (line 16–17).

The computation of unrestricted features in line 13 is executable based on three different strategies, as previously introduced in Section 6.3.2, i.e., unrestricted features are identifiable via

• randomized variable ordering,

• heuristical variable ordering, or

• genetic variable ordering.

Note that the parameter l represents an upper-limit for those strategies. If at least l unrestricted contexts or features are identified for a certain partial state, the identification of further unrestricted contexts/features is finished. Thus, a set of partial states is being generated for a given configuration γ ∈ ˆΓ cfm. Algorithm2

R esour ce C onstraint R untime A d apt a tion

abstracts here from further details regarding the identification of unrestricted con- texts/features and selection of partial states. Similar to the selection of represen- tative configuration states in line 7 the partial states may also be systematically selected during their computation. A partial state may be chosen based on (i) the likelihood of an unrestricted feature to be reconfigured at runtime, (ii) the amount of unrestricted features, or (iii) non-functional aspects, such as costs or stability, of active/inactive features.

Finally, transitions −→ are added between any pair of remaining states that are considered to be valid reconfigurations 19–23. Thus, the states S either become fully connected or the reconfigurability is restricted and the states S become fully path-connected, e.g., some reconfigurations between states are prohibited by the developer or by certain hardware characteristics of a device.

Thus, the derived incompletePKS containing partial states provides the neces- sary means to reconfigure an SAS at runtime in a resource efficient and flexible manner. The next section discusses how an SAS is reconfigured based on such a PKS w.r.t. changes in the contextual situation.