Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make gurobi models pickeable #124

Merged
merged 1 commit into from
Aug 7, 2017

Conversation

cdiener
Copy link
Member

@cdiener cdiener commented Aug 4, 2017

Fixes #123.

Before:

In [1]: import optlang

In [2]: import pickle

In [3]: mod = optlang.gurobi_interface.Model()
Academic license - for non-commercial use only

In [4]: x = pickle.dumps(mod)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-4-82cf2f51c584> in <module>()
----> 1 x = pickle.dumps(mod)

AttributeError: Can't pickle local object 'Configuration._tolerance_functions.<locals>.<lambda>'

After:

In [1]: import optlang

In [2]: import pickle

In [3]: mod = optlang.gurobi_interface.Model()
Academic license - for non-commercial use only

In [4]: x = pickle.dumps(mod)

In [5]: len(x)
Out[5]: 679

@codecov-io
Copy link

codecov-io commented Aug 4, 2017

Codecov Report

Merging #124 into master will decrease coverage by 20.89%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #124      +/-   ##
==========================================
- Coverage   89.43%   68.53%   -20.9%     
==========================================
  Files           8        8              
  Lines        2460     2460              
  Branches      542      542              
==========================================
- Hits         2200     1686     -514     
- Misses        171      696     +525     
+ Partials       89       78      -11
Impacted Files Coverage Δ
optlang/cplex_interface.py 2.13% <0%> (-89.51%) ⬇️
optlang/exceptions.py 88.88% <0%> (-11.12%) ⬇️
optlang/expression_parsing.py 76.82% <0%> (-7.32%) ⬇️
optlang/interface.py 90.11% <0%> (-0.58%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 28656a4...91b43ec. Read the comment docs.

@KristianJensen KristianJensen changed the base branch from master to devel August 7, 2017 12:44
@KristianJensen KristianJensen changed the base branch from devel to bug-fixes August 7, 2017 12:47
@KristianJensen KristianJensen merged commit 8c2c88b into opencobra:bug-fixes Aug 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants