Skip to content

Same individual growth rates #132

Answered by cdiener
lhtxa asked this question in Q&A
Sep 7, 2023 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

Definitely possible but currently a bit clunky. Cooperative Tradeoff will push the solution towards that by default, especially if you choose a low tradeoff. But it is also possible to enforce the same growth rates directly by adding ratio constraints. Here is an example:

import micom as mm

com = mm.Community(mm.data.test_taxonomy())
constraints = []
ref_taxon_objective = com.constraints["objective_" + com.taxa[0]].expression
for tax in com.taxa[1:]:
    c = com.problem.Constraint(
        com.constraints["objective_" + tax].expression - ref_taxon_objective,
        name="ratio_" + tax,
        lb=0, ub=0
    )
    constraints.append(c)
with com:
    com.add_cons_vars(constraints)
    sol =

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@lhtxa
Comment options

@cdiener
Comment options

Answer selected by lhtxa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants