5.1.1. conv_opt.solver package

5.1.1.1. Submodules

5.1.1.2. conv_opt.solver.cbc module

CBC module

Author:Jonathan Karr <jonrkarr@gmail.com>
Date:2017-11-22
Copyright:2017, Karr Lab
License:MIT
class conv_opt.solver.cbc.CbcModel(model, options=None)[source]

Bases: conv_opt.solver.cylp.CylpModel

Cbc solver

5.1.1.3. conv_opt.solver.cplex module

IBM CPLEX module

Author:Jonathan Karr <jonrkarr@gmail.com>
Date:2017-11-22
Copyright:2017, Karr Lab
License:MIT
class conv_opt.solver.cplex.CplexModel(model, options=None)[source]

Bases: conv_opt.core.SolverModel

IBM CPLEX solver

get_stats()[source]

Get diagnostic information about the model

Returns:diagnostic information about the model
Return type:str
load(conv_opt_model)[source]

Load a model to CPLEX’s data structure

Parameters:conv_opt_model (Model) – model
Returns:the model in CPLEX’s data structure
Return type:cplex.Cplex
Raises:ConvOptError – if the presolve mode is not supported a variable has an unsupported type, an objective has an unsupported term, a constraint has an unsupported term, a constraint is unbounded, or the model is not of a supported type
set_parameters(parameters=None, values=None)[source]

Set CPLEX parameters

Parameters:
  • parameters (object, optional) – parameters object
  • values (dict, optional) – parameter values
set_solver_options()[source]

Set solver options

solve()[source]

Solve the model

Returns:result
Return type:Result

5.1.1.4. conv_opt.solver.cvxopt module

CVXOPT module

Author:Jonathan Karr <jonrkarr@gmail.com>
Date:2017-11-22
Copyright:2017, Karr Lab
License:MIT
class conv_opt.solver.cvxopt.CvxoptModel(model, options=None)[source]

Bases: conv_opt.solver.cvxpy.CvxpyModel

CVXOPT solver

SOLVER = 'CVXOPT'[source]
load(conv_opt_model)[source]

Load a model to CVXPY’s data structure

Parameters:conv_opt_model (cvxpy.Problem) – model
Returns:the model in CVXPY’s data structure
Return type:dict
Raises:ConvOptError – if a variable has an unsupported type

5.1.1.5. conv_opt.solver.cvxpy module

CVXPY module

Author:Jonathan Karr <jonrkarr@gmail.com>
Date:2017-11-22
Copyright:2017, Karr Lab
License:MIT
class conv_opt.solver.cvxpy.CvxpyModel(model, options=None)[source]

Bases: conv_opt.core.SolverModel

CVXPY solver

SOLVER[source]

desired solver

Type:str
SOLVER = None[source]
get_stats()[source]

Get diagnostic information about the model

Returns:diagnostic information about the model
Return type:dict
load(conv_opt_model)[source]

Load a model to CVXPY’s data structure

Parameters:conv_opt_model (cvxpy.Problem) – model
Returns:the model in CVXPY’s data structure
Return type:dict
Raises:ConvOptError – if the presolve mode is unsupported, a variable has an unsupported type, an objective has an unsupported term, a constraint has an unsupported term, a constraint is unbounded, or the model is not of a supported type
solve()[source]

Solve the model

Returns:result
Return type:Result

5.1.1.6. conv_opt.solver.cylp module

CyLP module

Author:Jonathan Karr <jonrkarr@gmail.com>
Date:2017-11-22
Copyright:2017, Karr Lab
License:MIT
class conv_opt.solver.cylp.CylpModel(model, options=None)[source]

Bases: conv_opt.core.SolverModel

CyLP solver

get_stats()[source]

Get diagnostic information about the model

Returns:diagnostic information about the model
Return type:dict
load(conv_opt_model)[source]

Load a model to CyLP’s data structure

Parameters:conv_opt_model (Model) – model
Returns:the model in CyLP’s data structure
Return type:cylp.cy.CyClpSimplex
Raises:ConvOptError – if the presolve mode is unsupported, a variable has an unsupported type, an objective has an unsupported term, a constraint has an unsupported term, a constraint is unbounded, or the model is not of a supported type
solve()[source]

Solve the model

Returns:result
Return type:Result

5.1.1.7. conv_opt.solver.glpk module

GLPK module

Author:Jonathan Karr <jonrkarr@gmail.com>
Date:2017-11-22
Copyright:2017, Karr Lab
License:MIT
class conv_opt.solver.glpk.GlpkModel(model, options=None)[source]

Bases: conv_opt.solver.optlang.OptlangModel

GLPK solver

INTERFACE = <module 'optlang.glpk_interface' from '/usr/local/lib/python3.6/site-packages/optlang/glpk_interface.py'>[source]
get_stats()[source]

Get diagnostic information about the model

Returns:diagnostic information about the model
Return type:dict

