mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-12-02 10:26:27 +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}")),
|
DefaultFormatter("{date}| {msg}")),
|
||||||
"solver_log")
|
"solver_log")
|
||||||
|
|
||||||
λ, P = compute_λandP(SDP_problem, varλ, varP)
|
λ, P, warmstart = compute_λandP(SDP_problem, varλ, varP)
|
||||||
|
|
||||||
remove_handler(solver_logger, "solver_log")
|
remove_handler(solver_logger, "solver_log")
|
||||||
|
|
||||||
@ -155,6 +155,8 @@ function λandP(name::String, SDP_problem::JuMP.Model, varλ, varP)
|
|||||||
if λ > 0
|
if λ > 0
|
||||||
save(λ_fname, "λ", λ)
|
save(λ_fname, "λ", λ)
|
||||||
save(P_fname, "P", P)
|
save(P_fname, "P", P)
|
||||||
|
@show warmstart[1]
|
||||||
|
save(joinpath(name, "warmstart.jld"), "warmstart", warmstart)
|
||||||
else
|
else
|
||||||
throw(ErrorException("Solver did not produce a valid solution!: λ = $λ"))
|
throw(ErrorException("Solver did not produce a valid solution!: λ = $λ"))
|
||||||
end
|
end
|
||||||
@ -162,7 +164,7 @@ function λandP(name::String, SDP_problem::JuMP.Model, varλ, varP)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function compute_λandP(m, varλ, varP)
|
function compute_λandP(m, varλ, varP; warmstart=nothing)
|
||||||
λ = 0.0
|
λ = 0.0
|
||||||
P = nothing
|
P = nothing
|
||||||
while λ == 0.0
|
while λ == 0.0
|
||||||
@ -170,11 +172,16 @@ function compute_λandP(m, varλ, varP)
|
|||||||
solve_SDP(m)
|
solve_SDP(m)
|
||||||
λ = JuMP.getvalue(varλ)
|
λ = JuMP.getvalue(varλ)
|
||||||
P = JuMP.getvalue(varP)
|
P = JuMP.getvalue(varP)
|
||||||
|
|
||||||
|
p_sol = m.internalModel.primal_sol
|
||||||
|
d_sol = m.internalModel.dual_sol
|
||||||
|
s = m.internalModel.slack
|
||||||
|
|
||||||
catch y
|
catch y
|
||||||
warn(solver_logger, y)
|
warn(solver_logger, y)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return λ, P
|
return λ, P, (p_sol, d_sol, s)
|
||||||
end
|
end
|
||||||
|
|
||||||
Kazhdan_from_sgap(λ,N) = sqrt(2*λ/N)
|
Kazhdan_from_sgap(λ,N) = sqrt(2*λ/N)
|
||||||
|
Loading…
Reference in New Issue
Block a user