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 convert(::VariableIndex, ::ScalarAffineFunction) with zero coefficients #2173

Merged
merged 3 commits into from
May 15, 2023

Conversation

odow
Copy link
Member

@odow odow commented May 14, 2023

Showed up in #2172

MosekTools fails tests because of:

image

It's pretty reasonable that we should skip zero terms when converting.

Check that it fixes Mosek

@odow odow mentioned this pull request May 14, 2023
4 tasks
@odow
Copy link
Member Author

odow commented May 14, 2023

Hmm. I don't think I have solver-tests setup correctly. MosekTools doesn't seem to have installed the branch of MOI.

@odow
Copy link
Member Author

odow commented May 15, 2023

Okay, this fixes that particular issue. There's an unrelated problem with NormCone: https://github.com/jump-dev/MathOptInterface.jl/actions/runs/4975191716/jobs/8902130828

@blegat
Copy link
Member

blegat commented May 15, 2023

I often wanted to to this but usually, this is a sign you should use convert_approx

@odow
Copy link
Member Author

odow commented May 15, 2023

I could expect convert_approx to handle something like 0.5x + 0.5x. But skipping zeros here seems like a low bar. It still requires exactly one non-zero with a coefficient of 1.0.

@odow odow merged commit 61067b7 into master May 15, 2023
@odow odow deleted the od/fix-convert branch May 15, 2023 19:12
@blegat
Copy link
Member

blegat commented May 16, 2023

Yes, what I meant is that you probably also want to use convert_approx in that bridge if a solver returns something like 1e-10 * x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants