How to Carpool Fairly

31
How to Carpool Fairly Moni Naor

description

How to Carpool Fairly . Moni Naor. The carpool problem. A group of n people form a carpool. Each day a subset arrives to a (fixed) gathering point and one of them should drive. Looking for a fair method for determining which person should drive on any given day. - PowerPoint PPT Presentation

Transcript of How to Carpool Fairly

Page 1: How to Carpool Fairly

How to Carpool Fairly

Moni Naor

Page 2: How to Carpool Fairly

The carpool problem

• A group of n people form a carpool.– Each day a subset arrives to a (fixed) gathering point

and one of them should drive.• Looking for a fair method for determining which

person should drive on any given day.– What is the criterion for fairness?

• Given a schedule what is the fair share of each participant– How to assign each day a single driver among the

people who showed up• Want to be as close as possible to the fair share of each

participant

Page 3: How to Carpool Fairly

Example n=5 and 10 days

D1 D2 D3 D4 D5 D6 D7 D8 D9 D10

12345

xxx

x

x

x

xx

xxx

xx

xxx

x

x

x

x

xx

xxxx

xx

What happens if schedule is repeated twice?

Page 4: How to Carpool Fairly

Fairness Criterion

• Fairness is a very intuitive yet controversial notion• A large part of Game Theory deals with quantifying

fairness• What is the appropriate criterion in our case?

– Can start with a list of desiderata…• How to measure the unfairness of a given schedule

and assignment

Page 5: How to Carpool Fairly

The FW Share• Idea: If the people who show up on a given day had hired a

