Skip to content

[SDPA] No scaling of off-diagonal coefficient #1076

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 1 commit into from
Apr 18, 2020
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
15 changes: 2 additions & 13 deletions src/FileFormats/SDPA/SDPA.jl
Original file line number Diff line number Diff line change
Expand Up @@ -173,17 +173,11 @@ function Base.write(io::IO, model::Model{T}) where {T}
function _print_entry(matrix, block, psd, k, value)
if psd
row, col = index_map[k]
if row == col
entry = value
else
entry = value / 2
end
else
row = k
col = k
entry = value
end
println(io, matrix, ' ', block, ' ', row, ' ', col, ' ', entry)
println(io, matrix, ' ', block, ' ', row, ' ', col, ' ', value)
end
function _print_constraint(block, psd, ci::MOI.ConstraintIndex)
func = MOI.Utilities.canonical(con_function(ci))
Expand Down Expand Up @@ -314,12 +308,7 @@ function Base.read!(io::IO, model::Model{T}) where T
end
k = row
end
entry = parse(T, values[5])
if col == row
coef = entry
else
coef = entry * 2
end
coef = parse(T, values[5])
if iszero(matrix)
if !iszero(coef)
funcs[block].constants[k] -= coef
Expand Down
4 changes: 2 additions & 2 deletions test/FileFormats/SDPA/SDPA.jl
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,12 @@ example_models = [
variables: x, y
minobjective: 10x + 20y
c1: [x + -1, 0, x + -2] in PositiveSemidefiniteConeTriangle(2)
c2: [5y + -3, 4y, 6y + -4] in PositiveSemidefiniteConeTriangle(2)
c2: [5y + -3, 2y, 6y + -4] in PositiveSemidefiniteConeTriangle(2)
"""),
("example_B.sdpa", """
variables: x
minobjective: 1x
c1: [0, 2x + -2, 0] in PositiveSemidefiniteConeTriangle(2)
c1: [0, 1x + -1, 0] in PositiveSemidefiniteConeTriangle(2)
"""),
]
@testset "Read and write/read $model_name" for (model_name, model_string) in example_models
Expand Down