Skip to content

Commit 8a65679

Browse files
authored
Merge pull request #1076 from JuliaOpt/bl/no_scale
[SDPA] No scaling of off-diagonal coefficient
2 parents 46641b6 + 7ae85d2 commit 8a65679

File tree

2 files changed

+4
-15
lines changed

2 files changed

+4
-15
lines changed

src/FileFormats/SDPA/SDPA.jl

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -173,17 +173,11 @@ function Base.write(io::IO, model::Model{T}) where {T}
173173
function _print_entry(matrix, block, psd, k, value)
174174
if psd
175175
row, col = index_map[k]
176-
if row == col
177-
entry = value
178-
else
179-
entry = value / 2
180-
end
181176
else
182177
row = k
183178
col = k
184-
entry = value
185179
end
186-
println(io, matrix, ' ', block, ' ', row, ' ', col, ' ', entry)
180+
println(io, matrix, ' ', block, ' ', row, ' ', col, ' ', value)
187181
end
188182
function _print_constraint(block, psd, ci::MOI.ConstraintIndex)
189183
func = MOI.Utilities.canonical(con_function(ci))
@@ -314,12 +308,7 @@ function Base.read!(io::IO, model::Model{T}) where T
314308
end
315309
k = row
316310
end
317-
entry = parse(T, values[5])
318-
if col == row
319-
coef = entry
320-
else
321-
coef = entry * 2
322-
end
311+
coef = parse(T, values[5])
323312
if iszero(matrix)
324313
if !iszero(coef)
325314
funcs[block].constants[k] -= coef

test/FileFormats/SDPA/SDPA.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,12 +194,12 @@ example_models = [
194194
variables: x, y
195195
minobjective: 10x + 20y
196196
c1: [x + -1, 0, x + -2] in PositiveSemidefiniteConeTriangle(2)
197-
c2: [5y + -3, 4y, 6y + -4] in PositiveSemidefiniteConeTriangle(2)
197+
c2: [5y + -3, 2y, 6y + -4] in PositiveSemidefiniteConeTriangle(2)
198198
"""),
199199
("example_B.sdpa", """
200200
variables: x
201201
minobjective: 1x
202-
c1: [0, 2x + -2, 0] in PositiveSemidefiniteConeTriangle(2)
202+
c1: [0, 1x + -1, 0] in PositiveSemidefiniteConeTriangle(2)
203203
"""),
204204
]
205205
@testset "Read and write/read $model_name" for (model_name, model_string) in example_models

0 commit comments

Comments
 (0)