-
Notifications
You must be signed in to change notification settings - Fork 92
Add LP Base.read! and tests #1713
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
9f9a65a
Add LP read! and tests
guilhermebodin 130c917
[ci skip] Fix tests on julia 1.0 by eliminating `contains`
guilhermebodin 4614395
Add more tests
guilhermebodin b3eb7a7
Update src/FileFormats/LP/LP.jl
odow e29317a
Update src/FileFormats/LP/LP.jl
odow b340ce3
change lowercase and separate tests
guilhermebodin 1e42682
Update to implementation without big cache
guilhermebodin e0079d5
fix formatting
guilhermebodin 84ac9df
fix the performance of functions of LP read
guilhermebodin 7d7983a
fix tests
guilhermebodin d0ebf4e
Add more tests
guilhermebodin 796e642
fix isnothing for julia 1.0
guilhermebodin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
max | ||
obj: 1 x | ||
Subject To | ||
Bounds | ||
x free | ||
End | ||
C: 1 x <= 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
\ File: lo1.lp | ||
maximize | ||
obj: 3 x1 + x2 + 5 x3 + x4 | ||
subject to | ||
c1: 3 x1 + x2 + 2 x3 = 30 | ||
c2: 2 x1 + x2 + 3 x3 + x4 >= 15 | ||
c3: 2 x2 + 3 x4 <= 25 | ||
bounds | ||
0 <= x1 <= +infinity | ||
0 <= x2 <= 10 | ||
0 <= x3 <= +infinity | ||
0 <= x4 <= +infinity | ||
end |
13 changes: 13 additions & 0 deletions
13
test/FileFormats/LP/models/invalid_affine_term_constraint.lp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
\ File: lo1.lp | ||
maximize | ||
obj: 3 x1 + x2 + 5 x3 + x4 | ||
subject to | ||
c1: 3 x1 + x2 + 2 x3 = 30 | ||
c2: 2 x1 + x2 + - 3 x3 + x4 >= 15 | ||
c3: 2 x2 + 3 x4 <= 25 | ||
bounds | ||
0 <= x1 <= +infinity | ||
0 <= x2 <= 10 | ||
0 <= x3 <= +infinity | ||
0 <= x4 <= +infinity | ||
end |
13 changes: 13 additions & 0 deletions
13
test/FileFormats/LP/models/invalid_affine_term_objective.lp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
\ File: lo1.lp | ||
maximize | ||
obj: 3 x1 + + x2 + 5 x3 + x4 | ||
subject to | ||
c1: 3 x1 + x2 + 2 x3 = 30 | ||
c2: 2 x1 + x2 + 3 x3 + x4 >= 15 | ||
c3: 2 x2 + 3 x4 <= 25 | ||
bounds | ||
0 <= x1 <= +infinity | ||
0 <= x2 <= 10 | ||
0 <= x3 <= +infinity | ||
0 <= x4 <= +infinity | ||
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
\ File: lo1.lp | ||
maximize | ||
obj: 3 x1 + x2 + 5 x3 + x4 | ||
subject to | ||
c1: 3 x1 + x2 + 2 x3 = 30 | ||
c2: 2 x1 + x2 + 3 x3 + x4 >= 15 | ||
c3: 2 x2 + 3 x4 <= 25 | ||
bounds | ||
0 <= x1 <= +infinity | ||
0 >= x2 <= 10 | ||
0 <= x3 <= +infinity | ||
0 <= x4 <= +infinity | ||
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
\ File: lo1.lp | ||
maximize | ||
obj: 3 x1 + x2 + 5 x3 + x4 | ||
subject to | ||
c1: 3 x1 + x2 + 2 x3 = 30 | ||
c2: 2 x1 + x2 + c2: + 3 x3 + x4 >= 15 | ||
c3: 2 x2 + 3 x4 <= 25 | ||
bounds | ||
0 <= x1 <= +infinity | ||
0 <= x2 <= 10 | ||
0 <= x3 <= +infinity | ||
0 <= x4 <= +infinity | ||
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
Maximize | ||
obj: -1 V4 + 1 V5 | ||
Subject To | ||
CON1: 1 V1 >= 0.0 | ||
CON2: 1 V2 >= 2.0 | ||
CON3: 1 V3 <= 2.5 | ||
CON4: 1 V5 + 1 V6 + 1 V7 <= 1.0 | ||
csos1: S1:: V1:1 V3:2 V5:3 | ||
csos2: S2:: | ||
Bounds | ||
-inf <= V1 <= 3 | ||
-inf <= V2 <= 3 | ||
-inf <= V3 <= 3 | ||
5.5 <= V4 <= +inf | ||
0 <= V5 <= 1 | ||
0 <= V6 <= 1 | ||
0 <= V7 <= 1 | ||
0 <= V8 <= 1 | ||
General | ||
V4 | ||
Binary | ||
V8 | ||
End |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
Maximize | ||
obj: -1 V4 + 1 V5 | ||
Subject To | ||
CON1: 1 V1 >= 0.0 | ||
CON2: 1 V2 >= 2.0 | ||
CON3: 1 V3 <= 2.5 | ||
CON4: 1 V5 + 1 V6 + 1 V7 <= 1.0 | ||
csos1: S1:: V1:1 V3:2 V5:3 | ||
csos2: S3:: V2:2 V4:1 V5:2.5 | ||
Bounds | ||
-inf <= V1 <= 3 | ||
-inf <= V2 <= 3 | ||
-inf <= V3 <= 3 | ||
5.5 <= V4 <= +inf | ||
0 <= V5 <= 1 | ||
0 <= V6 <= 1 | ||
0 <= V7 <= 1 | ||
0 <= V8 <= 1 | ||
General | ||
V4 | ||
Binary | ||
V8 | ||
End |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
\ File: lo1.lp | ||
maximize | ||
obj: 3 1x1 + x2 + 5 x3 + x4 | ||
subject to | ||
c1: 3 x1 + x2 + 2 x3 = 30 | ||
c2: 2 x1 + x2 + 3 x3 + x4 >= 15 | ||
c3: 2 x2 + 3 x4 <= 25 | ||
bounds | ||
0 <= x1 <= +infinity | ||
0 <= x2 <= 10 | ||
0 <= x3 <= +infinity | ||
0 <= x4 <= +infinity | ||
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
Maximize | ||
obj: -1 V4 + 1 V5 | ||
Subject To | ||
CON1: 1 V1 >= 0.0 | ||
CON2: 1 V2 >= 2.0 | ||
CON3: 1 V3 <= 2.5 | ||
CON4: 1 V5 + 1 V6 + 1 V7 <= 1.0 | ||
csos1: S1:: V1:1 V3:2 V5:3 | ||
csos2: S2:: V2:2 V4:1 V5:2.5 | ||
Bounds | ||
-inf <= V1 <= 3 | ||
-inf <= V2 <= 3 | ||
-inf <= V3 <= 3 | ||
5.5 <= V4 <= +inf | ||
0 <= V5 <= 1 | ||
0 <= V6 <= 1 | ||
0 <= V7 <= 1 | ||
0 <= V8 <= 1 | ||
General | ||
V4 | ||
Binary | ||
V8 | ||
End |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
\ a comment to begin with | ||
\ weirdly, V ar4 and Va r4 are the same variable... | ||
\ we're going to disallow this and say the file is corrupt | ||
\ its a terrible idea | ||
Max \ this problem is a maximisation! | ||
|
||
obj: -1 Var4 | ||
+ 1 V5 | ||
Subject To | ||
CON1: 1 V1 >= 0.0 | ||
1 V2 >= 2.0 \ not named | ||
CON3: 1 V3 <= 2.5 | ||
CON4: 1 V5 + 1 V6 \ split constraint. we know it hasn't ended as missing operator | ||
+ 1 V7 <= 1.0 | ||
Bounds | ||
-inf <= V1 <= 3 | ||
V2 <= 3 | ||
V3 >= -3 | ||
5.5 <= Var4 <= +inf | ||
V5 = 1 \ fixed variable | ||
|
||
V6 free | ||
0 <= V7 < 1 \ stupidly allow < as <= | ||
0 <= V8 <= 1 | ||
General | ||
Var4 V5 \ integer variables can be listed (MOSEK) | ||
V6 \ or each new line | ||
Binary | ||
V8 | ||
End |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Minimize | ||
obj: - 2 - 1 V4 + 1 V5 + 3 + 2 - 0.5 | ||
Subject To | ||
CON1: 1 V1 >= 0.0 | ||
CON2: 1 V2 >= 2.0 | ||
CON3: 1 V3 <= 2.5 | ||
CON4: 1 V5 + 1 V6 + 1 V7 <= 1.0 | ||
Bounds | ||
-inf <= V1 <= 3 | ||
-inf <= V2 <= 3 | ||
-inf <= V3 <= 3 | ||
5.5 <= V4 <= +inf | ||
0 <= V5 <= 1 | ||
0 <= V6 <= 1 | ||
0 <= V7 <= 1 | ||
V8 <= -3 | ||
General | ||
V4 | ||
Binary | ||
V8 | ||
End |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.