Presentation is loading. Please wait.

Presentation is loading. Please wait.

EE5900 Advanced Embedded System For Smart Infrastructure

Similar presentations


Presentation on theme: "EE5900 Advanced Embedded System For Smart Infrastructure"— Presentation transcript:

1 EE5900 Advanced Embedded System For Smart Infrastructure
Static Scheduling

2 Time Frame Given a set of tasks, let H denote the smallest hyper period of all tasks. T1=(1,4), T2=(1.8,5), T3=(1,20), T4=(2,20) H=20 Divide time into frames and frame size f should divide H. f could be 2,4,5,10,20 Choose small frame size since this will make the scheduling solution more useful

3 Network flow formulation
Denote all the tasks as J1,J2,…,Jn Vertices N job vertices H/f time frame vertices Source Sink Edges Source to job vertex with capacity set to execution time ei Job vertex to time frame vertex with capacity f if the job can run in the time frame Time frame to sink with capacity f

4 Flow network

5 Computing scheduling If the obtained maximum flow is equal to the sum of execution time of all tasks, then the task set is schedulable.

6 Flow network Given a directed graph G A source node s A sink node t
Goal: To send as much information from s to t

7 Flows An s-t flow is a function f which satisfies:
(capacity constraint) (conservation of flows (at intermediate vertices)

8 Maximum flow problem: maximize this value
Value of the flow Maximum flow problem: maximize this value 3 4 G: 10 7 9 10 8 6 6 2 10 9 9 10 s 10 9 10 t Value = 19

9 Cuts An s-t cut is a set of edges whose removal disconnect s and t
The capacity of a cut is defined as the sum of the capacity of the edges in the cut Minimum s-t cut problem: minimize this capacity of a s-t cut

10 Flows ≤ cuts Let C be a cut and S be the connected component of G-C containing s.

11 Main result Value of max s-t flow ≤ capacity of min s-t cut
(Ford Fulkerson 1956) Max flow = Min cut A polynomial time algorithm

12 Greedy method? Find an s-t path where every edge has f(e) < c(e)
Add this path to the flow Repeat until no such path can be found. Does it work?

13 A counterexample 20 10 30 10 20 The greedy algorithm produces a flow of value 20 while the maximum flow has value of 30.

14 Residual graph Key idea allow flows to push back f(e) = 2 c(e) = 10
Can send 8 units forward or push 2 units back. c(e) = 10 c(e) = 8 Advantage of this representation is not to distinguish send forward or push back c(e) = 2

15 Ford-Fulkerson Algorithm
Start from an empty flow f While there is an s-t path P in residual graph update f along the original graph Return f

16 Ford-Fulkerson Algorithm
flow 2 4 4 capacity G: 10 8 6 2 10 s 10 3 9 5 10 t Flow value = 0

17 Ford-Fulkerson Algorithm
flow 2 4 4 capacity G: 8 X 10 8 6 2 10 s 10 3 9 5 10 t Flow value = 0 2 4 4 residual capacity Gf: 10 8 6 2 10 s 10 3 9 5 10 t

18 Ford-Fulkerson Algorithm
2 4 4 G: 10 2 X 8 8 10 8 6 2 10 8 s 10 3 9 5 10 t Flow value = 8 2 4 4 Gf: 8 2 8 6 2 10 s 10 3 9 5 2 t 8

19 Ford-Fulkerson Algorithm
2 4 4 G: X 6 8 10 8 10 8 6 2 10 2 2 10 s 10 3 9 5 10 t Flow value = 10 2 4 4 Gf: 10 8 6 2 10 s 10 3 7 5 10 t 2

20 Ford-Fulkerson Algorithm
X 8 2 2 4 4 G: 10 8 6 10 8 6 6 2 10 2 6 8 10 s 10 3 9 5 10 t Flow value = 16 2 4 4 Gf: 6 10 8 6 2 4 s 4 3 1 5 10 t 6 8

21 Ford-Fulkerson Algorithm
X 9 7 3 2 2 4 4 G: 10 8 8 10 8 6 6 2 10 8 8 10 s 10 3 9 5 10 t Flow value = 18 2 2 2 4 Gf: 8 10 8 6 2 2 s 2 3 1 5 10 t 8 8

22 Ford-Fulkerson Algorithm
3 2 4 4 G: 10 7 9 10 8 6 6 2 10 9 9 10 s 10 3 9 5 10 t Flow value = 19 3 2 1 4 Gf: 9 1 10 7 6 2 1 s 1 3 9 5 10 t 9

23 Ford-Fulkerson Algorithm
3 2 4 4 G: 10 7 9 10 8 6 6 2 10 9 9 10 s 10 3 9 5 10 t Cut capacity = 19 Flow value = 19 3 2 1 4 Gf: 9 1 10 7 6 2 1 s 1 3 9 5 10 t 9

24 Max-flow min-cut theorem
Consider the set S of all vertices reachable from s s is in S, but t is not in S No incoming flow coming in S (otherwise push back) Achieve full capacity from S to T Min cut!

25 Integrality theorem If every edge has integer capacity,
then there is a flow of integer value.

26 Complexity Assume edge capacity between 1 to C At most mC iterations
Finding an s-t path can be done in O(m) time Total running time O(m2C)

27 Speedup with capacity scaling
Capacity scaling to find paths with large capacity Find 2p-1  C  2p For i from p-1 to 0 Compute the graph with edge capacity at least 2i Find maximum flow there At iteration i, there are at most m edges, the capacity of the min cut is at most m2i+1 and each augmenting path has flow value at least 2i, so there are at most 2m augmentations. Runtime is bounded in O(m2logC).

28 Speedup with BFS In each iteration, compute the breadth first search in the residual graph and choose the path with fewest edges. Let leveli(v) denote the distance from s to v in the residual graph. Leveli(v) cannot decrease during iterations. Prove by induction. Suppose that in the i+1 iteration, edge u->v is picked in the residual graph for pushing flow. If u->v is an edge in the residual graph in last iteration, leveli(u)+1=leveli(v)<=leveli+1(u)+1=leveli+1(v) by induction Otherwise, v->u is in the augmenting path of iteration i, which means that it is along the shortest path, so leveli(v)=leveli(u)-1<leveli(u)+1<=leveli+1(u)+1=leveli+1(v) Each edge cannot appear and disappear many times. Given a consecutive disappearance in Gi and appearance in Gj of an edge u->v in two residual graphs. u->v is on the augmenting path of Gi and v->u is on the augmenting path of Gj, so leveli(u)+1=leveli(v) and levelj(v)+1=levelj(u). Note that levelj(v)>=leveli(v). We have levelj(u)>=leveli(u)+2.

29 Speedup with BFS (2) Distance from s to u increases by at least 2 for disappearance and appearance. The level is at most n, so the number of disappearance is bounded by n/2. Each edge can disappear at most n/2 times, totally m edges which means that the total disappearance is nm/2 At least one edge disappears, so at most nm/2 iterations Total runtime O(nm2)


Download ppt "EE5900 Advanced Embedded System For Smart Infrastructure"

Similar presentations


Ads by Google