Monketoo's picture
Add files using upload-large-folder tool
89d0916 verified

Algorithm 2: Solution to MINENERGY(G, D) for series-parallel graphs.

procedure SPG (series-parallel graph G, deadline D) begin return $\frac{(\mathbf{cost}(G))^3}{D^2}$; end

procedure cost (series-parallel graph G) begin Let $T_0$ be the source of G and $T_1$ its sink; if G is composed of only two tasks, $T_0$ and $T_1$ then return $w_0 + w_1$; else /* G is a composition of two SPGs $G_1$ and $G_2$. / For $i = 1, 2$, let $G'_i = G_i$ where the cost of source and sink tasks is set to 0; $w'_1 = \mathbf{cost}(G'_1)$; $w'_2 = \mathbf{cost}(G'_2)$; if G is a series composition then Let $T_0$ be the source of $G_1$, $T_1$ be its sink, and $T_2$ be the sink of $G_2$; return $w_0 + w'_1 + w_1 + w'_2 + w_2$; else / It is a parallel composition. */ Let $T_0$ be the source of G, and $T_1$ be its sink; return $w_0 + ((w'_1)^3 + (w'_2)^3)^{\frac{1}{3}} + w_1$; end end end

Once the cost of the equivalent task of the SPG has been computed with the call to cost (G), the optimal energy consumption is $\frac{(\mathbf{cost}(G))^3}{D^2}$.

Contrarily to the case of tree graphs, since we never need to call the SPG procedure again because there is no constraint on $s_{max}$, the time complexity of the algorithm is the complexity of the cost procedure. There is exactly one call to cost for each composition, and the number of compositions in the SPG is in $O(|V|)$. All operations in cost can be done in $O(1)$, hence a complexity in $O(|V|)$. □