(taxi) driver splitting the cost looks natural.– If di people show on day Di they should each `pay’ 1/di

Hence, the desired share of a participant is the sum of the inverses of the number of people who showed

up on the days he showed up. Terminology: schedule T = D1, D2, … Dℓ where Dj µ

[n] corresponds to the people who show up on day j FW-Share for participant i:

FWi={1· j · ℓ | i 2 Dj} 1/|Dj|

The FW shares sum up to ℓ : i=1

n FWi=

i=1n

{ j | i 2 Dj}

1/|Dj|= ℓ

Page 6: How to Carpool Fairly

The Example with FW Shares

D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 FW-Share

12345

xxx

x

x

x

xx

xxx

xx

xxx

x

x

x

x

xx

xxxx

xx

4¢⅓+ ¼ ⅓ +1¾1½2½4¢⅓+1

⅓ ½ ⅓ ⅓ 1 ¼ ⅓ ⅓ ¼ ½ 10For repeated schedule differences are very significant!

Page 7: How to Carpool Fairly

How close can we get to the FW Share?

• Given a schedule D1, D2, … want to assign drivers so that the number of times each

participant drives is as close as possible to the FW-Share• Is it possible?

– Given that the FW Share may be fractional at best can hope for some rounding of the value

Problem: given a schedule and a rounding of the FW Shares preserving the total number of days is it possible to find an assignment of drivers realizing it?

Page 8: How to Carpool Fairly

What happens when exactly two people show every daythe motorpool problem

• Can view input as a (multi)graph

Node= participantsEdges=daysOrientation of the edges – who drives on each dayWant an orientation of the edges so that the difference

between the indegree and outdegree is• Small• Follows a given list

Page 9: How to Carpool Fairly

Two people per day• If the degrees are all even

– can find an orientation with equal indegrees and outdegrees at each node

– How? Follow the Eulerian Cycle• In general: can find an orientation with

max difference at most 1– Add a matching to between the nodes

with odd degrees• There is an even number of them

– Follow the Eulerian Cycle in the resulting graph

Good news: can achieve the FW Share for the motorcycle-pool problem when the schedule is given in advance

Page 10: How to Carpool Fairly

Generalization: the vector rounding problem

Given a list of n dimensional vectors over the realsV1, V2, … Vℓ

Find a list of n dimensional vectors over the integersZ1, Z2, … Zℓ

Where each Zj = (zj1, zj

2 … zjn) is a rounding of Vj = (vj

1, vj2 … vj

n) that preserves the sum

Preservation Requirements: • Each entry is rounded: for all 1 · j · ℓ, 1·i· n

b vji c · zj

i · d vji e

• Each column sum is preserved: for all 1 · j · ℓ b i=1

n vji c · i=1

n zji · d i=1

n vji e

• Each row sum is preserved: for all 1·i· n b j=1

ℓ vji c · j=1

ℓ zji · d j=1

ℓ vji e

Page 11: How to Carpool Fairly

Casting the carpool problem as vector rounding• For each day Dj a vector Vj = (vj

1, vj2 … vj

n) where for all 1·i· n

vji =

• If there is always a solution to the vector rounding problem satisfying the preservation requirements then:– always possible to find an assignment to the carpool problem where

each participant i drives either bFWi c or d FWi e times.– Given any integer rounding Li of the FWi ’s that preserves their

sum always possible to find an assignment to the carpool problem where each participant i drives Li times (the load on i)

• add a vector V0 where v0i = Li -FWi

1/|Dj| if j 2 Dj

0 otherwise

Page 12: How to Carpool Fairly

Solving the vector rounding problem

The Preservation Requirements: • for all 1 · j · ℓ, 1·i· n

b vji c · zj

i · d vji e

• for all 1 · j · ℓ b i=1

n vji c · i=1

n zji · d i=1

n vji e

• for all 1·i· n b j=1

ℓ vji c · j=1

ℓ zji · d j=1

ℓ vji e

• Define an integer linear program where the zj

i are the variables

• It has a fractional solution Simply zj

i = vji

• Want to argue that it has an integral solution

Claim: all the basic feasible solutions are integral.

Page 13: How to Carpool Fairly

A flow problem

Modified Preservation Requirements: Make uj

i = vji -b vj

i c and xji =zj

i -b vji c

• for all 1 · j · ℓ, 1·i· n 0 · xj

i · 1• for all 1 · j · ℓ b i=1

nuji c · i=1

n xji · d i=1

n uji e

• for all 1·i· nb j=1

ℓ uji c · j=1

ℓ xji · d j=1

ℓ uji e

rows columns

d uji e

d i=1n uj

i e

bj=1ℓ i=1

n uji c

d j=1ℓ uj

i e

Flow problems with integral constraints have only integral bfs

Page 14: How to Carpool Fairly

Alternative proof for the existence of an assignment satisfying the FW Share

Assume wlog all the FWi are integral • Start with any assignment and suppose that not all the participants get FWi . • Partition them into three sets

– Set F: Those that drove more than their fair share– Set P: those that drove less than their fair share – Set Q: those that drove exactly their fair share. Must have F and P since the sum over all participants of the difference between the FWi

and the actual load is zero. Consider the directed graph on n nodes where each node corresponds to a participant

– Put a directed edge between any two participants if ever the head drove the tail took a ride.– There must be directed path from a node in F to a node in P (going perhaps through Q).– Reassign the edges of the path so that all the tails drive instead of all the heads.

• The sum over P of the difference between FWi and the actual load has decreased by 1 – from the integrality assumption it did not go below zero. – Therefore we can repeat the above procedure only a finite number of times before all the

participants get their fair load.

Page 15: How to Carpool Fairly

Algorithms for the carpool problem

• If we are given the schedule in advance then we can find a good assignment efficiently

• What happens in the online decision case: we have to decide who drives on day j knowing only D1, D2, … Dj

• How to measure the unfairness of– An assignment

• Maximum deviation from the FW-Share max1 · i · n|Li -FWi |

– An algorithm• Worst case, average case, expected…

Page 16: How to Carpool Fairly

The Motorpool problem – the online caseOn a fixed set of n nodes a sequence of edges is given one by one• Need to orient each edge as it arrives• Want to minimize the maximum absolute difference between

indegree and outdegree– Unfairness of corresponding carpool (=motorpool) problem is half of that

Will see:• Lower bound• Upper bounds• The motorpool problem captures the general carpool problem as

well as the vector rounding problem

Page 17: How to Carpool Fairly

Lower Bound• To bound the performance of deterministic algorithms:

should describe an adversary who selects the next edge based on current state.

Adversary’s Algorithm for creating the edges of a multi-graph:While there is no node with absolute difference at least (n-1)/2 • Select a pairs of nodes with the same difference between indegree

and outdegree• If none exists stop

There are at least n different values for the difference –• if n is odd at least one is either (n-1)/2 (or larger) or (n-1)/2 (or smaller) • if n is even at least one is either n/2 (or larger) or (or smaller)

Claim: for any method of orienting the edges the adversary’s algorithm stops after O(n3) steps.

0 1 2-2 -1

Page 18: How to Carpool Fairly

Proof of lower bound• For any directed multi-graph let d1, d2, dn be the sorted (ascending)

sequence of the absolute differences between the indegree and outdegree• Consider the potential function

(d1, d2, dn )=i=1n idi

• If (d1, d2, dn ) n3, then dn must be at least n• If nodes corresponding to di and di+1 (where di=di+1) are selected then

(d’1, d’2, d’n ) (d1, d2, dn )+1 Since id + (i+1)d = i(d-1)+(i+1)(d+1) -1

So adversary stops after at most O(n3) selections. Difference in at least one of the nodes is at least (n-1)/2

Least growth when only two with difference d

Newly sorted

Page 19: How to Carpool Fairly

Local Greedy algorithm• For all pairs of nodes i and j make the orientation of the multi-edges between them

as even as possible– For an even number of multi-edges – exactly half each way– For an odd number break ties according to some rule

Tie Breaking rules• Arbitrary: difference between indegree and outdegree at most n-1 (unfairness

(n-1)/2)• A fixed pattern: if i-j < n/2 then i is the first head, otherwise j

– Difference between indegree and outdegree at most (n-1)/2 (unfairness (n-1)/4). • Random: maximum difference between indegree and outdegree is bounded with

high probability by (n log n)1/2

– If the adversary choosing the edges is oblivious to the orientation, then the graph of the odd edges is randomly oriented.

– For every node with neighborhood of size m by the Chernoff-Hoefding bound with probability at least (1-1/n2) the discrepancy is at most (m log n)1/2

– All neighborhoods have of discrepancy at most (n log n)1/2 with probability at least 1-1/n

Better than the deterministic lower bound!

Page 20: How to Carpool Fairly

From motorpool to vector roundingAssume wlog that i=1

n vji is an integer

• Consider the bit representation of (vj1, vj

2 … vjn)

– use accuracy t= 2 d log j e (while preserving integrality)– Run t motorpool instances simultaneously

• One for each bit position• The tth problem: take the tth bits of (vj

1, vj2 … vj

n) and partition into pairs that are both 1’s

– from integrality there is an even number of such vectors• Treat the pairs as edges in the motorpool problem, use the orientation to

decide which bit to round up (adding 2t ) and which to round down (subtracting 2t )

• Procedure preserves i=1n vj

i • Continue with the next problem

Claim: if the discrepancy of each motorpool problem is bounded by (n,ℓ), then the discrepancy is bounded by 2(n, ℓ). True also for randomized algorithms

0.110011001012 … t

Page 21: How to Carpool Fairly

Global Greedy for general carpool problem

Given the schedule for the first j days only D1, D2, … Dj-1 and the assignment of drivers and day Dj have to decide who drives from Dj

• Global greedy rule: The driver is the one who will least increase the deviation from the FW-Shares. The one with the largest Li -FWi

How to implement Global Greedy: • Give people money (same amount initially)

– No need for more than n/2• On any given day the driver gets 1/d from all d-1 riders• Who drives? the poorest one.

Theorem: for any adversary scheduling the days the maximum unfairness of Global Greedy is at most (n-1)/2

Page 22: How to Carpool Fairly

The random label algorithm • Choose for each participant i a label infinite random binary string

si 2 {0,1}∞

When i and j are matched • let k be largest common prefix of si and sj• Orient the edge according to whether si(k+1) or si(k+1) are 1• Switch si(k+1) and sj(k+1) Claim: at any point in time the discrepancy of participant i is bounded by the longest prefix ever used.

Claim: for any sequence of edges at any point in time the si’s are random and independent from each otherBy induction on time

Theorem: Maximum unfairness is with high probability O(log ℓ)For ℓ pairs of random strings the maximum common prefix is roughly 2log ℓ

si=01100110010110…sj=01100101011001…

k

Page 23: How to Carpool Fairly

Properties of the local greedy algorithm

• The unfairness of participant i is bounded by the total number of people with whom i interacts (shows up on the same day). – even if there is a very large carpool group, but i interacts with only a few

of them, (say ni) then his unfairness will be very small (O(ni) deterministically and O((ni log n)1/2) probabilistically).

• There is no need for maintaining:– global information, – trusted bookkeeping, e.g. currency. It is enough that every two participants record their mutual history (actually

a single bit).• Probabilistic analysis of uniformly chosen edges: O(loglog n)

Page 24: How to Carpool Fairly

Axioms for Fair SharingFor a given schedule DD=D1, D2, … Dℓ want to assign for each participant i a fair

share i(DD). Requirements from the function :

• Full Coverage: the sum of the fair shares of all participants equals the total number of days in the schedule

i=1n i(DD)=ℓ.

• Symmetry: If two participants i and j have exactly the same schedule, that is they appear on the same set of days, then their fair shares should be the same.

i(DD)= j(DD)• Dummy: A participant that never shows on any day has share 0.• Concatenation: Given two schedules DD1 and DD2 consider the schedule D=DD=D1 DD2

resulting from the concatenation of the two. Then the fair share of each player i for D D is the sum of the fair shares of i for DD1 and DD2

i(DD)=i(DD1)+ i(DD2).

Page 25: How to Carpool Fairly

Are the requirements self evident?• Full Coverage: the sum of the fair shares of all participants equals

the total number of days in the schedule i=1n i(DD)=ℓ.

• Symmetry: If two participants i and j have exactly the same schedule, the fair shares should be the same.

i(DD)= j(DD)

• Dummy: A participant that never shows on any day has share 0.

• Concatenation: if D=DD=D1 DD2 then i(DD)=i(DD1)+ i(DD2).

We want to cover all days

Essence of fairness

What else can you require from someone who never shows up Ask some fitness clubs…

If we don’t past behavior to unduly influence future returns

Page 26: How to Carpool Fairly

Uniqueness of FW Shares

Proof: • Concatenation implies: the fair share for ℓ days is just the sum

of the fair shares for each day considered individually• Full Coverage, Symmetry and Dummy imply that for a

schedule consisting of day Dj only the fair share must be 1/|Dj| for those in Dj and 0 for the rest.

Theorem: The FW Share is the unique one satisfying Full Coverage, Symmetry, Dummy and Concatenation.

Each one of the properties Full Coverage, Symmetry, Dummy and Concatenation is essential for uniqueness

Conclusion: If someone objects to the load defined by FW, then they should point out which axiom they disagree with

Page 27: How to Carpool Fairly

Game Theory and the Shapley Value Cooperative Game Theory: games where the outcome of the game is a coalition Coalitional games with transferable payoff defined by • set N of players• function v:2N R assigning every non-empty S µ N a real number v(S).

– v(S) is viewed as the total payoff to be partitioned among the members of S Interesting question:

Which coalition will be formed and what payoff each member should receive?

There are many solution concepts for such games,with different axiomatic characterizations of the payoff vector.

Shapley Value:The marginal contribution of i to S : i(S)=v(S [ {i}) - v(S)The Shapley value of i: i(v,N) = 1/|N|! P 2 P i(Si(P)) where– P is the set of all possible |N|! orderings of N – Si(P) is the set of players appearing before i in the order P.

View: expected contribution of i to its predecessors given a random order of the players.• Suggested by Lloyd Shapley in 1953 • Has been used as a power index (voting) and for cost allocation

Page 28: How to Carpool Fairly

Shapley Value and Carpooling

Given a schedule D D for the carpool problem define a coalitional game vDD :

• The set N of players is the set of [n] participants.

• The value vDD(S) of any subset S µ N is the number of days members of S showed up, i.e.

vDD(S) = |{1 · j · ℓ| Dj Å S }|

The marginal contribution of i to S i(S)=v(S [ {i}) - v(S)

The Shapley value of i: i(v,N) = 1/|N|! P 2 P i(Si(P))

Theorem: for each player i the Shapley value of the game is: i(vDD,N) ={1· j · ℓ | i 2 Dj}

1/|Dj|= FWi

EP 2 P [i(Si(P))] = {j|i2Dj} Pr[i is first to arrive]= {j|i 2 Dj} 1/|Dj|

Page 29: How to Carpool Fairly

Objections and Counterobjections• For a given payoff vector an objection of player i against

player j is an argument ``give me more or I will leave the game causing you to lose."

• A counterobjection is an argument ``It is true that if you leave then I will lose, but if I leave you

lose at least as much"

• The Shapley value is the unique value where every objection is balanced by a counterobjection

If we expect this sort of negotiation: the FW share is the reasonable expectation for a carpool to agree on

Page 30: How to Carpool Fairly

Further Research• Can you find a probabilistic online algorithm where the unfairness is

bounded by log n (and not log ℓ)– Lower bound is (log n)1/3)

• What about trust and global information– The random label algorithm needs a lot of trust– For global greedy need currency– The local greedy does not require trust, but

• best case is also the worst case• Requires memory n

• Fairness of queuing [Raz, Levy, Avi-Itzhak]– The fraction of the time a customer served is similar to those in the queue with

him. – Similar questions to what we have seen: offline vs. online…

Page 31: How to Carpool Fairly

References• R. Fagin and J. Williams, A fair carpool scheduling algorithm,

IBM Journal of Research and Development, 1983. • M. Ajtai et al, Fairness in Scheduling, J. Algorithms 29(2),

1998, www.wisdom.weizmann.ac.il/~naor/PAPERS/carpool_abs.html• M. Naor, On Fairness in the Carpool Problem,

www.wisdom.weizmann.ac.il/~naor/PAPERS/fair_abs.html• R. Tijdman, The Chairman Assignment Problem, Discrete

Math. 32 (1980) • Adam Kalai, personal communication• Osborne and Rubinstein, A Course in Game Theory, MIT

Press, 1994.