mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-11-30 01:55:28 +01:00
save primal, dual solutions and slack for future warmstart
This commit is contained in:
parent
0d20df8207
commit
da6a2df814
@ -146,7 +146,7 @@ function λandP(name::String, SDP_problem::JuMP.Model, varλ, varP)
|
||||
DefaultFormatter("{date}| {msg}")),
|
||||
"solver_log")
|
||||
|
||||
λ, P = compute_λandP(SDP_problem, varλ, varP)
|
||||
λ, P, warmstart = compute_λandP(SDP_problem, varλ, varP)
|
||||
|
||||
remove_handler(solver_logger, "solver_log")
|
||||
|
||||
@ -155,6 +155,8 @@ function λandP(name::String, SDP_problem::JuMP.Model, varλ, varP)
|
||||
if λ > 0
|
||||
save(λ_fname, "λ", λ)
|
||||
save(P_fname, "P", P)
|
||||
@show warmstart[1]
|
||||
save(joinpath(name, "warmstart.jld"), "warmstart", warmstart)
|
||||
else
|
||||
throw(ErrorException("Solver did not produce a valid solution!: λ = $λ"))
|
||||
end
|
||||
@ -162,7 +164,7 @@ function λandP(name::String, SDP_problem::JuMP.Model, varλ, varP)
|
||||
|
||||
end
|
||||
|
||||
function compute_λandP(m, varλ, varP)
|
||||
function compute_λandP(m, varλ, varP; warmstart=nothing)
|
||||
λ = 0.0
|
||||
P = nothing
|
||||
while λ == 0.0
|
||||
@ -170,11 +172,16 @@ function compute_λandP(m, varλ, varP)
|
||||
solve_SDP(m)
|
||||
λ = JuMP.getvalue(varλ)
|
||||
P = JuMP.getvalue(varP)
|
||||
|
||||
p_sol = m.internalModel.primal_sol
|
||||
d_sol = m.internalModel.dual_sol
|
||||
s = m.internalModel.slack
|
||||
|
||||
catch y
|
||||
warn(solver_logger, y)
|
||||
end
|
||||
end
|
||||
return λ, P
|
||||
return λ, P, (p_sol, d_sol, s)
|
||||
end
|
||||
|
||||
Kazhdan_from_sgap(λ,N) = sqrt(2*λ/N)
|
||||
|
Loading…
Reference in New Issue
Block a user