1 / 104

Announcements

Announcements. Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible for understanding all 4 problems (related material may be on final exam). Tutorial: Fri, Apr 2 A. Kolokolova 16:00-17:30 PSE 321

katoka
Download Presentation

Announcements

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Announcements • Assignment 4: • Due Monday, April 5 at Midnight (due to university regulations). • Submit solutions to any 2 of the 4 problems. • Responsible for understanding all 4 problems (related material may be on final exam). • Tutorial: • Fri, Apr 2 A. Kolokolova 16:00-17:30 PSE 321 • Special office hours (week prior to exam): MWF 2-3

  2. The Maximum Network Flow Problem

  3. Flow(1) Residual(1) No more augmenting paths  max flow attained. Flow(2) Residual(2) Example

  4. The Basic Ford-Fulkerson Algorithm

  5. Multiple Sources Network • We have several sources and several targets. • Want to maximize the total flow from all sources to all targets. • Reduce to max-flow by creating a supersource and a supersink:

  6. Maximum Bipartite Matching • A bipartite graph is a graph G=(V,E) in which V can be divided into two parts L and R such that every edge in E is between a vertex in L and a vertex in R. • e.g. vertices in L represent skilled workers and vertices in R represent jobs. An edge connects workers to jobs they can perform.

  7. A matching in a graph is a subset M of E, such that for all vertices v in V, at most one edge of M is incident on v.

  8. A maximummatching is a matching of maximum cardinality. maximum not maximum

  9. A Maximum Matching • No matching of cardinality 4, because only one of v and u can be matched. • In the workers-jobs example a max-matching provides work for as many people as possible. v u

  10. Solving the Maximum Bipartite Matching Problem • Reduce an instance of the maximum bipartite matching problem on graph G to an instance of the max-flow problem on a corresponding flow network G’. • Solve using Ford-Fulkerson method.

  11. Corresponding Flow Network • To form the corresponding flow network G' of the bipartite graph G: • Add a source vertex s and edges from s to L. • Direct the edges in E from L to R. • Add a target vertex t and edges from R to t. • Assign a capacity of 1 to all edges. • Claim: max-flow in G’ corresponds to a max-bipartite-matching on G.

  12. min cut Example |M| = 3  max flow = 3

  13. Lemma (CLRS 26.10)

  14. Why can’t we just say max |f| = max |M|? • Problem: we haven’t shown that f(u,v) is necessarily integer-valued for all (u,v) when f is a max flow. • It follows from the lemma that • max |M| = max [ integral flow], • but we also need • max [integral flow] = max |f|

  15. Integrality Theorem (CLRS 26.11) • If the capacity function c takes on only integral values, then: • The maximum flow f produced by the Ford-Fulkerson method has the property that |f| is integer-valued. • For all vertices u and v the value f(u,v) of the flow is an integer. • So |M| = max [integral flow] = max |f|

  16. Conclusion • Network flow algorithms allow us to find the maximum bipartite matching fairly easily. • Similar techniques are applicable in other combinatorial design problems.

  17. Example • In a department there are n courses and m instructors. • Every instructor has a list of courses he or she can teach. • Every instructor can teach at most 3 courses during a year. • The goal: find an allocation of courses to the instructors subject to these constraints.

  18. Two solutions using network flows • Solution 1: convert the problem into a bipartite matching problem. • Solution 2: convert the problem into a flow problem directly.

  19. A more complicated problem • There are m student groups on campus. • We would like to form a committee with a president, 3 vice-pres, and 10 members at large. • The committee is formed by representatives of the groups. • Can add conditions: • The first group can be represented by at most 2 members, any other group can be represented by at most one. • The representative of the third group cannot be the president. • Reduce to network flows!

  20. Reducibility and NP-Completeness

  21. Computational Complexity Theory • Computational Complexity Theory is the study of how much of a given resource (such as time, space, parallelism, randomness, algebraic operations, communication, or quantum steps) is required to solve important problems.

  22. WORST-CASE TIME • We say that a program takes worst-case time T(n), if some input of size n takes T(n) steps, and no input of size n takes longer. • The input size is measured in bits, unless stated otherwise.

  23. Some Examples

  24. A Graph Named “Gadget”

  25. K-COLORING • A k-coloring of a graph is an assignment of one color to each vertex such that: • No more than k colors are used • No two adjacent vertices receive the same color • A graph is called k-colorable iff it has a k-coloring

  26. No: it contains a triangle! A CRAYOLA Question! • Is Gadget 2-colorable?

  27. A CRAYOLA Question! • Is Gadget 3-colorable? Yes!

  28. 2 CRAYOLAS • Given a graph G, what is a fast algorithm to decide if it can be 2-colored? PERSPIRATION; BRUTE FORCE: Try out all 2n ways of 2 coloring G.

  29. 3 CRAYOLAS • Given a graph G, what is a fast algorithm to decide if it can be 3-colored? ? ? ? ? ? ? ? ?

  30. Let’s consider a completely different problem.

  31. K-CLIQUES • A K-clique is a set of K nodes with all k(K-1)/2 possible edges between them.

  32. This graph contains a 4-clique

  33. Given an n-node graph G and a number k, how can you decide if G contains a k-clique? • PERSPIRATION: Try out all n choose k possible locations for the k clique • INSPIRATION: ? ? ? ? ? ? ? ?

  34. OK, how about a slightly different problem?

  35. INDEPENDENT SET • An independent set is a set of vertices with no edges between them. This graph contains an independent set of size 3.

  36. Given an n-node graph G and a number k, how can you decide if G contains an independent set of size k? • PERSPIRATION: Try out all n-choose-k possible locations for independent set • INSPIRATION: ? ? ? ? ? ? ? ?

  37. One more completely different problem

  38. Combinational Circuits • AND, OR, NOT, gates wired together with no feedback allowed (acyclic).

  39. Logic Gates Not And Or

  40. Example Circuit

  41. CIRCUIT-SATISFIABILITY(decision version) • Given a circuit with n-inputs and one output, is there a way to assign 0-1 values to the input wires so that the output value is 1 (true)?

  42. CIRCUIT-SATISFIABILITY(search version) • Given a circuit with n-inputs and one output, find an assignment of 0-1 values to the input wires so that the output value is 1 (true), or determine that no such assignment exists.

  43. Satisfiable Circuit Example

  44. Satisfiable? No!

  45. Given a circuit, is it satisfiable? • PERSPIRATION: Try out all 2n assignments • INSPIRATION: ? ? ? ? ? ? ? ?

  46. We have seen 4 problems: coloring, clique, independent set, and circuit SAT. They all have a common story: A large space of possibilities only a tiny fraction of which satisfy the constraints. Brute force takes too long, and no feasible algorithm is known.

  47. CLIQUE / INDEPENDENT SET • Two problems that are cosmetically different, but substantially the same

More Related