mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-11-23 00:10:28 +01:00
rework solve_SDP function
This commit is contained in:
parent
6247f97a56
commit
380b6acf93
@ -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
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user