What is a Calendar Queue?

前端 未结 3 1787
慢半拍i
慢半拍i 2021-02-05 21:25

I am working on a building a discrete event simulator. Wikipedia mentioned that there are several general purpose priority queues that are good for use in DES\'s. Specifically

相关标签:
3条回答
  • 2021-02-05 21:25

    A Google search finds

    Study of Optimised bucket widths in Calendar Queue for Discrete Event Simulator

    http://pioneer.netserv.chula.ac.th/~achaodit/paper5.pdf

    which describes Calendar Queues in section 2.

    0 讨论(0)
  • 2021-02-05 21:34

    Yes, Brown 1988 is the first paper I know of to describe calendar queues, though Brown mentions several authors who preceded him. Below is a relatively complete bibliography of the calendar queue literature along with my notes on each paper. Leave me a comment if you would like copies of any of the publications.

    • Vaucher 1975 Comparison of events list algorithms. Presents three new algorithms as well. Inspired Brown1988.
    • Henricksen 1977 Events list algorithm - adapts to interval times and performs well with a number of distributions, based on Vaucher and Duval
    • Ulrich 1978 Brown1988 claims this is O(1), except for the overflow list
    • Jones 1986 Compares priorities queues, has an early version of a calendar queue
    • Brown 1988 Introduces Calendar Queue [aka: Sorted-discipline Calendar Queue]
    • Davison 1989 Discovers the same, mentions some important improvements, Brown acknowledges the improvements in the same letter and has some thoughts of his own. Davison suggests that Jones 1986 has offered some valuable calendar mechanics
    • Ronngren 1991 The Lazy Queue. A calendar queue which has a near, far, and very far future - this enables delayed sorting, which speeds things up considerably in their testing
    • Steinman 1994 Event Horizon. Generated events have some probability distribution of when they occur, let's use this to determine what needs to be sorted. Allow for parallel simulation
    • Steinman 1996 Event Horizon Part 2. Applies Steinman1994 to event list management. Modifies other data structures for use in CQs.
    • Ronngren 1997 Comparison of many different calendar queues. Lazy Queue performs well, but Brown1988 frequently performs better. LazyQ and SCQ have bad worst-case performance, Skew Heap and Sply Tree have best worst-case.
    • Oh 1997 Dynamic Lazy Calendar Queue. Improve's conventional CQ's performance over uneven event distributions
    • Oh 1999 Dynamic Calendar Queue. Works well with uneven distributions
    • Cazzolla 1998 Java implementation of Lazy Queue with analysis (not an academic paper).
    • Tan 2000 SNOOPy: Statistically enhanced with optimum operating parameter CQ. Uses statistical tests to make a ebtter bucket. Operates up to 100x faster than DCQ and CQ in certain scenarios
    • Hui Thesis Bachelor's thesis describing many more details of the Hui 2002 paper along with pros and cons of other calendar queue implementations
    • Hui 2002 Future events don't need to be sorted right now; consequently, the priority queue proper's size can be limited, reducing resize overhead.
    • Goh 2003 MList. Multi-tier linked-lists eliminate resize operations. Shown experimentally to be at least 100% faster than Calendar Queue, Dynamic CQ, SNOOPy CQ, 2-tier Dynamic Lazy CQ, and 3-tier Lazy Queue
    • Siangsukone 2003 Optimised bucket widths in CQ. Demonstrates that bucket width can have significant effects on performance.
    • Goh 2004 DSplay. Eliminate costly resize operations. At least 100% faster than other calendar queues.
    • Tang 2005 Ladder Queue. Provides stable O(1) performance even under queue distributions with infinite variance. Similar to Lazy Queue, but better.
    • Yan 2006 Sluggish calendar queue. When events are mostly inserted in order, it is possible to use some statistical properties to acheive a 2-order speed-up
    • Himmelspach 2007 Events have durations - outside the main line of research. Extra functionality was needed, this algorithm provides it but may have limited follow-up work.

    Also, we've recently finished describing a variant of Brown's algorithm which should perform better. The description is, I think quite adequate to build an implementation from and sample code is provided in the paper. The publication is entitled Trading Space for Time: Constant-Speed Algorithms for Managing Future Events in Scientific Simulations by Lehman, Keene, and Barnes and should be indexed sometime this fall. If you'd like a copy, leave a comment and I will send it to you.

    To answer a different part of your question, you can think of a calendar queue as being a priority queue which is optimized for events which will have ever-decreasing priorities. Usually the priorities (times) of the events are binned in some way so as to avoid having to touch all the events in order to insert one (as may happen in certain forms of heap management).

    0 讨论(0)
  • 2021-02-05 21:36

    Definition by NIST:

    A fast priority queue implementation having N buckets each with width w, or covering w time. An item with priority p more than current goes in bucket (p/w)%N. Choose N and w to have few items in each bucket. Keep items sorted within buckets. Double or halve N and change w if the number of items grows or shrinks a lot.

    Paul E. Black, "calendar queue", in Dictionary of Algorithms and Data Structures [online], Vreda Pieterse and Paul E. Black, eds. 24 January 2005. (accessed 2014-03-10) Available from: http://www.nist.gov/dads/HTML/calendarQueue.html

    0 讨论(0)
提交回复
热议问题