Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schedulefeature #23

Merged
merged 11 commits into from Oct 12, 2018
Merged

Schedulefeature #23

merged 11 commits into from Oct 12, 2018

Conversation

auroraschmidt
Copy link
Contributor

This is an addition that allows for PoissonScheduling (note that times in the poisson schedule are still rounded to integers). It is used in the simple_contagion model in the Tsunami repo

@coveralls
Copy link

coveralls commented Oct 8, 2018

Coverage Status

Coverage increased (+1.8%) to 90.52% when pulling dc96b67 on schedulefeature into 7145a42 on master.

if integer_increment > 0:
t = t + integer_increment
if t < tN:
times.append((i, t))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why we are calling this a Poisson process. Isn't this a Bernoulli process now? And wouldn't it be more efficient to implement it that way with a geometric distribution (for small lambda, this throws away 10-40% of the samples)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A Poisson process has exponential inter-arrival times. We are sampling inter-activity times with the exponential distribution, so that's why we are calling it Poisson.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But these aren't exponential wait times. They are geometric wait times where
image

Here's a sample plot at lambda=5 and p=e^-y (discretized exponential and geometric):

image

@cash
Copy link
Contributor

cash commented Oct 11, 2018

@auroraschmidt I've added two implementations of a Bernoulli scheduler. They both give the same arrival time distribution as the original PoissonScheduler implementation. BernoulliScheduler is slower than the original implementation but handles indefinite simulations. The FastBernoulliScheduler works in the same manner as PoissonScheduler by pre-generating the schedule.

Do you have strong opinions on whether the stop time for the scheduler should be inclusive or exclusive? Right now if you configure with a start time of 0 and stop time of 5, you get 4 time steps of 1, 2, 3, 4. I'd lean toward inclusive.

@cash cash merged commit e702a6c into master Oct 12, 2018
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.

None yet

3 participants