Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions test/Bridges/General/test_bridge_optimizer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,11 @@ function test_issue_453()
MOI.Utilities.loadfromstring!(
bridged_mock,
"""
variables: x
maxobjective: 3.0x
c: 2.0x in Interval(1.0, 4.0)
x in LessThan(1.5)
""",
variables: x
maxobjective: 3.0x
c: 2.0x in Interval(1.0, 4.0)
x in LessThan(1.5)
""",
)
x = MOI.get(bridged_mock, MOI.VariableIndex, "x")
@test isa(x, MOI.VariableIndex)
Expand Down
114 changes: 57 additions & 57 deletions test/FileFormats/LP/test_LP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,21 @@ function test_comprehensive_write()
MOI.Utilities.loadfromstring!(
model,
"""
variables: a, x, y, z
minobjective: x
x >= -1.0
x <= 2.0
y == 3.0
z in Interval(4.0, 5.0)
c5: 1.1x + 0.0 <= 5.1
c6: 1.3x + -1.4 >= -0.1
c7: 1.5a + 1.6 == 0.2
c8: 1.7a + 1.8 in Interval(0.3, 0.4)
x in ZeroOne()
y in Integer()
c11: [x, y, z] in SOS1{Float64}([1.0, 2.0, 3.0])
c12: [x, y, z] in SOS2{Float64}([3.3, 1.1, 2.2])
""",
variables: a, x, y, z
minobjective: x
x >= -1.0
x <= 2.0
y == 3.0
z in Interval(4.0, 5.0)
c5: 1.1x + 0.0 <= 5.1
c6: 1.3x + -1.4 >= -0.1
c7: 1.5a + 1.6 == 0.2
c8: 1.7a + 1.8 in Interval(0.3, 0.4)
x in ZeroOne()
y in Integer()
c11: [x, y, z] in SOS1{Float64}([1.0, 2.0, 3.0])
c12: [x, y, z] in SOS2{Float64}([3.3, 1.1, 2.2])
""",
)
MOI.write_to_file(model, LP_TEST_FILE)
@test read(LP_TEST_FILE, String) ==
Expand Down Expand Up @@ -86,10 +86,10 @@ function test_name_sanitization_start()
MOI.Utilities.loadfromstring!(
model,
"""
variables: x
minobjective: x
c1: 1.0 * x >= -1.0
""",
variables: x
minobjective: x
c1: 1.0 * x >= -1.0
""",
)
x = MOI.get(model, MOI.VariableIndex, "x")
MOI.set(model, MOI.VariableName(), x, starting_letter * "x")
Expand All @@ -113,10 +113,10 @@ function test_name_sanitization_illegal()
MOI.Utilities.loadfromstring!(
model,
"""
variables: x
minobjective: x
c1: 1.0 * x >= -1.0
""",
variables: x
minobjective: x
c1: 1.0 * x >= -1.0
""",
)
x = MOI.get(model, MOI.VariableIndex, "x")
MOI.set(model, MOI.VariableName(), x, "x$(illegal_letter)y")
Expand All @@ -139,10 +139,10 @@ function test_name_sanitization_duplicate()
MOI.Utilities.loadfromstring!(
model,
"""
variables: a, b, c, d
minobjective: a + b + c + d
c1: a + b + c + d >= -1.0
""",
variables: a, b, c, d
minobjective: a + b + c + d
c1: a + b + c + d >= -1.0
""",
)
variables = MOI.get(model, MOI.ListOfVariableIndices())
MOI.set.(model, MOI.VariableName(), variables, ["a[", "a]", "a*", "a^"])
Expand Down Expand Up @@ -181,10 +181,10 @@ function test_name_sanitization_too_long()
MOI.Utilities.loadfromstring!(
model,
"""
variables: abcd, abce
minobjective: abcd + abce
c1: abcd + abce >= -1.0
""",
variables: abcd, abce
minobjective: abcd + abce
c1: abcd + abce >= -1.0
""",
)
MOI.write_to_file(model, LP_TEST_FILE)
@test read(LP_TEST_FILE, String) ==
Expand All @@ -203,9 +203,9 @@ function test_name_sanitization_other()
MOI.Utilities.loadfromstring!(
model,
"""
variables: x
maxobjective: 2.0 * x + -1.0
""",
variables: x
maxobjective: 2.0 * x + -1.0
""",
)
MOI.write_to_file(model, LP_TEST_FILE)
@test read(LP_TEST_FILE, String) ==
Expand All @@ -222,11 +222,11 @@ function test_free_variables()
MOI.Utilities.loadfromstring!(
model,
"""
variables: x, y, z
maxobjective: x
x in ZeroOne()
y in Integer()
""",
variables: x, y, z
maxobjective: x
x in ZeroOne()
y in Integer()
""",
)
MOI.write_to_file(model, LP_TEST_FILE)
@test read(LP_TEST_FILE, String) ==
Expand Down Expand Up @@ -276,9 +276,9 @@ function test_quadratic_objective_diag()
MOI.Utilities.loadfromstring!(
model,
"""
variables: x
minobjective: 1.0*x*x
""",
variables: x
minobjective: 1.0*x*x
""",
)
MOI.write_to_file(model, LP_TEST_FILE)
@test read(LP_TEST_FILE, String) ==
Expand All @@ -296,9 +296,9 @@ function test_quadratic_objective_off_diag()
MOI.Utilities.loadfromstring!(
model,
"""
variables: x, y
minobjective: 1.1 * x + 1.2 * y + 1.5*x*y + 1.3
""",
variables: x, y
minobjective: 1.1 * x + 1.2 * y + 1.5*x*y + 1.3
""",
)
MOI.write_to_file(model, LP_TEST_FILE)
@test read(LP_TEST_FILE, String) ==
Expand All @@ -317,9 +317,9 @@ function test_quadratic_objective_complicated()
MOI.Utilities.loadfromstring!(
model,
"""
variables: x, y
minobjective: 1.1 * x + 1.2 * y + -1.1 * x * x + 1.5*x*y + 1.3
""",
variables: x, y
minobjective: 1.1 * x + 1.2 * y + -1.1 * x * x + 1.5*x*y + 1.3
""",
)
MOI.write_to_file(model, LP_TEST_FILE)
@test read(LP_TEST_FILE, String) ==
Expand All @@ -338,9 +338,9 @@ function test_quadratic_constraint_diag()
MOI.Utilities.loadfromstring!(
model,
"""
variables: x
c: 1.0*x*x <= 1.4
""",
variables: x
c: 1.0*x*x <= 1.4
""",
)
MOI.write_to_file(model, LP_TEST_FILE)
@test read(LP_TEST_FILE, String) ==
Expand All @@ -359,9 +359,9 @@ function test_quadratic_constraint_off_diag()
MOI.Utilities.loadfromstring!(
model,
"""
variables: x, y
c: 1.1 * x + 1.2 * y + 1.5*x*y + 1.3 == 1.5
""",
variables: x, y
c: 1.1 * x + 1.2 * y + 1.5*x*y + 1.3 == 1.5
""",
)
MOI.write_to_file(model, LP_TEST_FILE)
@test read(LP_TEST_FILE, String) ==
Expand All @@ -381,9 +381,9 @@ function test_quadratic_constraint_complicated()
MOI.Utilities.loadfromstring!(
model,
"""
variables: x, y
c: 1.1 * x + 1.2 * y + -1.1 * x * x + 1.5*x*y + 1.3 in Interval(-1.1, 1.4)
""",
variables: x, y
c: 1.1 * x + 1.2 * y + -1.1 * x * x + 1.5*x*y + 1.3 in Interval(-1.1, 1.4)
""",
)
MOI.write_to_file(model, LP_TEST_FILE)
@test read(LP_TEST_FILE, String) ==
Expand Down
104 changes: 52 additions & 52 deletions test/FileFormats/NL/test_read.jl
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,15 @@ function test_parse_O()
write(
io,
"""
O0 0# can stick a comment anywhere
o2
v0 # can stick a comment anywhere
o2
v2
o2
v3
v1
""",
O0 0# can stick a comment anywhere
o2
v0 # can stick a comment anywhere
o2
v2
o2
v3
v1
""",
)
seekstart(io)
NL._parse_section(io, model)
Expand Down Expand Up @@ -226,11 +226,11 @@ function test_parse_x()
write(
io,
"""
x3
0 1.1# can stick a comment anywhere
3 2.2
2 3.3 # can stick a comment anywhere
""",
x3
0 1.1# can stick a comment anywhere
3 2.2
2 3.3 # can stick a comment anywhere
""",
)
seekstart(io)
NL._parse_section(io, model)
Expand All @@ -245,11 +245,11 @@ function test_parse_d()
write(
io,
"""
d3
0 1.1# can stick a comment anywhere
3 2.2
2 3.3 # can stick a comment anywhere
""",
d3
0 1.1# can stick a comment anywhere
3 2.2
2 3.3 # can stick a comment anywhere
""",
)
seekstart(io)
NL._parse_section(io, model)
Expand Down Expand Up @@ -328,10 +328,10 @@ function test_parse_J()
write(
io,
"""
J1 2 # can stick a comment anywhere
2 1.1
3 2.2 # can stick a comment anywhere
""",
J1 2 # can stick a comment anywhere
2 1.1
3 2.2 # can stick a comment anywhere
""",
)
seekstart(io)
NL._parse_section(io, model)
Expand All @@ -350,10 +350,10 @@ function test_parse_J_zeros()
write(
io,
"""
J0 2
0 0
1 0
""",
J0 2
0 0
1 0
""",
)
seekstart(io)
NL._parse_section(io, model)
Expand Down Expand Up @@ -421,10 +421,10 @@ function test_parse_G()
write(
io,
"""
G0 2 # can stick a comment anywhere
2 1.1 # can stick a comment anywhere
3 2.2
""",
G0 2 # can stick a comment anywhere
2 1.1 # can stick a comment anywhere
3 2.2
""",
)
seekstart(io)
NL._parse_section(io, model)
Expand All @@ -441,11 +441,11 @@ function test_parse_G_zeros()
write(
io,
"""
G0 3
0 0
1 0
2 0
""",
G0 3
0 0
1 0
2 0
""",
)
seekstart(io)
NL._parse_section(io, model)
Expand All @@ -461,14 +461,14 @@ function test_parse_O_G()
write(
io,
"""
O0 0
o2
v0
v1
G0 2
0 1.1
1 2.2
""",
O0 0
o2
v0
v1
G0 2
0 1.1
1 2.2
""",
)
seekstart(io)
NL._parse_section(io, model)
Expand All @@ -486,14 +486,14 @@ function test_parse_G_O()
write(
io,
"""
G0 2
0 -1.1
1 2.2e+01
O0 0
o2
v0
v1
""",
G0 2
0 -1.1
1 2.2e+01
O0 0
o2
v0
v1
""",
)
seekstart(io)
NL._parse_section(io, model)
Expand Down
Loading
Loading