import cobra

cobra_config = cobra.Configuration()

"""
Explanation: Global Configuration
With cobra > 0.13.4, we introduce a global configuration object. For now, you can configure default reaction bounds and optimization solver which will be respected by newly created reactions and models.
The configuration object
You can get a configuration object<sup id="a1">1</sup> in the following way:
End of explanation
"""


cobra_config.lower_bound

cobra_config.upper_bound

cobra_config.bounds

"""
Explanation: <sup id="f1">1</sup>The configuration object is a singleton. That means only one instance can exist and it is respected everywhere in COBRApy.
Reaction bounds
The object has the following attributes which you can inspect but also change as desired.
End of explanation
"""


cobra_config.bounds = -10, 20

cobra.Reaction("R1")

"""
Explanation: Changing bounds
If you modify the above values before creating a reaction they will be used.
End of explanation
"""


cobra.Reaction("R2", lower_bound=None)

"""
Explanation: Please note that by default reactions are irreversible. You can change this behavior by unsetting the lower bound argument.
End of explanation
"""


from cobra.io import load_model

model = load_model("textbook")

model.reactions.ACt2r

"""
Explanation: N.B.: Most models define reaction bounds explicitly which takes precedence over the configured values.
End of explanation
"""


model.solver

"""
Explanation: Solver
You can define the default solver used by newly instantiated models. The default solver depends on your environment. In order we test for the availability of Gurobi, CPLEX, and GLPK. GLPK is assumed to always be present in the environment.
End of explanation
"""


cobra_config.solver = "glpk_exact"

new_model = load_model("textbook")

new_model.solver

"""
Explanation: Changing solver
End of explanation
"""


