Transcript
Page 1: Evaluation of Algorithms for the List Update Problem

Evaluation of Algorithms Evaluation of Algorithms for the List Update for the List Update

Problem Problem

Suporn PongnumkulR. Ravi

Kedar Dhamdhere

Page 2: Evaluation of Algorithms for the List Update Problem

OverviewOverview

• List Update Problem• Competitive Analysis• Average Case Analysis• Our Hybrid Model• Setup of our experiment• Results from our experiment• Conjecture

Page 3: Evaluation of Algorithms for the List Update Problem

List Update ProblemList Update Problem• Self-organizing sequential search

• Unsorted list

• Received a sequence of requests

• Cost of accessing the ith element of the list is i.

y w z x v uL:

Page 4: Evaluation of Algorithms for the List Update Problem

y w z x v uL:

List Update ExampleList Update Example

Action Cost Total Cost

Page 5: Evaluation of Algorithms for the List Update Problem

y w z x v uL:

List Update ExampleList Update Example

Action Cost Total Cost

Access x

Page 6: Evaluation of Algorithms for the List Update Problem

y w z x v uL:

List Update ExampleList Update Example

Action Cost Total Cost

Access x 4 4

Page 7: Evaluation of Algorithms for the List Update Problem

y w z x v uL:

List Update ExampleList Update Example

Action Cost Total Cost

Access x 4 4

Access v

Page 8: Evaluation of Algorithms for the List Update Problem

y w z x v uL:

List Update ExampleList Update Example

Action Cost Total Cost

Access x 4 4

Access v 5 9

Page 9: Evaluation of Algorithms for the List Update Problem

y w z x v uL:

List Update ExampleList Update Example

Action Cost Total Cost

Access x 4 4

Access v 5 9

Move v forward to before w

Page 10: Evaluation of Algorithms for the List Update Problem

y v w z x uL:

List Update ExampleList Update Example

Action Cost Total Cost

Access x 4 4

Access v 5 9

Move v forward to before w 0 9

Page 11: Evaluation of Algorithms for the List Update Problem

y v w z x uL:

List Update ExampleList Update Example

Action Cost Total Cost

Access x 4 4

Access v 5 9

Move v forward to before w 0 9

Access y

Page 12: Evaluation of Algorithms for the List Update Problem

y v w z x uL:

List Update ExampleList Update Example

Action Cost Total Cost

Access x 4 4

Access v 5 9

Move v forward to before w 0 9

Access y 1 10

Page 13: Evaluation of Algorithms for the List Update Problem

y v w z x uL:

List Update ExampleList Update Example

Action Cost Total Cost

Access x 4 4

Access v 5 9

Move v forward to before w 0 9

Access y 1 10

Access v

Page 14: Evaluation of Algorithms for the List Update Problem

y v w z x uL:

List Update ExampleList Update Example

Action Cost Total Cost

Access x 4 4

Access v 5 9

Move v forward to before w 0 9

Access y 1 10

Access v 2 12

Page 15: Evaluation of Algorithms for the List Update Problem

y v z w x uL:

List Update ExampleList Update Example

Action Cost Total Cost

Access x 4 4

Access v 5 9

Move v forward to before w 0 9

Access y 1 10

Access v 2 12

Transpose w and z

Page 16: Evaluation of Algorithms for the List Update Problem

y v w z x uL:

List Update ExampleList Update Example

Action Cost Total Cost

Access x 4 4

Access v 5 9

Move v forward to before w 0 9

Access y 1 10

Access v 2 12

Transpose w and z 1 13

Page 17: Evaluation of Algorithms for the List Update Problem

Competitive AnalysisCompetitive Analysis

• Definition: An analysis in which the performance of an online algorithm is compared to the best that could have been achieved if all the inputs had been known in advance.

Page 18: Evaluation of Algorithms for the List Update Problem

Competitive RatioCompetitive Ratio

A:Our online algorithm

CA()

OPT:Optimal Offline

algorithm

COPT()

A is c-competitive if aCA() ≤ c COPT() + a

for all request sequences

Page 19: Evaluation of Algorithms for the List Update Problem

Move-to-Front (MTF)Move-to-Front (MTF)

• When an element is accessed, move it to the front of the list.

• Theorem: [Sleator, Tarjan, 1985] MTF has competitive ratio 2 against optimal offline algorithm.

Page 20: Evaluation of Algorithms for the List Update Problem

Average Case AnalysisAverage Case Analysis• Assume each request comes from a

fixed probability distribution, independent of previous requests. Suppose the ith item has probability pi. Design algorithms to minimize the expected cost.

• Optimal strategy is to keep the list sorted in non-increasing order of pi.

Page 21: Evaluation of Algorithms for the List Update Problem

STAT = Static ListSTAT = Static List• List is sorted in non-increasing order

of the probabilities

• Never moves anything

• Good for when we have a good estimate of the probability distribution.

Page 22: Evaluation of Algorithms for the List Update Problem

Need a new model?Need a new model?• Most real-world settings don't behave

either like a discrete distribution, or like a worst-case one.

• Can we design an algorithm that does well in both typical and worst-case?

• How could we analyze such algorithms?

Page 23: Evaluation of Algorithms for the List Update Problem

Hybrid ModelHybrid Model• Assume a fixed probability distribution,

• For each request, with probability , let the adversary change the request.

• Average Case Analysis

• Competitive Analysis

