Skip to content

Add OptSolvX adapter, demo, tests, and docs (initial SBSCL integration) - #88

Open
xts-Michi wants to merge 11 commits into
draeger-lab:masterfrom
xts-Michi:feature/optsolvx-integration
Open

Add OptSolvX adapter, demo, tests, and docs (initial SBSCL integration)#88
xts-Michi wants to merge 11 commits into
draeger-lab:masterfrom
xts-Michi:feature/optsolvx-integration

Conversation

@xts-Michi

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

Copy link
Copy Markdown
Collaborator

Not ready to merge yet — updated scope below 👇

Summary

Wires SBSCL ↔ OptSolvX via a small solver adapter and adds a first SBML/FBC → LP bridge skeleton. Includes a runnable demo, unit tests, and short docs. No existing code paths are changed; OptSolvX stays Java-8 compatible (jdk8 classifier).

Changes

Adapter

  • org.simulator.optsolvx.OptSolvXSolverAdapter

    • Validates input (null + build()), delegates to CommonsMathSolver.
    • Small hardening (final fields, clearer errors, simple runtime timer), optional debug logs.

SBML/FBC → LP bridge (new)

  • org.simulator.optsolvx.FbaToOptSolvX (skeleton)

    • Minimal mapping from SBML/FBC: reactions → variables, bounds → variable bounds, objective (direction + coeffs), first equality constraint(s).
    • Logs a short summary (vars/cons/objective/dir) to aid debugging.

Tests

  • org.simulator.optsolvx.OptSolvXSolverAdapterTest

    • solve_requires_non_null_model (IAE)
    • solve_requires_build (ISE)
    • smoke_minimize_with_eq_and_bounds (min 2x+y, x+y=5 → x=0,y=5,obj=5)
  • Bridge tests (new):

    • org.simulator.optsolvx.BridgeSmokeTest
    • org.simulator.optsolvx.BridgeObjectiveTest
    • Assert that the SBML mini-model maps to a solvable LP with the expected objective setup.

Docs

  • README: “Using OptSolvX (LP) in SBSCL” — how to run the demo, enable debug, and what’s validated.

How to run

  • Demo (IDE): org.simulator.optsolvx.OptSolvXDemo

  • Tests (Maven):

    • Adapter only:
      mvn -q -Dtest=org.simulator.optsolvx.OptSolvXSolverAdapterTest test
    • Bridge tests:
      mvn -q -Dtest=org.simulator.optsolvx.BridgeSmokeTest,org.simulator.optsolvx.BridgeObjectiveTest test
    • All OptSolvX tests:
      mvn -q -Dtest=org.simulator.optsolvx.* test

Open items / Next

  • Complete FbaToOptSolvX mapping (full stoichiometry constraints, reversible flux handling, edge cases).
  • Decide logging config format (XML vs YAML/JSON) and add a Maven Enforcer rule to keep legacy XML parsers off the classpath.
  • Discuss adapter placement and optional backend selection (factory/flag).
  • Extend tests with real SBML/FBC fixtures and numerical assertions.

@matthiaskoenig matthiaskoenig left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good

@draeger draeger left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please coordinate with Ayush that all tests from the SBML test suite run smoothly, including fbc tests.

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

Labels

in progress Work in progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support pure Java solver for constraint-based modeling

3 participants