III. Energy Benchmarking and Labeling for Mobile Applications
8. An Energy-Aware Market Place for Mobile Applications
8.1.2. Model-Checking Based Energy Approximation
The second, more complex energy approximation technique bases on the automata- based energy model introduced in Section 6.3.2 and the probability-based usage model introduced in Section 7.1.2. The idea behind this method is that instead of computing the mean power rate over all use cases of the profiled usage domain directly, the derived energy and usage information, based on the service model of the usage domain is used. Thus, instead of using the profiled power rates for individual use cases, the average profiled power rates for all transitions of the respective service model are considered. To approximate an average power rate over all use cases and the user-specific probabilities of the transitions in the service model, model checking is applied.
“Model checking is an automated technique that, given a finite-state model of a system and a formal property, systematically checks whether this property holds for (a given state in) that model [7, p. 11].”
Thus, for example, model checking allows to check whether a given finite-state model will always reach its final state. Specific finite-state models also allow the computation
8. An Energy-Aware Market Place for Mobile Applications
of costs until reaching this state [7, pp. 816ff]. For the computation of an average power rate, the service model together with the application-specific energy model and the user- specific usage model are transformed into a Markov reward model (MRM), being a tuple of a Markov chainM and a reward function assigning each state of the Markov chain to a non-negative integer value [7, p. 817].
More general speaking, a Markov chain can be considered as a state-transition system with a countable set of states and a set of directed transitions between these states. Where the states can have labels, transitions are annotated with probabilities, indicating how likely they will be fired, once a respective state is reached.
According to [7, p. 747f], a “(discrete time) Markov chain is a tuple M =
(S, P, ιinit, AP, L) where
• S is a countable, nonempty set of states,
• P : S ×S → [0, 1] is the transition probability function such that for all states s: X
s0∈S
P(s, s0) = 1,
• ιinit : S→ [0, 1] is the initial distribution, such that Ps∈Sιinit(s) = 1, and • AP is a set of atomic propositions and L : S → 2AP a labeling function.”
Alongside the informal definition of Markov reward models given above, rewards are defined as a function mapping from states of a Markov chain to non-negative integer values. To allow the definition and computation of rewards defined on transitions instead of states, the definition used for MRMs in this work is slightly different to the definition given in [7, p. 817]:
A Markov reward model (MRM) is a tuple (M, rew) with
• M a Markov chain with state space S
• and rew : S × S → Nma reward function that assigns to each transition (si, sj) where pi,j ∈ P > 0 a set of m non-negative integer rewards rew(si, sj) = (r1, r2, . . . rm).
Once a Markov chain is given, a temporal logic such as Computation Tree Logic (CTL) (or more specific, Probabilistic CTL (PCTL)), can be applied to check properties on the MRM. PCTL is a two-stage logic consisting of state formulae, allowing the reasoning on states, and path formulae, allowing the reasoning on paths [7, pp. 780ff]. For example,
8.1. Approximating the Energy Consumption of Mobile Applications
the PCTL expression ∀2¬down denotes the Boolean property that a defined state-
transition system will never reach the state labeled down [7, p. 323]. For MRMs, PCTL can be extended by properties reasoning on rewards. For example, the average reward
earned by moving from a state t to any state within a set of states B ⊆ S can be
expressed as ExpRew(t|= 3B) [7, p. 830], where t |= 3B denotes all paths leaving the state t and finally reaching a state b∈ B.
In the following, it is shown how MRMs and PCTL can be applied to compute the average power rate of mobile applications for a given service, energy and usage model. For a more detailed discussion on Markov chains, MRMs, CTL and PCTL, the interested reader is referred to [7].
Required Information
To approximate the average power rate of an application based on average power rates for transitions in the service model, this approximation method requires the following information as input:
• A service model SMd= (S, sinit, sf inal, T ), for a usage domain d, as defined in Section 6.1.
• An automata-based energy model EMa ={(p1, et1), (p2, et2), . . . (pn, etn)} for an application a, belonging to the usage domain d, as defined in Section 6.3.2, consisting of a set of tuples (pi, eti) for each transition tj ∈ T ; whereby pi repre- sents the average power rate profiled for this transition during benchmarking and eti represents its average execution time.
• A usage model UMu = {(w1, ut1), (w2, ut2), . . . (wm, utm)} for a user u, as defined in Section 7.1.2, consisting of a set of tuples (wk, utk) of user-specific probabilities and a user-specific execution times for each transition tj ∈ T .
Average Power Rate Computation
To approximate the average power rate for a given service model SMd, an energy model
EMa, and a usage model U Mu, they are translated into a Markov Reward Model
M RMau as follows:
• MRMau = (Mau, rewau) with • Mau(S, P, ιinit, AP, L), where
8. An Energy-Aware Market Place for Mobile Applications – Pi,j = p1,1 p1,2 · · · p1,n p2,1 p2,2 · · · p2,n .. . ... . .. ... pn,1 pn,2 · · · pn,n , pij = wk (wk, utk)∈ UMu ∧ ∃tk∈ TSMd: tk = (si, sj) 1 si = sf inalSMd ∧ sj = sf inalSMd 0 otherwise – ιinit={d1, d2, . . . dn}, di= 1 si= sinitSMd 0 otherwise – AP = S and L(s) ={s}, • and rewau(si, sj) = S× S → N × N = (pk∗ etk, etk) (pk, etk)∈ EMa ∧ ∃tk∈ TSMd: tk = (si, sj)∧ etk6= (pk∗ utk, utk) (pk, etk)∈ EMa∧ (wk, utk)∈ UMu ∧ ∃tk∈ TSMd: tk = (si, sj)∧ etk= (0, 0) otherwise
In simple words, the M RMau consists of a set of states equal to the states of the service model SMd, having a probability matrix P filled with the probabilities of the usage model U Mu. The reward function rewua maps the transitions of the service model SMd to tuples of two values, representing their average energy consumption (product of average power rate pk and average execution time, being either etk or tuk) and their execution time (being either etk or tuk).
A reward function consisting of two individual values is required, allowing the com- putation of both, the average energy consumption and the average execution time and, thus, the computation of the average power rate in the following. For the computation of the average energy consumption Eauand the average execution time tau, the following PCTL expression has to be evaluated (i.e., checked against the MRM), computing the average reward while starting in the initial state sinitSMd and terminating in the set of final states{sf inalSMd}:
Rewau(Eau, tau) = ExpRew(sinitSMd |= 3{sf inalSMd}) (8.2) Afterwards, the average power rate P Rau can be computed as follows:
8.1. Approximating the Energy Consumption of Mobile Applications P Rau= Eau tau (8.3) A Simple Example
To clarify the model-checking based approximation approach, a short example is given in the following. The example consists of the very simple service model shown in Figure 8.1, having only one state (besides its initial and final state), and three transitions.
stop[1.0W, 1.0s, 0.5]
start[1.0W, 1.0s, 1.0]
Account View
read[1.4W, 2.0s, 0.5]
Figure 8.1.: Example service model for a very simple usage domain (including annotated power rates, execution times, and probabilities).
The service model SMe, the energy model EMae and the usage model U Mue are defined as follows:
SMe = (S ={s1, s2, s3}, sinit= s1, sf inal = s3, T ={(s1, s2), (s2, s2), (s2, s3)}), where s2 represents theAccount Viewstate.
EMae ={(p, et)start, (p, et)read, (p, et)stop} = {(1.0W, 1.0s), (1.4W, ), (1.0W, 1.0s)}
U Mue ={(w, tu)start, (w, tu)read, (w, tu)stop} = {(1.0, ), (0.5, 2.0s), (0.5, )} Please note that the execution times of the transitions start and stop are defined in the energy model EMae, whereas the execution time of the transitionread is defined in the usage model U Mue. The transformation of the given models results in the following Markov reward model M RMaue:
• MRMaue = (Maue, rewaue) with
8. An Energy-Aware Market Place for Mobile Applications – Pe = 0 1 0 0 0.5 0.5 0 0 1 – ιinite ={1, 0, 0} – APe= Se and Le(s) ={s} • and rewaue = (1.0J, 1.0s) for (s1, s2) (2.8J, 2.0s) for (s2, s2) (1.0J, 1.0s) for (s2, s3) (0.0J, 0.0s) otherwise
Checking the PCTL expression Rewaue results in:
Rewaue(Eaue, taue) = ExpRew(s1 |= 3{s3}) = (4.8J, 4s) Leading to an approximated average power rate of:
P Raue = 4.8J
4.0s = 1.2W
8.1.3. Advantages and Disadvantages
Similar to the comparison of both energy and usage modeling approaches, in the follow- ing, advantages and disadvantages of both average power rate approximation approaches are discussed.
Whereas the first, simple weight-average based approach is more simpler and, thus, less computation-intense, the second, model-checking based approach allows the estima- tion of average power rates independently of the predefined and profiled set of usage scenarios. However, as the model-checking based approach requires both energy and usage models that abstract from individual usage scenarios, it is more likely to intro- duce approximation errors in terms of imprecise or incorrect energy and usage models. Besides, the computation-intense transformation of service, energy and usage models into an MRM as well as the model checking may be too computation-intense when approxi- mating the average power rate for many applications in parallel (as being necessary for the user-specific computation of energy labels in an online market place).
In Chapter 9, both approximation approaches are evaluated together with the complete energy labeling process in terms of their accuracy and applicability for the energy labeling of mobile applications.