Skip to content

[FileFormats.LP] fix new lines in middle of quadratic objective - #2184

Merged
odow merged 3 commits into
masterfrom
od/fix-quadratic-newlinne
Jun 1, 2023
Merged

odow merged 3 commits into
masterfrom
od/fix-quadratic-newlinne

Conversation

@odow

@odow odow commented May 31, 2023

Copy link
Copy Markdown
Member

Closes #2181

cc @inversed-ru can you try this branch? You can install it with ] add MathOptInterface#od/fix-quadratic-newlinne

@inversed-ru

Copy link
Copy Markdown

Just tested this fix on ~100 QPLIB instances and got no objective value inconsistencies. I did run into a different issue though: some instances aren't loading with "Unable to parse bound" error. For example, instance 3533 throws:
Unable to parse bound: 0.1 <= x26 <= 3.4 -0.35 <= x27 <= 0.35 -0.35 <= x28 <= 0.35

@odow

odow commented May 31, 2023

Copy link
Copy Markdown
Member Author

Ah. Now I remember the problem... let me take another attempt.

@odow

odow commented May 31, 2023 •

Copy link
Copy Markdown
Member Author

Try now wait a bit.

julia> model = MOI.FileFormats.LP.Model()
A .LP-file model

julia> MOI.read_from_file(model, "/Users/Oscar/Downloads/QPLIB_3533.lp")

julia> print(model)
Minimize ScalarAffineFunction{Float64}:
... lots of stuff ...

The LP file reader really needs to be re-written with an explicit tokenizer. it currently works by parsing line by line, and then we get complications when the file breaks up things over multiple lines in an inconsistent manner.

@odow
odow merged commit 9019dae into master Jun 1, 2023
@odow
odow deleted the od/fix-quadratic-newlinne branch June 1, 2023 01:24
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.

FileFormats/LP: read_from_file returns incorrect quadratic terms

2 participants