Download presentation

Presentation is loading. Please wait.

Published byBreana Stark Modified over 2 years ago

1
Whom to marry, how to cook and where to buy gas: solving dilemmas of daily life, one algorithm at a time SAMIR KHULLER Dept. of Computer Science University of Maryland

2
A typical conversation Person: What do you do? Me: I am a computer science professor. Person: I have a problem with my PC, can you fix it? Me: No, I don’t think I can do that. Person: You will not fix my PC? Me: I cannot fix my PC, let alone yours. Person: Then what exactly do you do? Me: I study algorithms. Person: Oh, I know that. Me: Really? Person: Yes! I learnt logarithms in high school.

3
Algorithms not Logarithms! ALGOR I T H M Al-Khowarizmi

4
Algorithms Introduction Recipe for baking a cake…. 2 sticks butter 2 cups flour 1 cup sugar 4 eggs 1 cup milk 1 tsp baking powder Cocoa powder (1/2 pound) Mix the sugar, baking powder and flour, mix in beaten eggs, melted butter and bake at 325F for 40 mins.

5
ALGORITHMS Set of instructions for solving a problem, to find a solution. What is a problem? What is an instruction? What is a solution?

6
Computer Science What is the computer actually doing? Its running a program (a set of instructions), but what is the program doing? Typically, an algorithm is what the program implements.

7
Outline of talk Algorithms and their Applications Whom to Marry? How to Cook? Where to buy gas? A few favorite projects of mine.. Acknowledgements

9
Why are algorithms central to computing? An airport shuttle company needs to schedule pickups delivering everyone to the airport on time. Who goes in which shuttle, and in what order do the pickups occur? A delivery company has several customers and trucks that can carry objects. How should they schedule deliveries to the customers to minimize their cost? This leads to interesting algorithmic problems…

10
There are lots of feasible solutions! How should we pick amongst these solutions? Some solutions are cheap, and others may be expensive or undesirable. The number of potential solutions is so large that even a fast computer cannot evaluate all these solutions. Algorithms tell us how to find good solutions!

11
A disclaimer I have chosen a set of problems whose algorithms are quite simple. Towards the end of the talk I will also mention some recent projects that are a little more involved, and its hard to really describe the algorithms and methods used since they are quite complex.

12
The Marriage Problem N men, N women Each person provides a ranking of the members of the opposite sex Can we find a “good marriage”? First studied by Gale and Shapley (1962)

13
An application: resident matching program Each resident rank orders the hospitals, and each hospital rank orders the residents. How do we choose an assignment of residents to hospitals? We do not want a situation that a resident prefers another hospital, and that hospital preferred this resident to the person assigned to them.

14
Men’s Preference Lists Brad (B) George(G) Vince(V) Jennifer(J)Laura(L)Angelina(A) 1 23

15
Women’s Preference List Jennifer(J) Angelina(A) Laura(L) 123 Brad(B) George(G)Vince(V)

16
Stable Marriage Problem A marriage is unstable if there is a pair of people, not married to each other, such that both prefer each other to their current partners. In other words, they have an incentive to elope…. Can we find a “stable” marriage?

17
Unstable Pairing Consider the following pairing: NOTE: Angelina prefers Brad to Vince, but Brad still prefers Jen to Angelina.

18
Stable marriage? (Brad, Jen) (Vince, Angelina) (George, Laura) Unstable since Jen and Vince both prefer each other to their current partners.

19
Running the Algorithm FIRST ROUND: Brad proposes to Jen Vince proposes to Laura George proposes to Jen

20
Brad proposes!

21
Running the Algorithm FIRST ROUND: Brad proposes to Jen Vince proposes to Laura George proposes to Jen Jen rejects George, engaged to Brad Laura engaged to Vince Angelina gets no proposals…. (Brad,Jen) and (Vince, Laura)

