Posts

OptSolvX in SBSCL: A Solver-Agnostic LP Core (GSoC 2025 Final Report)

Bild
Enhancing the Systems Biology Simulation Core Library (SBSCL) with a Solver-Agnostic Framework for Constraint-Based Simulation and Analysis National Resource of Network Biology (NRNB) Google Summer of Code 2025 Final Report Name Michael Gaas Mentors           Prof. Dr. Andreas Dräger, Matthias König Overview This work modernizes constraint-based simulation in the Systems Biology Simulation Core Library (SBSCL) by introducing a solver-agnostic linear programming (LP) core (OptSolvX), a thin integration layer within SBSCL, and a bridge from SBML/FBC to linear programs. The objective is to restore robust, portable Flux Balance Analysis (FBA) on current platforms, including ARM-based systems, while preserving SBSCL’s public API and keeping solver-specific concerns decoupled from biological model handling. Implementation Summary OptSolvX provides a minimal, solver-agnostic LP domain model with AbstractLPModel, Variable, Constraint, OptimizationDirection,...

Week 11 - Legacy Backends Removed, Bridge Constraints, and Build Fixes

This week I removed the old SCPSolver/GLPK stack, confirmed OptSolvX as the default solver path in SBSCL, fixed an ODE compatibility issue, and extended constraint tests for the bridge. Progress Legacy backends removed (SCPSolver/GLPK/Lp_solve) Deleted org.simulator.fba.NewGLPKSolver . Dropped Maven dependencies for SCPSolver, GLPK, and Lp_solve. Verification: mvn -DskipTests clean compile → BUILD SUCCESS mvn dependency:tree | grep -i "scpsolver\|glpk\|lpsolve" → no results Only references left are in legacy test scripts outside the Maven build. OptSolvX confirmed as the default path FluxBalanceAnalysis now resolves the backend via ServiceLoader with fallback, using the OptSolvX adapter by default. FbaToOptSolvX remains the central SBML FBC → LP translation layer. ODE compatibility fix Re-added commons-math:2.2 (alongside commons-math3:3.6.1 ) for legacy ODE APIs. Project builds cleanly again without org.apache.commons.math.ode e...

Week 10 - Bridge Prototype and Classpath Fix

This week I brought the first pieces of the SBML-to-LP bridge to life, fixed a classpath issue that blocked tests, and refreshed docs and the pending PR. I also ran the bridge on the E. coli core model end-to-end. Progress Bridge scaffolding running (now on a real model) Implemented a minimal FbaToOptSolvX path that builds an LP and executes. End-to-end with SBSCL on E. coli core : the bridge emits an LP with 95 variables and 72 constraints , objective direction MAXIMIZE . Solver: OptSolvX → CommonsMath backend. Results: feasible = true , objective ≈ 0.874 , typical solve time ~70–170 ms . Smoke & objective tests (JDK 22) Both focused tests complete with exit code 0. Example logs: INFO: FbaToOptSolvX: built LP (vars=95, cons=72, objectiveVars=1, dir=MAXIMIZE) INFO: OptSolvXSolverAdapter: result feasible=true, objective=0.874 Classpath fix Root cause: legacy XML parser jars shadowed the JDK’s JAXP and triggered Log4j2’s XML-parser feature toggles to fail...

Week 9 - OptSolvX Integration into SBSCL and Bridge Preparation

In the past week, I focused on implementing the OptSolvX integration in SBSCL, adding tests and documentation, and preparing the groundwork for the SBML-to-LP bridge. Progress: SBSCL – OptSolvX Adapter: Implemented org.simulator.optsolvx.OptSolvXSolverAdapter (implements LPSolverAdapter ) with checks for model != null and model.isBuilt() . Added debug logging via MessageFormat , including before/after states and runtime measurement. Solver calls are delegated to the existing CommonsMathSolver . New Demo in SBSCL: Added org.simulator.optsolvx.OptSolvXDemo running a minimal LP example ( max x + y , with constraints x + 2y ≤ 4 and x ≤ 3 ). Expected result: x = 3.0 , y = 0.5 , objective 3.5 , feasible true . New Tests: Created OptSolvXSolverAdapterTest covering: Null model handling ( IllegalArgumentException ) Build requirement check ( IllegalStateException ) Minimization case with equality and bounds ( x = 0 , y = 5 , objective 5 ). All d...

Week 7 - Model Refinement, Code Cleanup, and Solver Integration

In the past week, my main focus was on refining the model abstraction, further cleaning the codebase, and once again, integrate the CommonsMathSolver into the solver interface. Progress: Model Refinement with Built Flag: Added a built flag to AbstractLPModel to clearly indicate when the model is finalized. After calling build() , the flag is set to true . Any subsequent changes reset the flag to false until the model is rebuilt. This mechanism ensures clarity about the model's state throughout its lifecycle. Utility for Constraint Indices: Implemented a utility method that retrieves the index of a given constraint within the model. This allows adapters or other classes easy access to constraint indices without redundant logic. Continuous Integration Improvements: Ensured the CI pipeline via GitHub Actions runs all unit tests smoothly and without errors, providing instant feedback on new code contributions and pull requests. Explicit Double Types in Tests: Added ...

Week 6 - Abstract Model Refactoring, Unified Testing & CI Setup

In the past week, my main focus was on refactoring the model layer, improving test coverage, and streamlining project automation. Progress: New Abstract Model Class: Introduced AbstractLPModel as the new central class to dynamically manage variables, constraints, and all model metadata. Instead of fixed arrays, the class uses flexible lists and maps. The final model is only constructed when calling build() . Consistent Mapping & ID Tracking: Implemented clear mapping from names to indices for all variables and constraints, preventing duplicate IDs and making debugging easier. Unit Tests for Model Abstraction: Added a new test class ( AbstractLPModelTest ) covering variable/constraint addition, the build process, and redundancy cases. Exception handling for duplicate names is implemented and tested. CI/CD Pipeline: Set up a GitHub Actions workflow that automatically builds and tests every commit and pull request. Errors are shown directly in the PR for quick feedba...

Week 5 - Unit Testing, OjAlgo Integration, and Code Cleanup

In the past week, my primary goal was enhancing the test infrastructure, finishing the integration of the second solver, OjAlgo, and maintaining overall code quality and clarity. Progress: Unit Tests for CommonsMathSolver Implemented unit tests covering maximization, minimization, variable bounds, equality constraints, unsolvable and unbounded LP scenarios, and precision checks. Standardized test logic and provided clear comments aligned with Commons Math documentation and architecture. Test Environment Stabilization Fully synchronized Maven and IntelliJ configurations, eliminating issues with dependencies (JUnit, etc.) and resolving ClassNotFoundException permanently. Cleaned up the project structure by separating test and main code, removing obsolete files, and ignoring IDE-specific files ( .idea , .iml ) from version control. Development of Second Solver Adapter ( OjAlgoSolver ) Created a new adapter implementation to the ILPSolver   interface. S...