Skip to content

New Distribution: dynamic_discrete_distribution#155

Open
bookworm6 wants to merge 1 commit into
boostorg:developfrom
WhitmanOptiLab:develop
Open

New Distribution: dynamic_discrete_distribution#155
bookworm6 wants to merge 1 commit into
boostorg:developfrom
WhitmanOptiLab:develop

Conversation

@bookworm6

Copy link
Copy Markdown

Overview

dynamic_discrete_distribution is a dynamic_distribution with updatable weights. Selection and update have been highly optimized.

Motivation

Though it has many possible applications, this implementation is designed for discrete event simulation applications. In these applications, there is a set of events with different probabilities of occurring, and the simulation must choose an event to occur and update probabilities of other events accordingly. These simulations often involve many more updates than selections, but exact ratios of update to selection differ depending on the application. This implementation provides efficient update and selection in which the underlying tree data structure can be tuned at compile time to prioritize update over selection to varying degrees.

Asymptotic Runtime of Update and Selection

In this library, we introduce a template parameter Fanout which controls the branching factor of the underlying complete tree data structure and can be adjusted to change the amount that update is prioritized over selection. It must be a positive integer power of 2 (enforced with a static assert at compile time). Our runtime is analyzed in terms of N (the number of elements in the distribution) and Fanout.

  • update_weight: $O(log_{\text{fanout}} N)$
  • selection (operator ()): $O( \text{fanout} \cdot (log_{\text{fanout}} N))$.

Justification for asymptotically logarithmic update and selection

We compared our implementation of dynamic weighted random selection against the asymptotically more efficient versions BUS and DPA.

  • We found that our library used memory more efficiently and more predictably, so it outperformed both BUS and DPA on larger number of weights as the size of the underlying data structures exceeded cache sizes.
  • On smaller numbers of weights, though BUS and DPA performed slightly better on selection, this library performed better on update with no restrictions on the size of the update. For use in scientific simulation, efficient update is more important than efficient selection.

dynamic_discrete_distribution is a dynamic_distribution with updatable weights. Selection and update have been highly optimized
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant