micom.optcom

Implements optimization and model problems.

Attributes

Functions

add_dualized_optcom(community, min_growth)

Add dual Optcom variables and constraints to a community.

add_moma_optcom(community, min_growth[, linear])

Add a dualized MOMA version of OptCom.

optcom(community, strategy, min_growth, fluxes, pfba)

Run OptCom for the community.

Module Contents

micom.optcom.add_dualized_optcom(community, min_growth)[source]

Add dual Optcom variables and constraints to a community.

Uses the original formulation of OptCom and solves the following multi-objective problem:

maximize community_growth
s.t. maximize growth_rate_i for all i
     s.t. Sv_i = 0
          lb_i >= v_i >= ub_i

Notes

This method will only find one arbitrary solution from the Pareto front. There may exist several other optimal solutions.

Parameters:
  • community (micom.Community) – The community to modify.

  • min_growth (positive float or array-like object.) – The minimum growth rate for each individual in the community. Either a single value applied to all individuals or one value for each.

micom.optcom.add_moma_optcom(community, min_growth, linear=False)[source]

Add a dualized MOMA version of OptCom.

Solves a MOMA (minimization of metabolic adjustment) formulation of OptCom given by:

minimize cooperativity_cost
s.t. maximize community_objective
     s.t. Sv = 0
          lb >= v >= ub
where community_cost = sum (growth_rate - max_growth)**2
      if linear=False or
      community_cost = sum |growth_rate - max_growth|
      if linear=True
Parameters:
  • community (micom.Community) – The community to modify.

  • min_growth (positive float or array-like object.) – The minimum growth rate for each individual in the community. Either a single value applied to all individuals or one value for each.

  • linear (boolean) – Whether to use a non-linear (sum of squares) or linear version of the cooperativity cost. If set to False requires a QP-capable solver.

micom.optcom._methods[source]
micom.optcom.optcom(community, strategy, min_growth, fluxes, pfba)[source]

Run OptCom for the community.

OptCom methods are a group of optimization procedures to find community solutions that provide a tradeoff between the cooperative community growth and the egoistic growth of each individual [1]. micom provides several strategies that can be used to find optimal solutions:

  • “moma”: Minimization of metabolic adjustment. Simultaneously optimizes the community objective (maximize) and the cooperativity cost (minimize). This method finds an exact maximum but doubles the number of required variables, thus being slow.

  • “lmoma”: The same as “moma” only with a linear representation of the cooperativity cost (absolute value).

  • “original”: Solves the multi-objective problem described in [1]. Here, the community growth rate is maximized simultanously with all individual growth rates. Note that there are usually many Pareto-optimal solutions to this problem and the method will only give one solution. This is also the slowest method.

Parameters:
  • community (micom.Community) – The community to optimize.

  • strategy (str) – The strategy used to solve the OptCom formulation. Defaults to “lagrangian” which gives a decent tradeoff between speed and correctness.

  • min_growth (float or array-like) – The minimal growth rate required for each individual. May be a single value or an array-like object with the same length as there are individuals.

  • fluxes (boolean) – Whether to return the fluxes as well.

  • pfba (boolean) – Whether to obtain fluxes by parsimonious FBA rather than “classical” FBA.

Returns:

The solution of the optimization. If fluxes==False will only contain the objective value, community growth rate and individual growth rates.

Return type:

micom.CommunitySolution

References