adolgert / CompetingClocks.jl

Simplest simulation to use non-Exponential transitions
MIT License
5 stars 0 forks source link

Feature/separate prefixsearch #28

Closed adolgert closed 10 months ago

adolgert commented 10 months ago

This takes the Direct sampler and pulls out its prefix-search algorithm, also known as a scan algorithm, which is responsible for maintaining the sum of hazards while the hazards themselves can be disabled or changed. This PR creates a new algorithm I call a Keyed Prefix Search, which is a prefix search with a dictionary-like interface. It turns out that's what we need, and it encapsulates different variants of prefix search. Those variants can, for instance, optimize for sampling just a few clocks, optimize for sampling a semi-infinite set of clocks, or optimize for clocks whose keys are from 1 to N, where N is fixed. The idea for users of this is to say what their code needs, and they will get the right implementation.