Skip to content

No-Op solver #279

@oxinabox

Description

@oxinabox

Checklist

Is your feature related to a problem? Please describe it.

When using cobrapy, sometimes times I want to load up a model (in my case constructing it manually) to inspect it, and use cobrapy's tools for querying what reactions are linked to what genes etc.
Or for example to use it as the source for gapfilling.

I have a rather extreme example of a model that takes about 20 minutes to define.

The time taken to construct a model in cobrapy is heavily dominated by the time taken to add_constraintss to the optlang problem it is defining behind the scenes.
However, if you never intend to solve it, then this time is wasted.

Describe the solution you would like.

I would like a solver which implements the full optlang interface, but almost all the operations are no-ops.
Then I could just call model.solver=optlang.NoOpSolver() before i start loading anything.
And all the calls to model.add_reaction and model.add_metabolites would be much faster.

Then if I were to call model.solve() then an error could be thrown explaining that this model has been created with the noop solver, and that i should set it to us an actual solver if I wanted to be able to solve it.

Describe alternatives you considered

Allowing the solver to be set to None in cobrapy, and then putting if solver around all the calls to it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions