Skip to content

Return the infeasible solution from every solve instead of raising - #75

Merged
edkerk merged 2 commits into
developfrom
fix/flaky-gurobi-infeasible-start
Oct 31, 2026
Merged

edkerk merged 2 commits into
developfrom
fix/flaky-gurobi-infeasible-start

Conversation

@edkerk

@edkerk edkerk commented Oct 31, 2026

Copy link
Copy Markdown
Collaborator

model.optimize() fails on an infeasible LP instead of returning an infeasible solution: Gurobi with presolve raises GurobiError: Unable to retrieve attribute 'X', and the optlang scipy interface returns None primals so cobra raises TypeError. This made a test under pytest-xdist fail intermittently.

  • geckopy.solver_support.optimize_model(model, **kwargs) returns the solution as usual, and for a non-optimal solver status returns a Solution with that status, a NaN objective and NaN fluxes. With an optimal status every error is raised.
  • The limit-protein, kcat-tuning and analysis solves (flexibilize_enz_concs, get_conc_control_coeffs, relax_enz_concs, sensitivity_tuning, sigma_fitter, evotune simulate, bottlenecks, ec_fseof, ec_fva) use it.
  • The starting LP of flexibilize_enz_concs and sensitivity_tuning is checked with slim_optimize(error_value=nan) and the solver status.
  • Tests cover glpk, scipy, Gurobi with Presolve=2, the feasible case and error pass-through. CHANGELOG entry added.

…imit-protein, kcat-tuning and analysis solves use it
@edkerk
edkerk merged commit 342f67b into develop Oct 31, 2026
5 checks passed
@edkerk
edkerk deleted the fix/flaky-gurobi-infeasible-start branch October 31, 2026 15:04
@edkerk edkerk mentioned this pull request Nov 2, 2026
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.

1 participant