opencobra / cobrapy

COBRApy is a package for constraint-based modeling of metabolic networks.
http://opencobra.github.io/cobrapy/
GNU General Public License v2.0
461 stars 216 forks source link

how to handle mixed-integer programming (MIP) problems with the glpk, cplex or/and gurobi solvers in python/with cobrapy? #1342

Closed helehera closed 1 year ago

helehera commented 1 year ago

in matlab/cobra toolbox, I have use the functions glpk, cplexmilp and gurobi_mex to solve the following problems: % Solve problem [x, f, stat, extra] = glpk(c, A, b, lb, ub, csense, vartype, osense, solverParams)

        [x, f, exitflag, output] = cplexmilp(c, Aineq, bineq, MILPproblem.A, b, lb, ub, vartype);

    [x,f,stat,output] = gurobi_mex(c,osense,sparse(A),b, ...
        csense,lb,ub,vartype,opts);

How do I solve the problems in python/cobrapy?

Midnighter commented 1 year ago

Is your question, how to change the solver backend?

Midnighter commented 1 year ago

There are some MILP implemented. But if you are talking about defining your own problem you need to get familiar with optlang. That is what cobrapy uses underneath.

Midnighter commented 1 year ago

Minimizing a medium's components is an MILP, for example.