Refactor: Integrate FERN with native SBSCL SBMLinterpreter (Resolves #55) - #109
Open
dyrpsf wants to merge 1 commit into
Open
Refactor: Integrate FERN with native SBSCL SBMLinterpreter (Resolves #55)#109dyrpsf wants to merge 1 commit into
dyrpsf wants to merge 1 commit into
Conversation
draeger
requested review from
draeger,
hemilpanchiwala,
matthiaskoenig and
zakharc
April 24, 2026 14:38
draeger
approved these changes
Apr 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR resolves Issue #55 by deeply integrating FERN's stochastic propensity calculations with the native, highly-optimized SBSCL
SBMLinterpreter.Previously, FERN relied on a custom
MathTreeclass that manually copied the Abstract Syntax Tree (AST) and created a new instance of the interpreter for every single reaction calculation. This created a massive memory and performance bottleneck during stochastic simulations.Changes Made
SBMLPropensityCalculator.java: The calculator no longer duplicates the interpreter state. It now updates the existingSBMLinterpreterstate and natively calculates velocities usinginterpreter.compileReaction(reactionIndex).MathTree.java: Completely removed this class to prevent slow AST copying and manual Depth-First Search (DFS) tree traversals for species dependencies. Dependency resolution is now handled efficiently by querying theReactionobject directly via JSBML.SBMLEventHandlerObserver.java: Rewired event, trigger, and delay evaluations to use nativeASTNodeandASTNodeValueevaluation from SBSCL instead ofMathTree.NetworkTools.java: Removed obsolete helper methods that relied on the deletedMathTreeclass.Impact
This architectural shift significantly reduces the memory overhead and computational bottleneck of the Gillespie algorithm in SBSCL. By relying on the native engine, the mathematical structure of the model is no longer being duplicated in memory for every propensity calculation.
Resolves #55