22
Running the Algorithm SECOND ROUND: George proposes to Laura Laura breaks engagement with Vince, and gets engaged to George (Brad,Jen) and (George,Laura)

23
Running the Algorithm THIRD ROUND: Vince proposes to Jen

25
Jen dumps Brad!

26
Running the Algorithm THIRD ROUND: Vince proposes to Jen Jen breaks engagement with Brad, and gets engaged to Vince (Vince,Jen) and (George,Laura)

27
Running the Algorithm FOURTH ROUND: Brad proposes to Angelina Angelina accepts and gets engaged to Brad (Vince,Jen), (George,Laura) and (Brad,Angelina)

28
The couples

29
Stable marriage? (Brad, Angelina) (Vince, Jen) (George, Laura)

30
This solution is stable! (Vince, Jen) (George, Laura) (Brad, Angelina) Vince prefers Laura to his partner Jen, but Laura would rather be with George. Brad prefers Jen to Angelina, but Jen would rather be with Vince. George prefers Jen to Laura, but Jen would rather be with Vince.

31
Optimal from the men’s point of view Each man gets the “best” possible partner in ANY stable solution. Unintuitive: look’s like the marriage is a good one for the women as well, or is it…?

32
Consider a different instance Brad proposes to Angelina Vince proposes to Jen George proposes to Laura All women accept since they only get one offer. NOTE: Each woman is paired with the worst possible partner. Now run the algorithm with the women proposing…..

33
Online stable marriages Assume that women’s preferences are known in advance. The men arrive one at a time and pick their most preferred available partner. This does not give a stable solution, and in fact may have MANY unstable pairs. Paper by Khuller, Mitchell and Vazirani (1991).

34
What went wrong? People’s preferences change….(?)

35
Scheduling Problems Arise in many industrial applications…. Computers schedule multiple tasks, people multi-task, complex projects have several interacting sub-parts. With large companies manufacturing many products, many interesting scheduling problems arise.

36
Cooking example Salad: 25m prep, 0m cooking Chicken noodle: 10m prep, 40 min cooking Rice pudding: 15 mins prep, 20m cooking

37
In what order should Martha make the dishes? Martha can work on preparing one dish at a time, however once something is cooking, she can prepare another dish. How quickly can she get all the dishes ready? She starts at 5pm, and her guests will arrive at 6pm….

38
First try 5:00pm5:25pm 5:35pm 5:50pm 6:15pm 6:10pm (25,0) (10,40) (15,20) Prep timeCook time

39
Second try 5:00pm5:10pm 5:25pm 5:50pm 5:45pm (10,40) (15,20) (25,0) First work on dishes with shortest preparation time?

40
This rule may not work all the time Suppose the required times are: Bulgur (5,10) Lentils (10, 60) Lamb (15, 75) Shortest prep time order: start at 5pm, and finish lamb at 6:45pm Longest cooking time first: food ready at 6:30pm.

41
What if she had to make several dishes? For 3 dishes, there are only 6 possible orders. SCR,SRC,RSC,RCS,CSR,CRS. The number of possible orderings of 10 dishes is 3,628,800. For 15 dishes the number of possible orderings is 1,307,674,368,000! This leads to a combinatorial explosion.

42
Key Idea Order dishes in longest cooking time order. Chicken noodle soup goes first (40 mins of cook time), next is the Rice pudding (20 mins of cook time), followed by the Salad (0 mins of cook time). This is the best ordering. In other words, no other order can take less time. This does not work if there are very few stovetops (now the problem becomes really difficult).

43
What if we had a small number of burners? Problem becomes very difficult if we have 2, 3, 4 burners.. Problem can be solved optimally if we only have one burner (Johnson, 1954)

44
Where to fill gas? Suppose you want to go on a road trip across the US. You start from New York City and would like to drive to San Francisco. You have : –roadmap –gas station locations and their gas prices Want to: –minimize travel cost The Gas Station Problem (Khuller, Malekian,Mestre), Eur. Symp. of Algorithms

45
Finding gas prices online

46
Two vertices s & t A fixed path Optimal solution involves stops at every station! Thus we permit at most stops. Structure of the Optimal Solution s v1v1 v2v2 v3v3 vnvn t 2.99$2.97$2.98$ 1.00$

47
The Problem we want to solve Input: –Road map G=(V,E), source s, destination t –U: tank capacity –d: E R + –c: V R + – : No. of stops allowed – : The initial amount of gas at s Goal: –Minimize the cost to go from s to t. Output: –The chosen path –The stops –The amount of gas filled at each stop Gas cost is “per mile” and U is the range of the car in miles. We can assume we start with 0 gas at s. s’ U - s c(s’)= 0 t

48
Dynamic Programming Assuming all values are integral, we can find an optimal solution in O(n 2 ∆ U 2 ) time. Not strongly polynomial time. The problem could be weakly NP-hard! OPT[x,q,g] = Minimum cost to go from x to t in q stops, starting with g units of gas.

49
Why not Shortest Path? Shortest path is of length 17. Cost = 37 = 4 7 + 3 3 Cheapest path is of length 18. Cost = 28 = 4 2 + 2 7 + 2 3 7 7 3 2 6 Start with 7 Tank capacity= 7 s 4 3 2 t 7 3 2 2 7

50
Key Property uiui u i+1 c(u i ) c(u i+1 ) Suppose the optimal sequence of stops is u 1,u 2,…,u . If c(u i ) < c(u i+1 ) Fill up the whole tank If c(u i ) > c(u i+1 ) Just fill enough to reach u i+1.

51
Solution Suppose the stop before x was y. The amount of gas we reach x with is For each x we need to keep track of at most n different values of g. t reach x with g units of gas At most q stops y x d( y, x) 0 U - d(y,x) OPT[x,q,g] = Minimum cost to go from x to t in q stops, starting with g units of gas. 0if c(x) < c(y) U - d(y,x)if c(x) c(y)

52
Tour Gas Station problem Would like to visit a set of cities T. We have access to set of gas stations S. Assume gas prices are uniform. –The problem is extremely hard even with this restriction. –We may have a deal with a particular gas company.

53
The research process

55
Problems, Graphs and Algorithms Is there a way to walk on every bridge exactly once and return to the starting point? L. Euler (1707—1783)

56
K o nigsberg Bridge Problem Model each land mass as a node, each bridge as a link between the two nodes. If we start and end at the same node, we must enter and leave each node on a distinct edge each time; hence each node should have an EVEN number of links. This condition is required and is sufficient. A D C B

57
More on Graphs Draw this figure without lifting your pencil, and without repeating a line. It cannot be done since there are FOUR nodes of odd degree. Possible only if there were TWO.

58
Applications of Euler tours

59
Energy Minimization for Sensors Sensors monitor targets. We can extend the lifetime of the system by creating an on/off schedule for the sensors.

60
New England Kidney Exchange A donor’s kidney may not match the person they wish to donate to. In this case, perhaps another pair has the same problem and the kidneys can be swapped. A C D B Use an algorithm for Maximum matchings in graphs (Edmonds 1965). Each node here is a COUPLE

61
Re-assigning Starbucks employees to reduce commute times Article from the Washington Post A B C D D B C A

62
Energy Minimization Consider fire monitoring. Sensors have: –Fixed locations –Limited battery power If sensors are always on: –Full coverage over the regions –Short system life time Better solution: –Activating sensors in multiple time slots Benefits: –Make use of overlap –Turning sensors on and off increase their life time Regions(Targets ) Sensors A B C D S1S1 S2S2 S3S3 S4S4 Work with A. Deshpande, A.Malekian and M. Toossi

63
Disjoint Paths Given a graph, how can we find k disjoint paths between two nodes?

64
Data Placement & Migration Data Layout: load balancing –Disks have constraints on space, load, etc. –User data access pattern which changes with time Primarily joint work with L. Golubchik, S. Kashyap, Y-A. Kim, S. Shargorodskaya, J. Wan, and A. Zhu

65
Scheduling Meetings for Visit Day Applicants visit, each will have 3 individual meetings with faculty. Applicants tell us which three faculty they would like to meet with. Assume for simplicity that at most 3 applicants want to meet a faculty member. How do we schedule the meetings between 2 and 3:30pm? Each meeting will last 30 mins.

66
Example Schedule 2:00-2:30 2:30-3:003:00-3:30 Castro Dr. Mount Dr. Spring Dr. Katz Gandhi Dr. Davis Dr. Mount Dr. Jacobs Clinton Dr. Spring Dr. Davis Dr. Bobby Don Dr. BobbyDr. Getoor Dr. Mount

67
Now Don wants to meet Dr. Spring instead of Dr. Bobby 2:00-2:30 2:30-3:003:00-3:30 Castro Dr. Mount Dr. Spring Dr. Katz Gandhi Dr. Davis Dr. Mount Dr. Jacobs Clinton Dr. Spring Dr. Davis Dr. Bobby Don Dr. Getoor Dr. Mount

68
Graph Edge Coloring Color each edge, so that colors that share end points have distinct colors.

69
Graph Edge Coloring Color each edge, so that colors that share end points have distinct colors.

70
Level of Difficulty Problem is easy if faculty do not give constraints as to when they are available. Otherwise the problem becomes computationally very difficult. In other words, we have to search an extremely large search space to solve it.

71
Approximation Algorithms For many problems, no simple (or complex!) rules seem to work. Such problems arise very frequently – the famous Traveling Salesperson Problem is an example. How should we cope with this? Our attempt is to develop a set of tools that would give rise to methods for approaching such problems. Even if we cannot find the optimal solutions quickly, perhaps we can find almost optimal solutions quickly? Greedy Methods, LP rounding methods, Primal-Dual methods. In general, these methods also provide lower bounding methods

72
Acknowledgements Lecture dedicated to the memory of my grandfather, Prof. Ish Kumar (1902—1999). Academic Influence Prof. R. Karp, Prof. V. Vazirani, Prof. J. Mitchell, Prof. E. Arkin, Prof. U. Vishkin My wonderful co-authors, especially, B. Raghavachari, N. Young, A. Srinivasan, L. Golubchik, B.Bhattacharjee, D. Mount, S. Mitchell, B. Schieber, A. Rosenfeld, J. Naor, R. Hassin, S. Guha, M. Charikar, R. Thurimella, R. Pless, M Shayman, G. Kortsarz. My Ph.D. students – R. Bhatia, Y.Sussmann, R. Gandhi, Y-A. Kim, J. Wan, J. Mestre, S. Kashyap, A. Malekian. Undergrads – K. Matherly, D. Hakim, J. Pierce, B. Wulfe, A. Zhu, S. Shargorodskaya, C. Dixon, J. Chang, M. McCutchen. Above all, a BIG thanks to all members of my family, friends and relatives. I cannot express my thanks deeply enough.

Similar presentations

OK

1 Algorithms. Algorithms Introduction Recipe for baking a cake…. 2 sticks butter 2 cups flour 1 cup sugar 4 eggs 1 cup milk 1 tsp baking powder Cocoa.

1 Algorithms. Algorithms Introduction Recipe for baking a cake…. 2 sticks butter 2 cups flour 1 cup sugar 4 eggs 1 cup milk 1 tsp baking powder Cocoa.

© 2018 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Mis ppt on hospital How to save ppt on ipad 2 Ppt on ready to serve beverages recipe Ppt on social networking good or bad Ppt on icici prudential life insurance Ppt on different means of transport Ppt on solid dielectrics effect Ppt on simple network management protocol Ppt on interesting facts about dreams Download seminar ppt on android