import cobra.test
model = cobra.test.create_test_model('textbook')

model.solver = 'glpk'
# or if you have cplex installed
model.solver = 'cplex'

"""
Explanation: Solvers
A constraints-based reconstruction and analysis model for biological systems is actually just an application of a class of discrete optimization problems typically solved with linear, mixed integer or quadratic programming techniques. Cobrapy does not implement any algorithms to find solutions to such problems but rather creates an biologically motivated abstraction to these techniques to make it easier to think of how metabolic systems work without paying much attention to how that formulates to an optimization problem.
The actual solving is instead done by tools such as the free software glpk or commercial tools gurobi and cplex which are all made available as a common programmers interface via the optlang package.
When you have defined your model, you can switch solver backend by simply assigning to the model.solver property.
End of explanation
"""


type(model.solver)

"""
Explanation: For information on how to configure and tune the solver, please see the documentation for optlang project and note that model.solver is simply an object optlang of class Model.
End of explanation
"""


