micom-dev / micom

Python package to study microbial communities using metabolic modeling.
https://micom-dev.github.io/micom
Apache License 2.0
82 stars 17 forks source link

Improve the Gurobi support in MICOM #81

Closed cdiener closed 1 year ago

cdiener commented 2 years ago

This improves the Gurobi support in MICOM by adjusting the numerical handling and explicit use of faster primal accessors.

Changes

ToDo

Benchmark

Simple benchmark for the Cancer1 model:

In [84]: com.optimize()                                                                                                                                                       
Out[84]: <CommunitySolution 0.493 at 0x7f9a23a1a820>                                                                                                                          

In [85]: %time x = com.solver.primal_values                                                                                                                                   
CPU times: user 141 ms, sys: 12.4 ms, total: 154 ms                                                                                                                           
Wall time: 153 ms                                                                                                                                                             

In [86]: %time sol = com.cooperative_tradeoff(fraction=0.5, fluxes=True)                                                                                                      
CPU times: user 26 s, sys: 62.6 ms, total: 26.1 s                                                                                                                             
Wall time: 26.1 s 

This took ~30 minutes before.

codecov[bot] commented 2 years ago

Codecov Report

Base: 79.36% // Head: 79.01% // Decreases project coverage by -0.34% :warning:

Coverage data is based on head (2008759) compared to base (4ccb121). Patch has no changes to coverable lines.

:exclamation: Current head 2008759 differs from pull request most recent head c6a21f0. Consider uploading reports for the commit c6a21f0 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #81 +/- ## ========================================== - Coverage 79.36% 79.01% -0.35% ========================================== Files 30 30 Lines 1856 1835 -21 Branches 338 336 -2 ========================================== - Hits 1473 1450 -23 - Misses 264 266 +2 Partials 119 119 ``` | [Impacted Files](https://codecov.io/gh/micom-dev/micom/pull/81?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=micom-dev) | Coverage Δ | | |---|---|---| | [micom/workflows/core.py](https://codecov.io/gh/micom-dev/micom/pull/81/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=micom-dev#diff-bWljb20vd29ya2Zsb3dzL2NvcmUucHk=) | `46.15% <0.00%> (-17.95%)` | :arrow_down: | | [micom/solution.py](https://codecov.io/gh/micom-dev/micom/pull/81/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=micom-dev#diff-bWljb20vc29sdXRpb24ucHk=) | `74.17% <0.00%> (-1.96%)` | :arrow_down: | | [micom/workflows/grow.py](https://codecov.io/gh/micom-dev/micom/pull/81/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=micom-dev#diff-bWljb20vd29ya2Zsb3dzL2dyb3cucHk=) | `86.48% <0.00%> (-0.36%)` | :arrow_down: | | [micom/util.py](https://codecov.io/gh/micom-dev/micom/pull/81/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=micom-dev#diff-bWljb20vdXRpbC5weQ==) | `88.53% <0.00%> (-0.15%)` | :arrow_down: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=micom-dev). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=micom-dev)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

RichardOberdieck commented 2 years ago

All good from my side to mention me in the docs. And I'm very happy to see the improvements, that's great!