An implementation of the Gillespie algorithm in Rust.
a discrete, stochastic process instead of a continuous, deterministic process[a]
cargo build
cargo run
use gillrocky::{Reactor, Process};
struct State { ... }
struct Reaction { ... }
impl Process<State> for Reaction {
fn rate(&self, state: &State) -> f64 { ... }
fn perform(&mut self, state: &mut State) { ... }
}
let mut reactor = Reactor::new(seed);
reactor.add(Reaction { ... });
reactor.add(Reaction { ... });
let state = State { ... };
loop {
reactor.step(&mut state);
// output: reactor.time, state.*, etc
}
This project is licensed under the terms of the MIT license.
Icon derived from work by Selman Design.