Top Banner

of 57

Dst Talk

Apr 14, 2018

Download

Documents

Mutyalu Gadam
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 7/30/2019 Dst Talk

    1/57

    Whom to marry, how to cook andwhere to buy gas: solving

    dilemmas of daily life, onealgorithm at a time

    SAMIR KHULLERDept. of Computer Science

    University of Maryland

  • 7/30/2019 Dst Talk

    2/57

    y y

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

  • 7/30/2019 Dst Talk

    3/57

    Algorithms not Logarithms!

    AL GO R I T H M

    Al-Khowarizmi

  • 7/30/2019 Dst Talk

    4/57

    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 beateneggs, melted butter and bake at 325F for 40 mins.

  • 7/30/2019 Dst Talk

    5/57

    ALGORITHMS

    Set ofinstructions for solving a problem, tofind a solution.

    What is a problem?

    What is an instruction?

    What is a solution?

  • 7/30/2019 Dst Talk

    6/57

    Computer Science

    What is the computeractually doing?

    Its running a program

    (a set of instructions),but what is theprogram doing?

    Typically, analgorithm is what theprogram implements.

  • 7/30/2019 Dst Talk

    7/57

    Outline of talk

    Algorithms and their Applications

    Whom to Marry?

    How to Cook? Where to buy gas?

    A few favorite projects of mine..

    Acknowledgements

  • 7/30/2019 Dst Talk

    8/57

  • 7/30/2019 Dst Talk

    9/57

    Why are algorithms central tocomputing?

    An airport shuttle company needs to schedulepickups delivering everyone to the airport ontime. 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 theyschedule deliveries to the customers to minimize

    their cost?

    This leads to interesting algorithmic problems

  • 7/30/2019 Dst Talk

    10/57

    There are lots of feasible solutions!

    How should we pick amongst thesesolutions?

    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!

  • 7/30/2019 Dst Talk

    11/57

    A disclaimer

    I have chosen a set of problems whosealgorithms are quite simple.

    Towards the end of the talk I will alsomention some recent projects that are alittle more involved, and its hard to reallydescribe the algorithms and methods used

    since they are quite complex.

  • 7/30/2019 Dst Talk

    12/57

    The Marriage Problem

    N men, N women

    Each person provides a ranking of themembers of the opposite sex

    Can we find a good marriage?

    First studied by Gale and Shapley (1962)

  • 7/30/2019 Dst Talk

    13/57

    An application: resident matchingprogram

    Each resident rank orders the hospitals,and each hospital rank orders theresidents.

    How do we choose an assignment ofresidents to hospitals?

    We do not want a situation that a resident

    prefers another hospital, and that hospitalpreferred this resident to the personassigned to them.

  • 7/30/2019 Dst Talk

    14/57

    Mens Preference Lists

    Brad (B)

    George(G)

    Vince(V)

    Jennifer(J) Laura(L) Angelina(A)1 2 3

  • 7/30/2019 Dst Talk

    15/57

    Womens Preference List

    Jennifer(J)

    Angelina(A)

    Laura(L)

    1 2 3

    Brad(B) George(G) Vince(V)

  • 7/30/2019 Dst Talk

    16/57

    Stable Marriage Problem

    A marriage is unstable if there is a pair ofpeople, not married to each other, suchthat both prefer each other to their currentpartners. In other words, they have anincentive to elope.

    Can we find a stable marriage?

  • 7/30/2019 Dst Talk

    17/57

    Stable marriage?

    (Brad, Jen)

    (Vince, Angelina)

    (George, Laura)

    Unstable since

    Jen and Vinceboth prefereach other totheir currentpartners.

  • 7/30/2019 Dst Talk

    18/57

    Running the Algorithm

    FIRST ROUND:

    Brad proposes to Jen

    Vince proposes to Laura

    George proposes to Jen

  • 7/30/2019 Dst Talk

    19/57

    Brad proposes!

  • 7/30/2019 Dst Talk

    20/57

    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)

  • 7/30/2019 Dst Talk

    21/57

    Running the Algorithm

    SECOND ROUND:

    George proposes to Laura

    Laura breaks engagement with

    Vince, and gets engaged toGeorge

    (Brad,Jen) and (George,Laura)

  • 7/30/2019 Dst Talk

    22/57

    Running the Algorithm

    THIRD ROUND:

    Vince proposes to Jen

  • 7/30/2019 Dst Talk

    23/57

  • 7/30/2019 Dst Talk

    24/57

    Jen dumps Brad!

  • 7/30/2019 Dst Talk

    25/57

    Running the Algorithm

    THIRD ROUND:

    Vince proposes to Jen

    Jen breaks engagement with

    Brad, and gets engaged toVince

    (Vince,Jen) and (George,Laura)

  • 7/30/2019 Dst Talk

    26/57

    Running the Algorithm

    FOURTH ROUND:

    Brad proposes to Angelina

    Angelina accepts and gets

    engaged to Brad

    (Vince,Jen), (George,Laura) and(Brad,Angelina)

  • 7/30/2019 Dst Talk

    27/57

    The couples

  • 7/30/2019 Dst Talk

    28/57

    Stable marriage?

    (Brad, Angelina)

    (Vince, Jen)

    (George, Laura)

  • 7/30/2019 Dst Talk

    29/57

    This solution is stable!

    (Vince, Jen) (George, Laura) (Brad, Angelina)

    Vince prefers Laura to his partner Jen, butLaura would rather be with George.

    Brad prefers Jen to Angelina, but Jenwould rather be with Vince.

    George prefers Jen to Laura, but Jenwould rather be with Vince.

  • 7/30/2019 Dst Talk

    30/57

    Optimal from the mens point of

    view

    Each man gets the best possible partner

    in ANY stable solution.

    Unintuitive: looks like the marriage is a

    good one for the women as well, or is it?

  • 7/30/2019 Dst Talk

    31/57

    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 withthe worst possible partner.Now run the algorithm with the womenproposing..

  • 7/30/2019 Dst Talk

    32/57

    Online stable marriages

    Assume that womens preferences are

    known in advance. The men arrive one ata 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).

  • 7/30/2019 Dst Talk

    33/57

    What went wrong? Peoples preferences change.(?)

  • 7/30/2019 Dst Talk

    34/57

    Scheduling Problems

    Arise in many industrial applications.

    Computers schedule multiple tasks,people multi-task, complex projects haveseveral interacting sub-parts.

    With large companies manufacturing manyproducts, many interesting scheduling

    problems arise.

  • 7/30/2019 Dst Talk

    35/57

    Cooking example

    Salad:

    25m prep, 0m cooking

    Chicken noodle:10m prep, 40 min cooking

    Rice pudding:15 mins prep, 20m cooking

  • 7/30/2019 Dst Talk

    36/57

    In what order should Martha makethe dishes?

    Martha can work on preparing one dish ata time, however once something iscooking, she can prepare another dish.

    How quickly can she get all the dishesready?

    She starts at 5pm, and her guests will

    arrive at 6pm.

  • 7/30/2019 Dst Talk

    37/57

    First try

    5:00pm 5:25pm 5:35pm5:50pm

    6:15pm 6:10pm

    (25,0) (10,40) (15,20)

    Prep time Cook time

  • 7/30/2019 Dst Talk

    38/57

    Second try

    5:00pm 5:10pm 5:25pm 5:50pm

    5:50pm 5:45pm

    (10,40) (15,20)(25,0)

    First work on dishes with shortest preparation time?

  • 7/30/2019 Dst Talk

    39/57

    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, andfinish lamb at 6:45pm

    Longest cooking time first: food ready at6:30pm.

  • 7/30/2019 Dst Talk

    40/57

    What if she had to make severaldishes?

    For 3 dishes, there are only 6 possibleorders. SCR,SRC,RSC,RCS,CSR,CRS.

    The number of possible orderings of 10dishes is 3,628,800.

    For 15 dishes the number of possibleorderings is 1,307,674,368,000!

    This leads to a combinatorial explosion.

  • 7/30/2019 Dst Talk

    41/57

    Key Idea

    Order dishes in longest cooking time order.

    Chicken noodle soup goes first (40 mins of cooktime), next is the Rice pudding (20 mins of cooktime), followed by the Salad (0 mins of cooktime).

    This is the best ordering. In other words, noother order can take less time.

    This does not work if there are very fewstovetops (now the problem becomes reallydifficult).

  • 7/30/2019 Dst Talk

    42/57

    What if we had a small number ofburners?

    Problem becomesvery difficult if wehave 2, 3, 4 burners..

    Problem can besolved optimally if weonly have one burner(Johnson, 1954)

  • 7/30/2019 Dst Talk

    43/57

    Where to fill gas?

    Suppose you want to go on a road trip across theUS. You start from New York City and would like todrive 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

  • 7/30/2019 Dst Talk

    44/57

    Finding gas prices online

  • 7/30/2019 Dst Talk

    45/57

    Two vertices s & t

    A fixed path

    Optimal solution involves stops at everystation!

    Thus we permit at most stops.

    Structure of the Optimal Solution

    sv1 v2 v3 vn t

    2.99$ 2.97$2.98$ 1.00$

  • 7/30/2019 Dst Talk

    46/57

    The Problem we want to solve

    Input: Road map G=(V,E), source s, destination t

    U: tank capacity

    d: ER+ c: VR+ : 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.

    s

    U -

    s

    c(s)= 0

    t

  • 7/30/2019 Dst Talk

    47/57

    Dynamic Programming

    Assuming all values are integral, we can find anoptimal solution in O(n2 U2) 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.

  • 7/30/2019 Dst Talk

    48/57

    Key Property

    ui ui+1

    c(ui) c(ui+1)

    Suppose the optimal sequence of stops is u1,u2,,u.

    If c(ui) < c(ui+1)

    Fill up the whole tank If c(ui) > c(ui+1)Just fill enough to reach ui+1.

  • 7/30/2019 Dst Talk

    49/57

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

    We may have a deal with a particular gas

    company.

  • 7/30/2019 Dst Talk

    50/57

    The research process

  • 7/30/2019 Dst Talk

    51/57

    Problems, Graphs and Algorithms

    Is there a way to walk on every bridge exactlyonce and return to the starting point?

    L. Euler (17071783)

  • 7/30/2019 Dst Talk

    52/57

    New England Kidney Exchange

    A donors kidneymay not match theperson they wish todonate to.

    In this case, perhapsanother pair has thesame problem and

    the kidneys can beswapped.

    A C

    D

    B

    Use an algorithm for Maximum matchings in graphs (Edmonds 1965).

    Each node here

    is a COUPLE

    Re-assigning Starbucks employees

  • 7/30/2019 Dst Talk

    53/57

    Re assigning Starbucks employeesto reduce commute times

    Article from the Washington PostA

    BC

    DD

    B

    C

    A

    S S

  • 7/30/2019 Dst Talk

    54/57

    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

    Sensors A

    B

    C

    D

    S1

    S2

    S3S4

    Work with A. Deshpande, A.Malekian

    and M. Toossi

  • 7/30/2019 Dst Talk

    55/57

    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

  • 7/30/2019 Dst Talk

    56/57

    Approximation Algorithms

    For many problems, no simple (or complex!) rules seemto work.

    Such problems arise very frequently the famousTraveling 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 ifwe cannot find the optimal solutions quickly, perhaps wecan find almost optimal solutions quickly?

    Greedy Methods, LP rounding methods, Primal-Dualmethods.

    In general, these methods also provide lower boundingmethods

  • 7/30/2019 Dst Talk

    57/57

    Acknowledgements

    Lecture dedicated to the memory of my grandfather, Prof. Ish Kumar (19021999).

    Academic InfluenceProf. 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 cannotexpress my thanks deeply enough.