Skip to content

Conversation

xts-Michi
Copy link
Collaborator

@xts-Michi xts-Michi commented Aug 21, 2025

Status: Not ready to merge yet - review welcome.

Summary

Switch FBA to OptSolvX by default, introduce an initial SBML-FBC→LP bridge, fix dependency/classpath issues for modern JDKs, and remove the legacy SCPSolver/GLPK backend.

What changed since the last review

  • Removed NewGLPKSolver and SCPSolver test (SCPSolverIssue); no SCPSolver/GLPK deps remain in code or POM.
  • Added constraint-level tests for the bridge (BridgeConstraintTests) and minor perf tidy-ups in the bridge (cached SBML lists, pre-sized maps).
  • Restored getActiveObjective() in FBA for API/test compatibility.
  • Aligned dependencies to include Commons Math 2.2 alongside Math3 for legacy ODE API.

Key changes

1) Default backend = OptSolvX

  • FBA uses OptSolvX by default via OptSolvXSolverAdapter.
  • The solver selection is currently limited to the CommonsMathSolver. Other solvers will follow!

2) SBML-FBC → LP bridge (prototype)

  • FbaToOptSolvX maps:

    • variables = reactions (+ bounds from FBC v1/v2),
    • constraints = S·v = 0 with boundary species ignored,
    • objective = active FBC objective (v1/v2).
  • Small perf pass: cache SBML lists, pre-size maps.

3) Dependency / classpath

  • Add org.apache.commons:commons-math:2.2 for legacy ODE API (Math2) next to commons-math3:3.6.1.
  • Exclude legacy XML stack (xercesImpl, xml-apis, xalan) to avoid JAXP conflicts with modern JDKs (Log4j2 config now clean).

4) Cleanup: remove SCPSolver/GLPK

  • Delete legacy GLPK/SCPSolver backend (code + test).
  • No more SCPSolver jars on the compile/test classpath.
  • Note: A shell helper under src/test/scripts/** still references old GLPK jars only for the historic wrapper; it’s inert for Maven builds and can be pruned later.

5) Tests & layout

  • Bridge smoke/objective: BridgeSmokeTest, BridgeObjectiveTest.

  • New: BridgeConstraintTests checking S·v=0 at coefficient level:

    • counts per species,
    • sign/value for non-unit stoichiometry,
    • sum across reactions,
    • ignore boundary species,
    • ignore species with no participation,
    • multi-species (A,B) with different patterns.
  • Tests live under src/test/java/org/simulator/optsolvx.

6) Docs / build hygiene

  • README adds short “Using OptSolvX (LP) in SBSCL)” snippet & JDK notes.
  • Ensured OptSolvX artifact remains Java 8 bytecode (major 52) for downstream users.

How to test

# E. coli core (unchanged public API)
mvn -q -Dtest=org.simulator.fba.FluxBalanceAnalysisTest#solveEColiCore test
mvn -q -Dtest=org.simulator.fba.FluxBalanceAnalysisTest#solveEColiCoreGZ test

# Bridge-focused
mvn -q -Dtest=org.simulator.optsolvx.BridgeSmokeTest test
mvn -q -Dtest=org.simulator.optsolvx.BridgeObjectiveTest test
mvn -q -Dtest=org.simulator.optsolvx.BridgeConstraintTests test

Typical runtime (E. coli core):

INFO: FbaToOptSolvX: built LP (vars=95, cons=72, objectiveVars=1, dir=MAXIMIZE)
INFO: FBA: built OptSolvX model (vars=95, cons=72)
INFO: OptSolvXSolverAdapter: result feasible=true, objective≈0.874

Compatibility

  • No public API changes; only the default backend changed.
  • getActiveObjective() restored; tests depending on it pass.
  • Builds/runs on modern JDKs (tested with JDK 22); OptSolvX stays Java-8 compatible.

Follow-ups

  • Decide how OptSolvX should be implemented into SBSCL

<groupId>org.optsolvx</groupId>
<artifactId>optsolvx</artifactId>
<version>0.1.0-SNAPSHOT</version>
</dependency>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please place a local lib file of OptSolvX and use a local dependency for the time being, until we have it in MavenCentral.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants