Repository navigation
feat(tracking): configurable ILP solver backend preference (enable cuOpt) - #9
Conversation
Add an optional `solver_preference` to `ILPSolverConfig` and forward it through `solve_tracking` into tracksdata's `ILPSolver` and the two-pass `TrackletSolver`, including the internal linkage-pass solver. This lets a user select an alternate ILP backend (for example NVIDIA cuOpt) instead of Gurobi, as an ordered list of backend names. The default is None, which preserves current behavior: tracksdata uses its own default order (Gurobi then SCIP). The preference is only forwarded when set, so older tracksdata (without PR #343) is unaffected. The linkage pass reads the inherited `_solver_preference` defensively. Add a hermetic test that mocks tracksdata's solver, so it does not depend on the installed tracksdata carrying PR #343. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
Add tests that model a pre-#343 tracksdata whose ILPSolver rejects `solver_preference`: the default config constructs both passes without the kwarg, and opting into a preference surfaces the TypeError instead of being dropped. Note the compat intent at the forward guard in _solver.py. Addresses review feedback on royerlab#9. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
I added some tests for the case of the older |
Collapse the raise onto one line to satisfy `ruff format --check`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add tests that model a pre-#343 tracksdata whose ILPSolver rejects `solver_preference`: the default config constructs both passes without the kwarg, and opting into a preference surfaces the TypeError instead of being dropped. Note the compat intent at the forward guard in _solver.py. Addresses review feedback on #9.
feat(tracking): configurable ILP solver backend preference (enable cuOpt)
What
Add an optional
solver_preferencetoILPSolverConfigand thread it throughsolve_trackinginto tracksdata'sILPSolverand the two-passTrackletSolver(including the internal tracklet-linkage solver instance).This lets a user choose an alternate ILP backend (in our case, NVIDIA cuOpt) instead of Gurobi, given either a single backend name or an ordered list (e.g.
"gurobi"or["gurobi", "cuopt", "scip"]). Names are matched, case-insensitive, by tracksdata.Outcome
Run the tracking ILP on a non-Gurobi backend (e.g. cuOpt on GPU) through config alone, so sites without a Gurobi license can still solve large graphs (SCIP is too slow).
Behavior / backward compatibility
Nonepreserves current behavior: tracksdata keeps its default order (Gurobi then SCIP).None, the kwarg is not passed, so installs on older tracksdata are unaffected.TrackletSolver.solvereads the inherited_solver_preferencedefensively (getattr(..., None)) and forwards it only when present, so both passes honor the same backend.ILPSolverConfig.default()is unchanged.Runtime requirement (important)
solver_preferencerequires tracksdata with PR #343, and thecuoptbackend additionally requiresilpy >= 0.6.0. hoct currently pinstracksdata>=0.1.0rc4(resolves to rc11 today, which does not carry #343). This PR is safe on that pin (defaultNonechanges nothing).Follow-up: bump the
tracksdatapin to the first release that includes #343; until then, a non-Nonesolver_preferencefails at solver construction on the pinned tracksdata.Tests
src/hoct/_tests/test_solver_preference.pymocks tracksdata's solver classes and asserts the constructor kwargs at all three construction sites, so it passes regardless of whether the installed tracksdata carries #343. No real ilpy/Gurobi/cuOpt solve runs.🤖 Generated with Claude Code