Skip to content

feat: Implement explicit Tau-Leaping Simulator with Mockito unit tests - #111

Open
dyrpsf wants to merge 2 commits into
draeger-lab:masterfrom
dyrpsf:feature-tau-leaping
Open

feat: Implement explicit Tau-Leaping Simulator with Mockito unit tests#111
dyrpsf wants to merge 2 commits into
draeger-lab:masterfrom
dyrpsf:feature-tau-leaping

Conversation

@dyrpsf

@dyrpsf dyrpsf commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

Overview

This PR introduces the Explicit Tau-Leaping Algorithm to the FERN simulation engine.

While the Exact Gillespie algorithm is highly accurate, it becomes computationally expensive for networks with massive molecule counts. This new TauLeapingSimulator accelerates stochastic simulations by taking larger time steps ($\tau$) and approximating the number of reaction firings using a Poisson distribution.

Changes Made

  • Algorithm Implementation: Added TauLeapingSimulator.java to fern.simulation.algorithm.
  • Native Math: Implemented a lightweight, native Poisson random number generator (based on Knuth's algorithm) to avoid bloating the SBSCL dependencies with external math libraries.
  • Engine Integration: Successfully interfaced with FERN's AmountManager to correctly process forward reaction firings (performReaction(i, 1)).
  • Testing Infrastructure: Added the mockito-core dependency (scope: test) to the root pom.xml to allow for clean, isolated testing of the FERN engine.
  • Unit Tests: Created TauLeapingSimulatorTest.java utilizing Mockito to successfully mock the Network and verify simulator initialization and abstract method inheritance.

Validation

  • Code compiles successfully (mvn clean compile).
  • Unit tests pass locally (mvn clean test -Dtest=TauLeapingSimulatorTest).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants