micom icon indicating copy to clipboard operation
micom copied to clipboard

Improve the Gurobi support in MICOM

Open cdiener opened this issue 2 years ago • 2 comments

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

Changes

  • follow the best practices from the Gurobi Numerical Issue Guidelines
  • faster accessors for primal values (obtaining primal values now takes <1s even for large models)
  • delegate the objective scaling to Gurobi

ToDo

  • [x] wait for https://github.com/opencobra/optlang/pull/240.
  • [ ] implement a smaller example model to integrate Gurobi into the CI, the free license is limited to <200 variables for QPs
  • [x] ask @RichardOberdieck if it is okay to mention him in the docs

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.

cdiener avatar Apr 15 '22 23:04 cdiener

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
@@            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 Coverage Δ
micom/workflows/core.py 46.15% <0.00%> (-17.95%) :arrow_down:
micom/solution.py 74.17% <0.00%> (-1.96%) :arrow_down:
micom/workflows/grow.py 86.48% <0.00%> (-0.36%) :arrow_down:
micom/util.py 88.53% <0.00%> (-0.15%) :arrow_down:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

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

codecov[bot] avatar Apr 15 '22 23:04 codecov[bot]

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

RichardOberdieck avatar Apr 19 '22 15:04 RichardOberdieck