EE5900 Advanced Embedded System For Smart Infrastructure

Slides:



Advertisements
Similar presentations
Maximum flow Main goals of the lecture:
Advertisements

Lecture 7. Network Flows We consider a network with directed edges. Every edge has a capacity. If there is an edge from i to j, there is an edge from.
Max Flow Problem Given network N=(V,A), two nodes s,t of V, and capacities on the arcs: uij is the capacity on arc (i,j). Find non-negative flow fij for.
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
1 Maximum flow sender receiver Capacity constraint Lecture 6: Jan 25.
Chapter 6 Maximum Flow Problems Flows and Cuts Augmenting Path Algorithm.
MAXIMUM FLOW Max-Flow Min-Cut Theorem (Ford Fukerson’s Algorithm)
Chapter 10: Iterative Improvement The Maximum Flow Problem The Design and Analysis of Algorithms.
1 Maximum Flow w s v u t z 3/33/3 1/91/9 1/11/1 3/33/3 4/74/7 4/64/6 3/53/5 1/11/1 3/53/5 2/22/2 
1 Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Lectures on Network Flows
1 Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
The max flow problem
Maximum Flows Lecture 4: Jan 19. Network transmission Given a directed graph G A source node s A sink node t Goal: To send as much information from s.
Minimum Cost Flow Lecture 5: Jan 25. Problems Recap Bipartite matchings General matchings Maximum flows Stable matchings Shortest paths Minimum spanning.
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
MAX FLOW CS302, Spring 2013 David Kauchak. Admin.
1 COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf.
1 WEEK 11 Graphs III Network Flow Problems A Simple Maximum-Flow Algorithm Izmir University of Economics.
Maximum Flow Problem (Thanks to Jim Orlin & MIT OCW)
Chapter 7 April 28 Network Flow.
15.082J and 6.855J March 4, 2003 Introduction to Maximum Flows.
Chapter 7 May 3 Ford-Fulkerson algorithm Step-by-step walk through of an example Worst-case number of augmentations Edmunds-Karp modification Time complexity.
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
CSEP 521 Applied Algorithms Richard Anderson Lecture 8 Network Flow.
1 Network Flow CSC401 – Analysis of Algorithms Chapter 8 Network Flow Objectives: Flow networks –Flow –Cut Maximum flow –Augmenting path –Maximum flow.
Fall 2003Maximum Flow1 w s v u t z 3/33/3 1/91/9 1/11/1 3/33/3 4/74/7 4/64/6 3/53/5 1/11/1 3/53/5 2/22/2 
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
Theory of Computing Lecture 12 MAS 714 Hartmut Klauck.
TU/e Algorithms (2IL15) – Lecture 8 1 MAXIMUM FLOW (part II)
Ford-Fulkerson Recap.
Network Flow.
Maximum Flow c v 3/3 4/6 1/1 4/7 t s 3/3 w 1/9 3/5 1/1 3/5 u z 2/2
Max-flow, Min-cut Network flow.
CS4234 Optimiz(s)ation Algorithms
Algorithm Design and Analysis
Lectures on Network Flows
Richard Anderson Lecture 23 Network Flow
Maximum Flow 9/13/2018 6:12 PM Presentation for use with the textbook, Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015.
Network Flow.
Max-flow, Min-cut Network flow.
Network Flow 2016/04/12.
Instructor: Shengyu Zhang
Maximum Flow c v 3/3 4/6 1/1 4/7 t s 3/3 w 1/9 3/5 1/1 3/5 u z 2/2
Maximum Flow c v 3/3 4/6 1/1 4/7 t s 3/3 w 1/9 3/5 1/1 3/5 u z 2/2
Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Network Flow and Connectivity in Wireless Sensor Networks
Richard Anderson Lecture 23 Network Flow
Richard Anderson Lecture 23 Network Flow
Richard Anderson Lecture 21 Network Flow
Max Flow Min Cut, Bipartite Matching Yin Tat Lee
Flow Networks and Bipartite Matching
Algorithms (2IL15) – Lecture 7
Network Flow CSE 373 Data Structures.
Max Flow / Min Cut.
Maximum Flow c v 3/3 4/6 1/1 4/7 t s 3/3 w 1/9 3/5 1/1 3/5 u z 2/2
Network Flow.
Lecture 21 Network Flow, Part 1
MAXIMUM flow by Eric Wengert.
Introduction to Maximum Flows
Richard Anderson Lecture 22 Network Flow
Lecture 21 Network Flow, Part 1
Maximum Flow Neil Tang 4/8/2008
Lecture 22 Network Flow, Part 2
Introduction to Maximum Flows
Network Flow.
Richard Anderson Lecture 22 Network Flow
Advanced Graph Homer Lee 2013/10/31.
Maximum Flow Problems in 2005.
Presentation transcript:

EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling

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

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

Flow network

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

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

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

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

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

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

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

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?

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

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

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

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

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

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

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

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

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

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

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

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!

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

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)

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).

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.

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)