From 380b6acf9363a19498e5bd4edd9d8c250c8dcfd3 Mon Sep 17 00:00:00 2001 From: kalmar Date: Sat, 11 Feb 2017 13:41:03 +0100 Subject: [PATCH] rework solve_SDP function --- property(T).jl | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/property(T).jl b/property(T).jl index 1fce2f1..3e52fb9 100644 --- a/property(T).jl +++ b/property(T).jl @@ -69,26 +69,22 @@ function create_SDP_problem(matrix_constraints, Δ::GroupAlgebraElement) return m end -function solve_for_property_T{T}(S₁::Vector{Array{T,2}}, solver; verbose=true) +function solve_SDP(sdp_constraints, Δ, solver; verbose=true) + SDP_problem = create_SDP_problem(sdp_constraints, Δ); + verbose && @show solver - Δ, matrix_constraints = prepare_Laplacian_and_constraints(S₁) - - problem = create_SDP_problem(matrix_constraints, Δ); - @show solver - - setsolver(problem, solver); - verbose && @show problem - - solution_status = solve(problem); + JuMP.setsolver(SDP_problem, solver); + verbose && @show SDP_problem + # @time MathProgBase.writeproblem(SDP_problem, "/tmp/SDP_problem") + solution_status = JuMP.solve(SDP_problem); verbose && @show solution_status if solution_status != :Optimal throw(ExceptionError("The solver did not solve the problem successfully!")) else - κ = SL_3ZZ.objVal; - A = getvalue(getvariable(SL_3ZZ, :A));; + κ = SDP_problem.objVal; + A = JuMP.getvalue(JuMP.getvariable(SDP_problem, :A));; end - return κ, A end