Skip to content

Commit

Permalink
fixed faq.ipynb and removed irrelevant section
Browse files Browse the repository at this point in the history
  • Loading branch information
uri.akavia committed Apr 28, 2022
1 parent 148d26f commit bc0781b
Showing 1 changed file with 2 additions and 36 deletions.
38 changes: 2 additions & 36 deletions documentation_builder/faq.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"model = cobra.io.load_model(\"iYS1720\")\n",
"\n",
"for metabolite in model.metabolites:\n",
" metabolite.id = \"test_\" + metabolite.id\n",
" metabolite.id = f\"test_{metabolite.id}\"\n",
"\n",
"try:\n",
" model.metabolites.get_by_id(model.metabolites[0].id)\n",
Expand Down Expand Up @@ -289,7 +289,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"With optlang solvers, the LP formulation of a model is obtained by it's string representation. All solvers behave the same way."
"With optlang solvers, the LP formulation of a model is obtained by its string representation. All solvers behave the same way."
]
},
{
Expand All @@ -302,40 +302,6 @@
" out.write(str(model.solver))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### For cobrapy's internal solvers"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"With the internal solvers, we first create the problem and use functions bundled with the solver. \n",
"\n",
"Please note that unlike the LP file format, the MPS file format does not specify objective direction and is always a minimization. Some (but not all) solvers will rewrite the maximization as a minimization."
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"model = cobra.io.load_model(\"iYS1720\")\n",
"\n",
"# glpk through cglpk\n",
"glpk = cobra.solvers.cglpk.create_problem(model)\n",
"glpk.write(\"test.lp\")\n",
"glpk.write(\"test.mps\") # will not rewrite objective\n",
"# cplex\n",
"cplex = cobra.solvers.cplex_solver.create_problem(model)\n",
"cplex.write(\"test.lp\")\n",
"cplex.write(\"test.mps\") # rewrites objective"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down

0 comments on commit bc0781b

Please sign in to comment.