From f24e57c391bb0f93ae2302b39cc37742b96dd41d Mon Sep 17 00:00:00 2001 From: Ke Shi <109031129+KeShih@users.noreply.github.com> Date: Thu, 23 May 2024 15:40:54 +0800 Subject: [PATCH] fix typo in slow_fba, and a bug in fast_fba (#99) * Fix: typo in slow_fba, a bug in fast_fba * remove redundant loop in fast_fba --- dingo/fba.py | 2 +- dingo/gurobi_based_implementations.py | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/dingo/fba.py b/dingo/fba.py index 8a6cbf7f..cba061f0 100644 --- a/dingo/fba.py +++ b/dingo/fba.py @@ -13,7 +13,7 @@ def slow_fba(lb, ub, S, c): """A Python function to perform fba using scipy.optimize LP solver `linprog` Returns an optimal solution and its value for the following linear program: - min c*v, subject to, + max c*v, subject to, Sv = 0, lb <= v <= ub Keyword arguments: diff --git a/dingo/gurobi_based_implementations.py b/dingo/gurobi_based_implementations.py index 787b7e2a..42300128 100644 --- a/dingo/gurobi_based_implementations.py +++ b/dingo/gurobi_based_implementations.py @@ -107,9 +107,7 @@ def fast_fba(lb, ub, S, c): if status == GRB.OPTIMAL: optimum_value = -model.getObjective().getValue() v = model.getVars() - - for i in range(n): - optimum_sol.append(v[i].x) + optimum_sol = model.getAttr("X", v) optimum_sol = np.asarray(optimum_sol)