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

fix(core): catch missing reduced costs and shadow prices. #1383

Merged
merged 2 commits into from
Apr 8, 2024

Conversation

Palaract
Copy link
Contributor

@Palaract Palaract commented Mar 19, 2024

This simple code change in the get_solution function in core/solution.py catches all exceptions regarding reduced costs and shadow prices not being available. If the latest change in the downstream dependency optlang (opencobra/optlang#259) is used here, then the general exception can be replaced with a ValueError which would be more specific and still solver agnostic. Still, Exception should catch GurobiErrors as well as ValueErrors and only in the case where those RC and Pi variables are actually accessed, therefore I don't deem it problematic if it would stay like that.

I ran the tests via tox and also tested both minimal working examples of issue numbers #1381 and #1372, both are now working just fine.

Copy link
Member

@cdiener cdiener left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay. That makes sense to me. Can you also add it to the release notes?

@Palaract
Copy link
Contributor Author

Palaract commented Apr 5, 2024

I hope this is concise and correct enough! Thank you for looking into this :)

@cdiener cdiener merged commit 0eb90d4 into opencobra:devel Apr 8, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants