Uh oh!
There was an error while loading. Please reload this page.
Improve Mosek interface to select optimal solution - #667
Conversation
FabianHofmann
commented
May 11, 2026
@mgrabovsky thanks for the pr, this is unfortunately something that has to wait for #628 after which this needs a rebase. happy to help at this later point in time. |
f9ed683 to
a2fb478Comparemgrabovsky
commented
May 19, 2026
@FabianHofmann I've rebased the PR on top of master now. Could you please check if it looks good? |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
@mgrabovsky thanks for your PR. It looks quite focused. As i dont use mosek, i cant really replicate the issue, but I had a look and i would suggest the following changes:
|
Mosek can produce two distinct solutions with separate statuses: an interior-point solution (soltype.itr) and a basic solution (soltype.bas) obtained by basis identification (crossover). Previously, linopy's Mosek interface only read the IPM solution. If the IPM terminated with solsta.dual_infeas_cer but crossover then recovers an optimal basic solution, linopy would report infeasible_or_unbounded with Objective: nan and the actual optimal solution would be silently discarded, even though Mosek itself had it. After this change, linopy picks the solution (between bas, itr and itg) with the best score, with the order being solsta.[integer_]optimal > any other defined status > undefined. If both bas and itr are optimal, the itr solution is chosen to preserve backward compatibility with the previous behavior. A similar bug was present in cvxpy (see cvxpy/cvxpy#335), fixed by @aszekMosek in cvxpy/cvxpy#347. Patch co-authored with Claude Opus 4.7. FixesPyPSA#665
mgrabovsky
commented
May 20, 2026
Thanks for the review and tips. I've updated the PR. |
FabianHofmann
left a comment
There was a problem hiding this comment.
looks good, happy to merge after we slightly refactor the tests for maintaining the structure and not bloat the set of flat functions
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Closes#665
Changes proposed in this Pull Request
Mosek can produce two distinct solutions with separate statuses: an interior-point solution (
soltype.itr) and a basic solution (soltype.bas) obtained by basis identification (crossover).Previously, linopy's Mosek interface only read the IPM solution. If the IPM terminated with
solsta.dual_infeas_cerbut crossover then recovered an optimal basic solution, linopy would reportinfeasible_or_unboundedwithObjective: nanand the actual optimal solution would be silently discarded, even though Mosek itself had it.After this change, linopy picks the solution (between
bas,itranditg) with the best score, with the order beingsolsta.[integer_]optimal> any other defined status > undefined. If bothbasanditrare optimal, theitrsolution is chosen to preserve backward compatibility with the previous behavior.This patch was co-authored with Claude Opus 4.7.
Checklist
doc.doc/release_notes.rstof the upcoming release is included.