rework solve_SDP function

This commit is contained in:
kalmar 2017-02-11 13:41:03 +01:00
parent 6247f97a56
commit 380b6acf93
1 changed files with 9 additions and 13 deletions

View File

@ -69,26 +69,22 @@ function create_SDP_problem(matrix_constraints, Δ::GroupAlgebraElement)
return m return m
end 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₁) JuMP.setsolver(SDP_problem, solver);
verbose && @show SDP_problem
problem = create_SDP_problem(matrix_constraints, Δ); # @time MathProgBase.writeproblem(SDP_problem, "/tmp/SDP_problem")
@show solver solution_status = JuMP.solve(SDP_problem);
setsolver(problem, solver);
verbose && @show problem
solution_status = solve(problem);
verbose && @show solution_status verbose && @show solution_status
if solution_status != :Optimal if solution_status != :Optimal
throw(ExceptionError("The solver did not solve the problem successfully!")) throw(ExceptionError("The solver did not solve the problem successfully!"))
else else
κ = SL_3ZZ.objVal; κ = SDP_problem.objVal;
A = getvalue(getvariable(SL_3ZZ, :A));; A = JuMP.getvalue(JuMP.getvariable(SDP_problem, :A));;
end end
return κ, A return κ, A
end end