17.1.1.1.1.11. cobra.core.solution
¶
Provide unified interfaces to optimization solutions.
17.1.1.1.1.11.1. Module Contents¶
17.1.1.1.1.11.1.1. Classes¶
A unified interface to a cobra.Model optimization solution. |
|
Legacy support for an interface to a cobra.Model optimization solution. |
17.1.1.1.1.11.1.2. Functions¶
|
Generate a solution representation of the current solver state. |
-
class
cobra.core.solution.
Solution
(objective_value, status, fluxes, reduced_costs=None, shadow_prices=None, **kwargs)[source]¶ Bases:
object
A unified interface to a cobra.Model optimization solution.
Notes
Solution is meant to be constructed by get_solution please look at that function to fully understand the Solution class.
-
fluxes
¶ Contains the reaction fluxes (primal values of variables).
- Type
pandas.Series
-
reduced_costs
¶ Contains reaction reduced costs (dual values of variables).
- Type
pandas.Series
-
shadow_prices
¶ Contains metabolite shadow prices (dual values of constraints).
- Type
pandas.Series
-
-
class
cobra.core.solution.
LegacySolution
(f, x=None, x_dict=None, y=None, y_dict=None, solver=None, the_time=0, status='NA', **kwargs)[source]¶ Bases:
object
Legacy support for an interface to a cobra.Model optimization solution.
-
x
¶ List or Array of the fluxes (primal values).
- Type
iterable
-
y
¶ List or Array of the dual values.
- Type
iterable
Warning
The LegacySolution class and its interface is deprecated.
-
-
cobra.core.solution.
get_solution
(model, reactions=None, metabolites=None, raise_error=False)[source]¶ Generate a solution representation of the current solver state.
- Parameters
model (cobra.Model) – The model whose reactions to retrieve values for.
reactions (list, optional) – An iterable of cobra.Reaction objects. Uses model.reactions by default.
metabolites (list, optional) – An iterable of cobra.Metabolite objects. Uses model.metabolites by default.
raise_error (bool) – If true, raise an OptimizationError if solver status is not optimal.
- Returns
- Return type
Note
This is only intended for the optlang solver interfaces and not the legacy solvers.