5.1.1.8. conv_opt.solver.gurobi module

Gurobi module

Author:Jonathan Karr <jonrkarr@gmail.com>
Date:2017-11-22
Copyright:2017, Karr Lab
License:MIT
class conv_opt.solver.gurobi.GurobiModel(model, options=None)[source]

Bases: conv_opt.core.SolverModel

Gurobi solver

get_stats()[source]

Get diagnostic information about the model

Returns:diagnostic information about the model
Return type:dict
load(conv_opt_model)[source]

Load a model to Gurobi’s data structure

Parameters:conv_opt_model (gurobipy.Model) – model
Returns:the model in Gurobi’s data structure
Return type:object
Raises:ConvOptError – if the presolve mode is unsupported, a variable has an unsupported type, an objective has an unsupported term, a constraint has an unsupported term, or a constraint is unbounded
solve()[source]

Solve the model

Returns:result
Return type:Result

5.1.1.9. conv_opt.solver.minos module

MINOS module

References:

Author:Jonathan Karr <jonrkarr@gmail.com>
Date:2018-08-16
Copyright:2018, Karr Lab
License:MIT
class conv_opt.solver.minos.MinosModel(model, options=None)[source]

Bases: conv_opt.core.SolverModel

MINOS solver

DEFAULT_OPTIONS = {'minos': {'Expand frequency': 100000, 'Feasibility tol': 1e-07, 'Iteration limit': 2000000, 'LU factor tol': 1.9, 'LU singularity tol': 1e-12, 'LU update tol': 1.9, 'New basis file': 11, 'Optimality tol': 1e-07, 'Penalty parameter': 100.0, 'Print frequency': 100000, 'Print level': 0, 'Save frequency': 500000, 'Scale option': 2, 'Unbounded step size': 1e+18, 'sense': 'Maximize', 'solution': 'Solution No'}, 'qminos': {'Expand frequency': 100000, 'Feasibility tol': 1e-20, 'Iteration limit': 2000000, 'LU factor tol': 10.0, 'LU singularity tol': 1e-30, 'LU update tol': 10.0, 'New basis file': 11, 'Optimality tol': 1e-20, 'Penalty parameter': 100.0, 'Print frequency': 100000, 'Print level': 0, 'Save frequency': 500000, 'Scale option': 2, 'Unbounded step size': 1e+30, 'sense': 'Maximize', 'solution': 'Solution No'}}[source]
get_stats()[source]

Get diagnostic information about the model

Returns:diagnostic information about the model
Return type:str
load(conv_opt_model)[source]

Load a model to MINOS’ data structure

Parameters:conv_opt_model (Model) – model
Returns:the model in MINOS’ data structure
Return type:attrdict.AttrDict
Raises:ConvOptError – if the presolve mode is not supported a variable has an unsupported type, an objective has an unsupported term, a constraint has an unsupported term, a constraint is unbounded, or the model is not of a supported type
set_solver_options()[source]

Set solver options

solve()[source]

Solve the model

Returns:result
Return type:Result
conv_opt.solver.minos.makeME_LP(S, b, c, xl, xu, csense)[source]

Create simple LP for qMINOS and MINOS Inputs: nlp_compat Make matrices compatible with NLP so that basis can

be used to warm start NLP by setting

12 Aug 2015: first version

5.1.1.10. conv_opt.solver.mosek module

MOSEK Optimizer module

Author:Jonathan Karr <jonrkarr@gmail.com>
Date:2017-11-22
Copyright:2017, Karr Lab
License:MIT
class conv_opt.solver.mosek.MosekModel(model, options=None)[source]

Bases: conv_opt.core.SolverModel

MOSEK Optimizer solver

Attributes
_environment (mosek.Env): MOSEK Optimizer environment
get_stats()[source]

Get diagnostic information about the model

Returns:diagnostic information about the model
Return type:dict
load(conv_opt_model)[source]

Load a model to MOSEK Optimizer’s data structure

Parameters:conv_opt_model (Model) – model
Returns:the model in MOSEK Optimizer’s data structure
Return type:mosek.Task
Raises:ConvOptError – if the presolve mode is unsupported, a variable has an unsupported type, an objective has an unsupported term, a constraint has an unsupported term, or the model is not of a supported type
solve()[source]

Solve the model

Returns:result
Return type:Result

5.1.1.11. conv_opt.solver.optlang module

optlang module

Author:Jonathan Karr <jonrkarr@gmail.com>
Date:2017-11-22
Copyright:2017, Karr Lab
License:MIT
class conv_opt.solver.optlang.OptlangModel(model, options=None)[source]

Bases: conv_opt.core.SolverModel

optlang solver

INTERFACE[source]

optlang interface

Type:module
INTERFACE = None[source]
load(conv_opt_model)[source]

Load a model to GPLK’s data structure

