dandxy89 / lp_parser_rs

Rust LP file Parser
Apache License 2.0
3 stars 1 forks source link

Blank lines aren't ignored #25

Closed ahenshaw closed 6 months ago

ahenshaw commented 6 months ago

In this simple LP file

\ LP format example

Minimize
obj:  x + 10 y
Subject To
r01:  x + y  >= 1
Binaries
 x y
End

if I add a blank line before "Binaries", then the Binaries section is not read. Looking at the Pest file, it seems that blank lines aren't handled as specified in the IBM specs.

dandxy89 commented 6 months ago

Thanks for all the feedback much appreciated.

I'll take a look at all three in the morning.

ahenshaw commented 6 months ago

Thanks! And thanks for developing this library!

I'm using it in my project: https://github.com/ahenshaw/balas


From: Dan @.> Sent: Tuesday, January 2, 2024 2:52:58 PM To: dandxy89/lp_parser_rs @.> Cc: Andrew Henshaw @.>; Author @.> Subject: Re: [dandxy89/lp_parser_rs] Blank lines aren't ignored (Issue #25)

Thanks for all the feedback much appreciated.

I'll take a look at all three in the morning.

— Reply to this email directly, view it on GitHubhttps://github.com/dandxy89/lp_parser_rs/issues/25#issuecomment-1874477211, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAOZY2WGXHQTQROHWAXVMFLYMRQRVAVCNFSM6AAAAABBKOOSSOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZUGQ3TOMRRGE. You are receiving this because you authored the thread.Message ID: @.***>

ahenshaw commented 6 months ago

I don't think this is fixed everywhere. The specific example that I gave above is fixed, but if I add the blank line after "Binaries", then it doesn't work. My understanding of the spec is that blank lines should be ignored everywhere.

ahenshaw commented 6 months ago

Also, I believe comments should be more universally allowed. In the example below, I wanted to comment out two constraints, but the parser gives this error:```

Caused by: --> 4:1 4 \ c001: - 2 x1 + 6 x2 - 3 x3 + 4 x4 + 1 x5 - 2 x6 >= 2 ^---
  = expected CONSTRAINT

Minimize obj: 3x1 + 5x2 + 6x3 + 9x4 + 10x5 + 10x6 Subject To \ c001: - 2 x1 + 6 x2 - 3 x3 + 4 x4 + 1 x5 - 2 x6 >= 2 \ c002: - 5 x1 - 3 x2 + 1 x3 + 3 x4 - 2 x5 + 1 x6 >= -2 c003: 5 x1 - 1 x2 + 4 x3 - 2 x4 + 2 x5 - 1 x6 >= 3 Binaries x1 x2 x3 x4 x5 x6 End

dandxy89 commented 6 months ago

Appreciate all the feedback. Let me take another look at this tonight.

ahenshaw commented 6 months ago

Blank lines everywhere seem to work properly. However, still can't put comments everywhere. I believe that is the last issue that I've run across. Great job on this!

dandxy89 commented 6 months ago

I'm not going to have any time this evening to look into this.

Will take a look at this tomorrow

dandxy89 commented 6 months ago

@ahenshaw, could you give it another shot? If it doesn't work out, could you share examples of what's not functioning properly?

Would you mind pointing me to the repository/project you're working on?

ahenshaw commented 6 months ago

This passes all of the tests that I have. Great job! My repo is https://github.com/ahenshaw/balas

dandxy89 commented 6 months ago

Thanks for sharing - will review it over the weekend and see if there is anything I can do in lp_parser that could assist with the work you're doing over there.