220 likes | 338 Views
Sorting Buffers on HSTs. Harald Räcke Matthias Englert Matthias Westermann. X. Problem Definition . Input sequence:. Metric space : . Output sequence:. Applications.
E N D
Sorting Buffers on HSTs Harald Räcke Matthias Englert Matthias Westermann
X Problem Definition Input sequence: Metric space : Output sequence:
Applications • Sorting Buffers are used e.g. in car manufacturing for sorting cars according to their color before they are painted. • reducing state changes in a rendering system. uniform metric: star metric: • minimizing head movements in a hard-disc line metric with equidistant points:
2 2 ( ( ( ) ) ) l l l k k O O O o o o g g g n Previous Work • [R, Sohler, Westermann] ESA 2002 uniform metric; competitive ratio • [Englert, Westermann] ICALP 2005 star metric; competitive ratio • [Khandekar, Pandit] STACS 2005 line metric; competitive ratio
2 2 2 = ( ( ( ( ) ) ) ) l i h h l l l l k k l l k k O O O O D 1 1 + > ¢ ¢ ¢ c c o o o g g g n o g o g o g i Our Results • competitive ratio for HSTs of height • HST: all edges on the same level have the same length. • The edges on the level have length for a constant . • also competitive ratio for HSTs • General Metrics: ratios and .
k 1 ¡ a b items here Why some natural strategies fail • points/items are kept in the buffer for too long. This shrinks the effective buffer-size: Nearest Item Next: • Starting situation: • sequence: b a b a b a b a b a b a b a b a ...
x a b Why some natural strategies fail • points/items are removed too early. Therefore clusters of points cannot be removed in one huge chunk. FIFO: • Starting situation: • sequence: x aaaa bbbbx aaaa bbbbx aaaa bbbbx aaaa bbbb ...
d t t v The Algorithm for HSTs The algorithm is defined by the following continuous process. • Every item in the buffer sends out an agent • In time step an agent places payment on the first yet unpaid edge in direction towards the current ONLINE-position. • When a group of agents arrives at the ONLINE-position, the corresponding items are removed from the buffer and theirpayment is removed from the edges. • ONLINE moves to the furthest among the just removed items.
The Algorithm for HSTs This front gets the third item; now it moves three times faster This front also gets two items. Now two items are working on this front. This increases speed.
Analysis Observation • The total paymentis equal to the ONLINE-cost. Idea: • fix an optimal algorithm OPT • analyze the payment that is created on an edge between two visits of OPT to this edge
= = d d d h h 4 4 t t t v v v Analysis Introduce discounts: • Whenever an ONLINE-item creates a unit of payment, an OPT-item creates a discount of on every ancestor edge. • An ONLINE-item creates a discount of on every ancestor edge, as well. • The total discount that is produced is only half the totalpayment. Idea: • analyze the „real payment“ created on an edge (payment-discount) between two consecutive visits of OPT to the edge.
· ¢ Analysis Amortization: move payment between edges, such that (in the end) for every edgeaccepted_payment(e) f OPT(e) • don‘t delete payment The amortization is done with respect to the actions of the ONLINE, and OPTIMAL algorithm.
Amortization every edge is assigned the following counters: • active_payment(e) this counter describes the payment on an edge asdefined by the ONLINE-algorithm. • amortized_payment(e) this counter acts as a buffer. When e.g. the active paymenton an edge is set to 0, this counter may be increased. • accepted_payment(e)in the end all other counters should be 0; and this countershould be comparable to OPT(e). • discount(e)counts the discounts collected so far
Amortization • when ONLINE goes over an edge, active_payment(e) is set to 0. • for adjustment we do one of the following • self-amortizationwe increase the counter amortized_payment(e) byactive_payment(e). We set discount(e) to 0. • amortization we increase the amortized-counter on some other edge by active_payment(e) +amortized_payment(e).We set all counters at e to 0. • accept payment on ehere we increase the counter accepted_payment(e) byactive_payment(e) +amortized_payment(e)- discount(e).We set all counters at e to 0.
accepted_payment(e) f OPT(e) ( ( ) ( ) ) · · · ` ` O ¢ e e Amortization Facts: • active_payment(e) clear • amortized_payment(e) to prove Rules: • if OPTIMAL traverses an edge accept payment on this edge • inequality still holds!
clearly, you only accept payment times before OPT has to visit the sub-tree. • Each accept increases accepted_payment(e) by • OPT visiting the sub-tree increases OPT(e) by 1 1 ( ( ( ( ( ) ( ) ) ) ) ) ` h ` l k O T T T O T T 1 1 ¡ + ¢ c e e o g c c c c c ( ( ) ) h h O O Amortization ONLINE only accepts payment on an edge if • ONLINE is moving downward • the sub-tree does not contain OPT, i.e. ONLINE moves away from OPT. • active(e)+amortized(e)-disount(e) <= 0 • OPT-exclusive( ) items are those items in that are held by OPT but not by ONLINE. • ONLINE-exclusive( ) items are those held by ONLINE but not by OPT. Only accept payment if either the number of OPT-exclusive items increases by a -factor; or if the number of ONLINE-exclusive items shrink by a -factor. and either or
Amortization • We have to show that in all other cases we can amortize withoutamortized_payment getting too large. Remaining cases (Overview): • away from OPT / upwards: amortize to another edge (move the payment to another downward-edge) • away from OPT / downwards when the exclusive items do not change too much. • towards OPT: make a self-amortization (ignore the payment and move it to your own buffer) More to come not possible OK
( ) ¤ ¤ ¤ ¤ ` 2 e e e e e e e e Amortization Away from OPT / upwards • move the payment to the buddy edge that you visit next on the same level (sideways amortization) • how much payment does an edge receive because of side- ways amortization? • cannot receive any payments due to sideways-amortization. • therefore shifts at most to • receives at most from one edge before ONLINE visits and removes the payment.
1 l l l l l t t t t ( ( ) ( ) = ( ) = ) ¸ · · ¸ f b f b f h b f h o e o o o x n p p p c e e x x c c e x c e x c o p 1 0 2 0 + + t ¢ n n n n n n n n n n n n a e r e o r e e o r e e o r e = ) r r r e e e m m m t t t t 2 r o r r r e e e e p m m m m o p o p o p r e m Amortization Away from OPT / downwards • items you remove: • assume: These are the only items that generated paymenton e since the last visit. All these items generateddiscounts since the lastvisit.
1 l l l l l l l l t ( ( ( ) ) ) = = ( ) · · ¸ · f b b f f h h b f o o e o o o x p n n n n c e e e e e e x x x x x x c c c c c c e x c 1 2 0 0 + ¡ t ¢ n n n n n n n n n n n n a e r e e o o r r e e e o r e ) = l l l l r r r e e e m m m 2 r r o r r r e e e e e n m m m m m o o n n o n Amortization Away from OPT / downwards • items you remove: • assume: These are the only items that generated paymenton e since the last visit. All these items generateddiscounts since the lastvisit.
2 ( ( ( ) ( ) ) ) l l d i k k l k O O O T ¢ o o g g a m o g Extension to • So far we didn’t use the HST-property. The analysis can be adapted to general trees giving a competitive ratio of Which of the ancestor edges need the discount? • edges, such that ONLINE is in the sub-tree don’t need the discount. • only create discount on edges that are at most edges away from the LCA of ONLINE and the item. • additionally let discount grow from the position of the item Edges that are close obtain discount by region growing
( ( ) ) k l l k O p o y o g Open Problems • Is it possible to reduce the competitive ratio toon the line / in arbitrary trees. • Can you remove the dependency on for arbitrarymetrics? • Is there a constant competitive ratio?