Skip to content

Optimize event sampling in simARG.R #175

Description

@WongDWai

Currently, waiting times are drawn independently for each possible event type. This is inefficient and does not implement the standard Gillespie direct method.

The event simulation should instead:

Compute the rate of every possible event.
Sum these into a single total rate.
Draw one waiting time: t ~ Exp(total_rate).
Select the next event with probability proportional to its rate: P(event i) = rate_i / total_rate.

This reduces the number of random draws per simulation step and aligns the implementation with the standard Gillespie algorithm.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions