- By
**vivi** - Follow User

- 116 Views
- Uploaded on

Download Presentation
## PowerPoint Slideshow about ' A typical conversation' - vivi

**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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript

Whom to marry, how to cook and where to buy gas: solving dilemmas of daily life, one algorithm at a time SAMIR KHULLERDept. of Computer ScienceUniversity of Maryland

A typical conversation dilemmas of daily life, one algorithm at a time

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.

Algorithms not Logarithms! dilemmas of daily life, one algorithm at a time

L

O

G

A

R I T H M

Al-Khowarizmi

Algorithms Introduction dilemmas of daily life, one algorithm at a time

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.

ALGORITHMS dilemmas of daily life, one algorithm at a time

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

Computer Science dilemmas of daily life, one algorithm at a time

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

Outline of talk dilemmas of daily life, one algorithm at a time

- Algorithms and their Applications
- Whom to Marry?
- How to Cook?
- Where to buy gas?
- A few favorite projects of mine..
- Conclusions

Why are algorithms central to computing? dilemmas of daily life, one algorithm at a time

- 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…

There are lots of feasible solutions! dilemmas of daily life, one algorithm at a time

- 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!

A disclaimer dilemmas of daily life, one algorithm at a time

- I have chosen a set of problems whose algorithms are quite simple, so they are easy to describe. Most research problems are significantly more complex.
- 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.

An application: resident matching program dilemmas of daily life, one algorithm at a time

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

The Marriage Problem dilemmas of daily life, one algorithm at a time

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

Men’s Preference Lists dilemmas of daily life, one algorithm at a time

Brad (B)

Vince(V)

2

3

1

George(G)

Jennifer(J)

Laura(L)

Angelina(A)

Women’s Preference List dilemmas of daily life, one algorithm at a time

Jennifer(J)

Angelina(A)

1

2

3

Laura(L)

George(G)

Vince(V)

Brad(B)

Stable Marriage Problem dilemmas of daily life, one algorithm at a time

- 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?

Stable marriage? dilemmas of daily life, one algorithm at a time

(Brad, Jen)

(Vince, Angelina)

(George, Laura)

Unstable since Jen and Vince both prefer each other to their current partners.

Running the Algorithm dilemmas of daily life, one algorithm at a time

FIRST ROUND:

Brad proposes to Jen

Vince proposes to Laura

George proposes to Jen

Brad proposes! dilemmas of daily life, one algorithm at a time

Running the Algorithm dilemmas of daily life, one algorithm at a time

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)

Running the Algorithm dilemmas of daily life, one algorithm at a time

SECOND ROUND:

George proposes to Laura

Laura breaks engagement with Vince, and gets engaged to George

(Brad,Jen) and (George,Laura)

Running the Algorithm dilemmas of daily life, one algorithm at a time

THIRD ROUND:

Vince proposes to Jen

Jen dumps Brad! dilemmas of daily life, one algorithm at a time

Running the Algorithm dilemmas of daily life, one algorithm at a time

THIRD ROUND:

Vince proposes to Jen

Jen breaks engagement with Brad, and gets engaged to Vince

(Vince,Jen) and (George,Laura)

Running the Algorithm dilemmas of daily life, one algorithm at a time

FOURTH ROUND:

Brad proposes to Angelina

Angelina accepts and gets engaged to Brad

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

The couples dilemmas of daily life, one algorithm at a time

Stable marriage? dilemmas of daily life, one algorithm at a time

(Brad, Angelina)

(Vince, Jen)

(George, Laura)

This solution is stable! dilemmas of daily life, one algorithm at a time

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

Consider a different instance dilemmas of daily life, one algorithm at a time

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

Online stable marriages dilemmas of daily life, one algorithm at a time

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

Scheduling Problems dilemmas of daily life, one algorithm at a time

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

Cooking example dilemmas of daily life, one algorithm at a time

Salad:

25m prep, 0m cooking

Chicken noodle:

10m prep, 40 min cooking

Rice pudding:

15 mins prep, 20m cooking

In what order should Martha make the dishes? dilemmas of daily life, one algorithm at a time

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

First try dilemmas of daily life, one algorithm at a time

Prep time

Cook time

(10,40)

(25,0)

(15,20)

5:00pm

5:25pm

5:35pm

5:50pm

6:15pm

6:10pm

Second try dilemmas of daily life, one algorithm at a time

(15,20)

(10,40)

(25,0)

5:00pm

5:10pm

5:25pm

5:50pm

5:50pm

5:45pm

First work on dishes with shortest preparation time?

This rule may not work all the time dilemmas of daily life, one algorithm at a 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.

What if she had to make several dishes? dilemmas of daily life, one algorithm at a time

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

Key Idea dilemmas of daily life, one algorithm at a time

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

What if we had a small number of burners? dilemmas of daily life, one algorithm at a time

- Problem becomes very difficult if we have 2, 3, 4 burners..
- Problem can be solved optimally if we only have one burner (Johnson, 1954)

Where to fill gas? dilemmas of daily life, one algorithm at a time

The Gas Station Problem (Khuller, Malekian,Mestre), Eur. Symp. of Algorithms

- Suppose you want to go on a road trip across the US. You start from St. Mary’s City and would like to drive to San Francisco.
- You have :
- roadmap
- gas station locations and their gas prices

- Want to:
- minimize travel cost

Finding gas prices online dilemmas of daily life, one algorithm at a time

Structure of the Optimal Solution dilemmas of daily life, one algorithm at a time

- Two vertices s & t
- A fixed path
- Optimal solution involves stops at every station!
- Thus we permit at most stops.

v1

vn

v2

v3

t

s

1.00$

2.99$

2.98$

2.97$

The Problem we want to solve dilemmas of daily life, one algorithm at a time

- 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.
- We can assume we start with 0 gas at s.

c(s’)= 0

s

t

s’

U -

Dynamic Programming dilemmas of daily life, one algorithm at a time

- Assuming all values are integral, we can find an optimal solution in O(n2 ∆ U2) time.
- Not strongly polynomial time.The problem could be weakly NP-hard!

Minimum cost to go from x to t in q stops, starting with g units of gas.

OPT[x,q,g] =

Key Property dilemmas of daily life, one algorithm at a time

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.

ui+1

ui

c(ui)

c(ui+1)

The research process dilemmas of daily life, one algorithm at a time

Problems, Graphs and Algorithms dilemmas of daily life, one algorithm at a time

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

L. Euler (1707—1783)

K dilemmas of daily life, one algorithm at a time onigsberg Bridge Problem

A

C

D

B

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

New England Kidney Exchange dilemmas of daily life, one algorithm at a time

C

A

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

D

B

Each node here

is a COUPLE

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

Re-assigning Starbucks employees to reduce commute times dilemmas of daily life, one algorithm at a time Article from the Washington Post

A

A

B

B

C

C

D

D

Data Placement & Migration dilemmas of daily life, one algorithm at a time

Primarily joint work with L. Golubchik, S. Kashyap, Y-A. Kim, S. Shargorodskaya,

J. Wan, and A. Zhu

- Data Layout: load balancing
- Disks have constraints on space, load, etc.
- User data access pattern which changes with time

Conclusions dilemmas of daily life, one algorithm at a time

- Combinatorial problems arise naturally in daily life.
- Very similar sounding problems may behave very differently.
- Very important challenges still lie ahead.
- Hopefully some of you want to study Mathematics and Computer Science!

Download Presentation

Connecting to Server..