exact analysis of exact change yair frankel, certco boaz patt-shamir, northeastern university...

14
Exact Analysis of Exact Analysis of Exact Change Exact Change Yair Frankel, CertCo Yair Frankel, CertCo Boaz Patt-Shamir, Northeastern Boaz Patt-Shamir, Northeastern University University Yiannis Tsiounis, Northeastern Yiannis Tsiounis, Northeastern University/GTE University/GTE

Upload: gladys-anthony

Post on 17-Dec-2015

215 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Exact Analysis of Exact Change Yair Frankel, CertCo Boaz Patt-Shamir, Northeastern University Yiannis Tsiounis, Northeastern University/GTE

Exact Analysis of Exact Exact Analysis of Exact ChangeChange

Yair Frankel, CertCoYair Frankel, CertCo

Boaz Patt-Shamir, Northeastern UniversityBoaz Patt-Shamir, Northeastern University

Yiannis Tsiounis, Northeastern University/GTEYiannis Tsiounis, Northeastern University/GTE

Page 2: Exact Analysis of Exact Change Yair Frankel, CertCo Boaz Patt-Shamir, Northeastern University Yiannis Tsiounis, Northeastern University/GTE

At the bank...At the bank...

YOU: I would like to withdraw YOU: I would like to withdraw NN shekels…shekels…

THE TELLER: How would you like to THE TELLER: How would you like to have it?have it?

YOU: hmm… I need to make a few YOU: hmm… I need to make a few exact paymentsexact payments......

Northeastern University/ GTE Laboratories

Page 3: Exact Analysis of Exact Change Yair Frankel, CertCo Boaz Patt-Shamir, Northeastern University Yiannis Tsiounis, Northeastern University/GTE

Northeastern University/ GTE Laboratories

Easy casesEasy cases

No restrictions: up No restrictions: up toto NN payments payments (the (the N-N-payment payment problem)problem)

A single payment A single payment of any value of any value P P N N (the (the 11--payment payment problem) problem)

NN 1-coins are 1-coins are necessary and necessary and sufficientsufficient

For For N N = 2= 2mm--11: : allocate coins allocate coins 1, 2, 4, 8,..., 21, 2, 4, 8,..., 2m-m-11

pay by the binary pay by the binary representation of representation of PP

Page 4: Exact Analysis of Exact Change Yair Frankel, CertCo Boaz Patt-Shamir, Northeastern University Yiannis Tsiounis, Northeastern University/GTE

Withdraw budget Withdraw budget NN

to enable to enable kk arbitraryarbitrary payments payments

with minimal number of coinswith minimal number of coins

We need algorithms for:We need algorithms for: Coin allocationCoin allocation Coin dispensingCoin dispensing

Northeastern University/ GTE Laboratories

The The kk-payment problem-payment problem

Page 5: Exact Analysis of Exact Change Yair Frankel, CertCo Boaz Patt-Shamir, Northeastern University Yiannis Tsiounis, Northeastern University/GTE

Northeastern University/ GTE Laboratories

ApplicationsApplications Physical cashPhysical cash

– Minimize coins in physical withdrawalsMinimize coins in physical withdrawals– ““Exact change” ATM machinesExact change” ATM machines

Electronic cash: smart cards have Electronic cash: smart cards have limited storage, electronic coins are limited storage, electronic coins are long sequences...long sequences...– Construct e-cash systems allowing exact Construct e-cash systems allowing exact

paymentspayments

Other resource sharing scenariosOther resource sharing scenarios

Page 6: Exact Analysis of Exact Change Yair Frankel, CertCo Boaz Patt-Shamir, Northeastern University Yiannis Tsiounis, Northeastern University/GTE

Northeastern University/ GTE Laboratories

A simple solutionA simple solution ReplicateReplicate the the 11-payment solution-payment solution k k

times :times :– Split budget into Split budget into kk portions of size portions of size N/kN/k and and

solve for solve for 11-payment for each portion-payment for each portion

– Requires about Requires about kkloglog22((N/kN/k)) coins coins

However...However... How about payments larger than How about payments larger than N/kN/k?? What if What if N/kN/k is not of the form is not of the form 22mm-1-1?? Is this the best solution?Is this the best solution?

