dwu0042 / mkmover

0 stars 0 forks source link

Design grammar/interface for rules #1

Closed dwu0042 closed 1 year ago

dwu0042 commented 1 year ago

As a modeller, I want to know how I should implement rules for my simulation model. As a developer, I need to have a way for the user to inform the simulation of how events should be scheduled and updated.

We are implementing a next-reaction style Gillespie algorithm. This requires the ability for the firing time of events to be updated. We know that the firing times of an individual change when their own state changes. There may also be higher-order effects. Thus we need a mapping from individuals to events.

In our implementation, the events are held in a sorted list. We have found that the order of this list/the sorting assumes its sort key is static. Thus we cannot do dynamic updates of the objects in that sorted list.

We can simplify the computations required if we assume that processes have inter-event times that are exponentially distributed (constant hazard between events), and then internally correct this via rejection.

dwu0042 commented 1 year ago

Done in the refactoring, where the Model is now a bare interface. The logic will be handled in a separate .py file, since the logic from sim to can be different.