• Known probability distribution with uncertainty.

),...,,( 21 npppp

01

10

Page 24: Evaluation of Algorithms for the List Update Problem

Hybrid Algorithm?Hybrid Algorithm?• Parameterized by

• Matches best average case performance when is low, and matches best competitive ratio when is high.

Page 25: Evaluation of Algorithms for the List Update Problem

Move-From-Back-EpsilonMove-From-Back-Epsilon• List initially sorted in non-increasing

order of probabilities.

• When an element x is accessed, promote it past others that have probability up to px + .

Page 26: Evaluation of Algorithms for the List Update Problem

y w z x v uL:

MFBE Example (MFBE Example ( = 0.2) = 0.2)

Request Cost Total Cost

v y z yProb py = 0.5 pw = 0.2 pz = 0.15 px = 0.1 pv = 0.03 pu = 0.02

Page 27: Evaluation of Algorithms for the List Update Problem

y w z x v uL:

MFBE Example (MFBE Example ( = 0.2) = 0.2)

Request Cost Total Cost

x v y vProb py = 0.5 pw = 0.2 pz = 0.15 px = 0.1 pv = 0.03 pu = 0.02

Page 28: Evaluation of Algorithms for the List Update Problem

y w z x v uL:

MFBE Example (MFBE Example ( = 0.2) = 0.2)

Request Cost Total Cost

Access x (and move to before w)

x v y vProb py = 0.5 pw = 0.2 pz = 0.15 px = 0.1 pv = 0.03 pu = 0.02

Page 29: Evaluation of Algorithms for the List Update Problem

y x w z v uL:

MFBE Example (MFBE Example ( = 0.2) = 0.2)

Request Cost Total Cost

Access x (and move to before w) 4 4

x v y vProb py = 0.5 px = 0.1 pw = 0.2 pz = 0.15 pv = 0.03 pu = 0.02

Page 30: Evaluation of Algorithms for the List Update Problem

y x w z v uL:

MFBE Example (MFBE Example ( = 0.2) = 0.2)

Request Cost Total Cost

Access x (and move to before w) 4 4

x v y vProb py = 0.5 px = 0.1 pw = 0.2 pz = 0.15 pv = 0.03 pu = 0.02

Page 31: Evaluation of Algorithms for the List Update Problem

y x w z v uL:

MFBE Example (MFBE Example ( = 0.2) = 0.2)

Request Cost Total Cost

Access x (and move to before w) 4 4

Access v (and move to before x)

x v y vProb py = 0.5 px = 0.1 pw = 0.2 pz = 0.15 pv = 0.03 pu = 0.02

Page 32: Evaluation of Algorithms for the List Update Problem

y v x w z uL:

MFBE Example (MFBE Example ( = 0.2) = 0.2)

Request Cost Total Cost

Access x (and move to before w) 4 4

Access v (and move to before x) 5 9

x v y vProb py = 0.5 pv = 0.03 px = 0.1 pw = 0.2 pz = 0.15 pu = 0.02

Page 33: Evaluation of Algorithms for the List Update Problem

y v x w z uL:

MFBE Example (MFBE Example ( = 0.2) = 0.2)

Request Cost Total Cost

Access x (and move to before w) 4 4

Access v (and move to before x) 5 9

x v y vProb py = 0.5 pv = 0.03 px = 0.1 pw = 0.2 pz = 0.15 pu = 0.02

Page 34: Evaluation of Algorithms for the List Update Problem

y v x w z uL:

MFBE Example (MFBE Example ( = 0.2) = 0.2)

Request Cost Total Cost

Access x (and move to before w) 4 4

Access v (and move to before x) 5 9

Access y

x v y vProb py = 0.5 pv = 0.03 px = 0.1 pw = 0.2 pz = 0.15 pu = 0.02

Page 35: Evaluation of Algorithms for the List Update Problem

y v x w z uL:

MFBE Example (MFBE Example ( = 0.2) = 0.2)

Request Cost Total Cost

Access x (and move to before w) 4 4

Access v (and move to before x) 5 9

Access y 1 10

x v y vProb py = 0.5 pv = 0.03 px = 0.1 pw = 0.2 pz = 0.15 pu = 0.02

Page 36: Evaluation of Algorithms for the List Update Problem

y v x w z uL:

MFBE Example (MFBE Example ( = 0.2) = 0.2)

Request Cost Total Cost

Access x (and move to before w) 4 4

Access v (and move to before x) 5 9

Access y 1 10

x v y vProb py = 0.5 pv = 0.03 px = 0.1 pw = 0.2 pz = 0.15 pu = 0.02

Page 37: Evaluation of Algorithms for the List Update Problem

y v x w z uL:

MFBE Example (MFBE Example ( = 0.2) = 0.2)

Request Cost Total Cost

Access x (and move to before w) 4 4

Access v (and move to before x) 5 9

Access y 1 10

Access v

x v y vProb py = 0.5 pv = 0.03 px = 0.1 pw = 0.2 pz = 0.15 pu = 0.02

Page 38: Evaluation of Algorithms for the List Update Problem

y v x w z uL:

MFBE Example (MFBE Example ( = 0.2) = 0.2)

Request Cost Total Cost

Access x (and move to before w) 4 4

Access v (and move to before x) 5 9

Access y 1 10

Access v 2 12

x v y vProb py = 0.5 pv = 0.03 px = 0.1 pw = 0.2 pz = 0.15 pu = 0.02

Page 39: Evaluation of Algorithms for the List Update Problem

Difficulties in ProofsDifficulties in Proofs

• It’s not easy to understand the behavior of OPT.– OPT can be computed by Dynamic

programming • Trivial way = O((n!)2m)• Improvement = O((2n)(n!)m)

[Reingold, Westbrook, 1996]

Page 40: Evaluation of Algorithms for the List Update Problem

Our ExperimentOur Experiment• Motivation: To see the behavior of

algorithms in our hybrid model.

• Measurement: We measure the performance of an online algorithm by the average competitive ratio.

Page 41: Evaluation of Algorithms for the List Update Problem

Our ExperimentOur Experiment• Variables in our experiment

– Type of List Update Algorithm (MTF, STAT, MFBE)

– Type of Probability Distribution– Type of Adversary

– Epsilon:

Page 42: Evaluation of Algorithms for the List Update Problem

Our ExperimentOur Experiment• We generate a request sequence of

length 100, with a chosen probability distribution.

• Then, with probability let the adversary change the request sequence.

Page 43: Evaluation of Algorithms for the List Update Problem

Our ExperimentOur Experiment• Record the cost incurred by the online

algorithm = CostA()

• Use Dynamic Programming to find optimum cost of that request sequence = CostOPT().

• Competitive Ratio = CostA()/CostOPT()

• Repeat this 100 times to find the average competitive ratio.

Page 44: Evaluation of Algorithms for the List Update Problem

DistributionDistribution• Geometric Distribution:

– P[i] / 1/2i

• Uniform Distribution:– P[i] = 1/n, n = length of the list

• Zipfian Distribution (Zipf(2)):– P[i] / 1/i2

Page 45: Evaluation of Algorithms for the List Update Problem

Cruel AdversaryCruel Adversary

• This is an adaptive adversary

• Looks at the current list and request for the last item in the list.

y w z x v uL:

Page 46: Evaluation of Algorithms for the List Update Problem

Cruel Adversary, Geometric Cruel Adversary, Geometric Distribution, n=6Distribution, n=6

Average Competitive Ratio

1

1.5

2

2.5

3

3.5

4

4.5

5

5.5

6

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

Epsilon

Ave

rage

Com

petit

ive

Rat

io

STAT

MFBE

MTF

Page 47: Evaluation of Algorithms for the List Update Problem

Cruel Adversary, Geometric Cruel Adversary, Geometric Distribution, n=6Distribution, n=6

Average Competitive Ratio

1

1.1

1.2

1.3

1.4

1.5

1.6

1.7

1.8

1.9

2

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

Epsilon

Ave

rage

Com

petit

ive

Rat

io

STAT

MFBE

MTF

Page 48: Evaluation of Algorithms for the List Update Problem

Reversed Geometric Reversed Geometric AdversaryAdversary

• This adversary chooses elements randomly, according to the geometric distribution on the reversed STAT order.

• This adversary requests small probability items more frequently.

• Oblivious Adversary = doesn’t look at the current list

Page 49: Evaluation of Algorithms for the List Update Problem

Reversed Geometric Adversary, Reversed Geometric Adversary, Geometric Distribution, n=6Geometric Distribution, n=6

Average Competitive Ratio

1

1.1

1.2

1.3

1.4

1.5

1.6

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

Epsilon

Ave

rage

Com

petit

ive

Rat

io

STAT

MFBE

MTF

Page 50: Evaluation of Algorithms for the List Update Problem

Uniform AdversaryUniform Adversary• This adversary requests elements

from the list uniformly at random.

• Oblivious Adversary

• With this adversary, the sorted order of elements in the combined probability distribution doesn’t change.

Page 51: Evaluation of Algorithms for the List Update Problem

Uniform Adversary, Zipfian2 Uniform Adversary, Zipfian2 Distribution, n=6Distribution, n=6

Average Competitive Ratio

1

1.05

1.1

1.15

1.2

1.25

1.3

1.35

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

Epsilon

Ave

rage

Com

petit

ive

Rat

io

STAT

MFBE

MTF

Page 52: Evaluation of Algorithms for the List Update Problem

ObservationObservation

• The performance of any algorithm in this hybrid model depends heavily on the type of adversary.

• Yet MFBE seems better than the worse of STAT and MTF.

Page 53: Evaluation of Algorithms for the List Update Problem

ConjectureConjecture

• The average competitive ratio of MFBE is dominated by the maximum of the average competitive ratios of STAT and MTF.

Page 54: Evaluation of Algorithms for the List Update Problem

ConjectureConjecture• Request sequence is generated by p• Adversarial settings:

• = k/m• 8 adversarial settings,

Ep(Cost(MFB)) · max Ep (Cost(MTF))

Ep (Cost(STAT))

)(),1(),....,5(),4(),3(),2(),1(: mm )(),....,3(),2(),1( k

{

Page 55: Evaluation of Algorithms for the List Update Problem

Questions?Questions?

Page 56: Evaluation of Algorithms for the List Update Problem

Thank youThank you !!! !!!


Recommended