Page 7: Exact Analysis of Exact Change Yair Frankel, CertCo Boaz Patt-Shamir, Northeastern University Yiannis Tsiounis, Northeastern University/GTE

Northeastern University/ GTE Laboratories

Our resultsOur results

Main result: The optimal solution Main result: The optimal solution has about has about kkln(ln(N/kN/k)) coins for coins for anyany N, k

Result extends to any set of Result extends to any set of allowed denominationsallowed denominations (With (With greedygreedy dispensing, the “binary” dispensing, the “binary”

solution works for payments solution works for payments N/k)

Page 8: Exact Analysis of Exact Change Yair Frankel, CertCo Boaz Patt-Shamir, Northeastern University Yiannis Tsiounis, Northeastern University/GTE

Northeastern University/ GTE Laboratories

This talk...This talk... Some intuition for the lower boundSome intuition for the lower bound Description of the coin allocation Description of the coin allocation

algorithmalgorithm Idea for restricted denominationsIdea for restricted denominations

Page 9: Exact Analysis of Exact Change Yair Frankel, CertCo Boaz Patt-Shamir, Northeastern University Yiannis Tsiounis, Northeastern University/GTE

Northeastern University/ GTE Laboratories

The lower boundThe lower bound Idea: the difficult cases are those Idea: the difficult cases are those

where payments are equalwhere payments are equal For For kk payments of payments of 11: need : need kk 1-coins 1-coins ForFor k k payments of payments of 22: need additional : need additional

kk/2/2 2-coins... 2-coins... In general: need In general: need k/ik/i coins of value coins of value ii, ,

therefore total #coins is at least therefore total #coins is at least

k·(1++ + +k/N) = k·HN/k k · ln(N/k)

Page 10: Exact Analysis of Exact Change Yair Frankel, CertCo Boaz Patt-Shamir, Northeastern University Yiannis Tsiounis, Northeastern University/GTE

Northeastern University/ GTE Laboratories

The characterization Theorem

A set of coins solves the k-payment problem if and only if for all i N/k, the sum of coins of denomination i or less is at least ik.

Page 11: Exact Analysis of Exact Change Yair Frankel, CertCo Boaz Patt-Shamir, Northeastern University Yiannis Tsiounis, Northeastern University/GTE

Northeastern University/ GTE Laboratories

The allocation algorithmThe allocation algorithm

Starting from denomination 1, Starting from denomination 1, add the minimal number of add the minimal number of coins so that the sum coins so that the sum allocated with coins of allocated with coins of denominations denominations ii is at least is at least kki.i.

k

k2 k

3 k4 N

k

Page 12: Exact Analysis of Exact Change Yair Frankel, CertCo Boaz Patt-Shamir, Northeastern University Yiannis Tsiounis, Northeastern University/GTE

Northeastern University/ GTE Laboratories

Exact analysisExact analysis

Optimality:Optimality: There is no way to allocate There is no way to allocate less coins for any less coins for any N, kN, k..

Upper bound:Upper bound: The number of coins The number of coins allocated by the algorithm is never allocated by the algorithm is never more thanmore than

((kk+1)+1)HH N/N/((kk+1)+1) ((kk+1)+1) ln( ln(N/N/((kk+1))+1))(reduction, anyone?)

Page 13: Exact Analysis of Exact Change Yair Frankel, CertCo Boaz Patt-Shamir, Northeastern University Yiannis Tsiounis, Northeastern University/GTE

Northeastern University/ GTE Laboratories

Restricted denominations: Restricted denominations: the problem the problem

Not all denominations are availableNot all denominations are available Related problems:Related problems:

– Change making: dispense a single Change making: dispense a single payment with least number of coinspayment with least number of coins

– postage stamp problempostage stamp problem

Page 14: Exact Analysis of Exact Change Yair Frankel, CertCo Boaz Patt-Shamir, Northeastern University Yiannis Tsiounis, Northeastern University/GTE

Restricted denominations: Restricted denominations: the solutionthe solution

Same basic idea: Same basic idea: – Allocate coins while preserving the Allocate coins while preserving the

invariantinvariant– Use change making algorithm to allocate Use change making algorithm to allocate

the remainder (dynamic programming the remainder (dynamic programming always works) always works)

Proof is more involvedProof is more involved No specific bounds on the number of No specific bounds on the number of

coinscoinsNortheastern University/ GTE

Laboratories