Parameters:conv_opt_model (Model) – model
Returns:the model in optlang’s data structure
Return type:optlang.Model
Raises:ConvOptError – if the presolve mode is unsupported, a variable has an unsupported type, an objective has an unsupported term, a constraint has an unsupported term, a constraint is unbounded, or the model is not of a supported type
solve()[source]

Solve the model

Returns:result
Return type:Result

5.1.1.12. conv_opt.solver.quadprog module

quadprog module

Author:Jonathan Karr <jonrkarr@gmail.com>
Date:2017-11-22
Copyright:2017, Karr Lab
License:MIT
class conv_opt.solver.quadprog.QuadprogModel(model, options=None)[source]

Bases: conv_opt.core.SolverModel

quadprog solver

_stats[source]

diagnostic information about the solution

Type:dict
get_stats()[source]

Get diagnostic information about the model

Returns:diagnostic information about the model
Return type:dict
load(conv_opt_model)[source]

Load a model to quadprog’s data structure

Parameters:conv_opt_model (Model) – model
Returns:the model in quadprog’s data structure
Return type:dict
Raises:ConvOptError – if the presolve mode is unsupported, a variable has an unsupported type, an objective has an unsupported term, a constraint has an unsupported term, or a constraint is unbounded
solve()[source]

Solve the model

Returns:result
Return type:Result

5.1.1.13. conv_opt.solver.scipy module

SciPy module

Author:Jonathan Karr <jonrkarr@gmail.com>
Date:2017-11-22
Copyright:2017, Karr Lab
License:MIT
class conv_opt.solver.scipy.ScipyModel(model, options=None)[source]

Bases: conv_opt.core.SolverModel

SciPy solver

_stats[source]

solver statistics

Type:dict
get_stats()[source]

Get diagnostic information about the model

Returns:diagnostic information about the model
Return type:dict
load(conv_opt_model)[source]

Load a model to SciPy’s data structure

Parameters:conv_opt_model (Model) – model
Returns:the model in SciPy’s data structure
Return type:dict
Raises:ConvOptError – if the model is not of a supported type
solve()[source]

Solve the model

Returns:result
Return type:Result

5.1.1.14. conv_opt.solver.soplex module

SoPlex module

References:

Author:Jonathan Karr <jonrkarr@gmail.com>
Date:2018-08-17
Copyright:2018, Karr Lab
License:MIT
class conv_opt.solver.soplex.MetabolitesList[source]

Bases: list

List of metabolites of a COBRA model

index(id)[source]

Get the index of the metabolite with identifier id

Parameters:id (str) – identifier
Returns:index of metabolite with identifier id in list
Return type:int
Raises:ValueError – if no metabolite with identifier id is in list
class conv_opt.solver.soplex.SoplexModel(model, options=None)[source]

Bases: conv_opt.core.SolverModel

SoPlex solver

DEFAULT_OPTIONS = {'FEASTOL': 1e-20, 'ITERLIMIT': 2147483647, 'OPTTOL': 1e-20}[source]
INF = 1e+256[source]
get_stats()[source]

Get diagnostic information about the model

Returns:diagnostic information about the model
Return type:str
load(conv_opt_model)[source]

Load a model to SoPlex’s data structure

Parameters:conv_opt_model (Model) – model
Returns:the model in SoPlex’s data structure
Return type:soplex.Soplex
Raises:ConvOptError – if the presolve mode is not supported a variable has an unsupported type, an objective has an unsupported term, a constraint has an unsupported term, a constraint is unbounded, or the model is not of a supported type
set_solver_options()[source]

Set solver options

solve()[source]

Solve the model

Returns:result
Return type:Result

5.1.1.15. conv_opt.solver.xpress module

FICO XPRESS module

Author:Jonathan Karr <jonrkarr@gmail.com>
Date:2017-11-22
Copyright:2017, Karr Lab
License:MIT
class conv_opt.solver.xpress.XpressModel(model, options=None)[source]

Bases: conv_opt.core.SolverModel

FICO XPRESS solver

get_stats()[source]

Get diagnostic information about the model

Returns:diagnostic information about the model
Return type:dict
is_mixed_integer()[source]

Determine if the model has at least one binary or integer variable

Returns:True if the model has at least one binary or integer variable, and false otherwise
Return type:bool
is_non_linear()[source]

Determine if the model is non-linear

Returns:True if the model is non-linear and false otherwise
Return type:bool
load(conv_opt_model)[source]

Load a model to XPRESS’ data structure

Parameters:conv_opt_model (Model) – model
Returns:the model in XPRESS’ data structure
Return type:object
Raises:ConvOptError – if the presolve mode is unsupported, a variable has an unsupported type, an objective has an unsupported term, a constraint has an unsupported term, or a constraint is unbounded
solve()[source]

Solve the model

Returns:result
Return type:Result

5.1.1.16. Module contents

Open-source, easily installable solvers