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
4 changes: 2 additions & 2 deletions src/FileFormats/SDPA/SDPA.jl
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ function Base.write(io::IO, model::Model{T}) where {T}
F0 = MOI.constant(func)
for k in eachindex(F0)
if !iszero(F0[k])
_print_entry(0, block, psd, k, F0[k])
_print_entry(0, block, psd, k, -F0[k])
end
end
for term in func.terms
Expand Down Expand Up @@ -322,7 +322,7 @@ function Base.read!(io::IO, model::Model{T}) where T
end
if iszero(matrix)
if !iszero(coef)
funcs[block].constants[k] += coef
funcs[block].constants[k] -= coef
end
else
if !iszero(coef)
Expand Down
6 changes: 3 additions & 3 deletions test/FileFormats/SDPA/SDPA.jl
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,13 @@ example_models = [
("example_A.sdpa", """
variables: x, y
minobjective: 10x + 20y
c1: [x + 1, 0, x + 2] in PositiveSemidefiniteConeTriangle(2)
c2: [5y + 3, 4y, 6y + 4] in PositiveSemidefiniteConeTriangle(2)
c1: [x + -1, 0, x + -2] in PositiveSemidefiniteConeTriangle(2)
c2: [5y + -3, 4y, 6y + -4] in PositiveSemidefiniteConeTriangle(2)
"""),
("example_B.sdpa", """
variables: x
minobjective: 1x
c1: [0, 2x + 2, 0] in PositiveSemidefiniteConeTriangle(2)
c1: [0, 2x + -2, 0] in PositiveSemidefiniteConeTriangle(2)
"""),
]
@testset "Read and write/read $model_name" for (model_name, model_string) in example_models
Expand Down