Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a Calendar Queue?

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, it mentions that a Calendar Queue is a good structure. I found one pdf (from 1988) that mentions Calendar Queues, but for the most part I can't find anything else out about them. Would someone mind explaining what Calendar Queue's are, how they're used, and where I might find a sample implementation?

like image 597
fbl Avatar asked May 14 '11 21:05

fbl


1 Answers

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).

like image 190
Richard Avatar answered Oct 02 '22 14:10

Richard