From 7ae85d28542360fe5eb81d2aa3903acd66fe22a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Legat?= Date: Fri, 17 Apr 2020 23:16:40 +0200 Subject: [PATCH] [SDPA] No scaling of off-diagonal coefficient --- src/FileFormats/SDPA/SDPA.jl | 15 ++------------- test/FileFormats/SDPA/SDPA.jl | 4 ++-- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/src/FileFormats/SDPA/SDPA.jl b/src/FileFormats/SDPA/SDPA.jl index 2fffbe650e..01e46a74c3 100644 --- a/src/FileFormats/SDPA/SDPA.jl +++ b/src/FileFormats/SDPA/SDPA.jl @@ -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)) @@ -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 diff --git a/test/FileFormats/SDPA/SDPA.jl b/test/FileFormats/SDPA/SDPA.jl index 3827bfd113..f3cfb4cae2 100644 --- a/test/FileFormats/SDPA/SDPA.jl +++ b/test/FileFormats/SDPA/SDPA.jl @@ -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