1
0
mirror of https://github.com/kalmarek/PropertyT.jl.git synced 2024-11-26 00:55:27 +01:00

save warmstart in time-stamped file;

don't override warmstart.jld if there are any nans in the solution (e.g.
solver was interrupted)
This commit is contained in:
kalmarek 2019-04-02 18:46:55 +02:00
parent cfb3eaf358
commit 6fde981b32
No known key found for this signature in database
GPG Key ID: 8BF1A3855328FC15

View File

@ -49,7 +49,7 @@ suffix(s::Settings) = "$(s.upper_bound)"
prepath(s::Settings) = prefix(s) prepath(s::Settings) = prefix(s)
fullpath(s::Settings) = joinpath(prefix(s), suffix(s)) fullpath(s::Settings) = joinpath(prefix(s), suffix(s))
filename(sett::Settings, s::Symbol) = filename(sett, Val{s}) filename(sett::Settings, s::Symbol; kwargs...) = filename(sett, Val{s}; kwargs...)
filename(sett::Settings, ::Type{Val{:fulllog}}) = filename(sett::Settings, ::Type{Val{:fulllog}}) =
joinpath(fullpath(sett), "full_$(string(now())).log") joinpath(fullpath(sett), "full_$(string(now())).log")
@ -61,10 +61,16 @@ filename(sett::Settings, ::Type{Val{:Δ}}) =
filename(sett::Settings, ::Type{Val{:OrbitData}}) = filename(sett::Settings, ::Type{Val{:OrbitData}}) =
joinpath(prepath(sett), "OrbitData.jld") joinpath(prepath(sett), "OrbitData.jld")
filename(sett::Settings, ::Type{Val{:warmstart}}) =
joinpath(fullpath(sett), "warmstart.jld")
filename(sett::Settings, ::Type{Val{:solution}}) = filename(sett::Settings, ::Type{Val{:solution}}) =
joinpath(fullpath(sett), "solution.jld") joinpath(fullpath(sett), "solution.jld")
function filename(sett::Settings, ::Type{Val{:warmstart}}; date=false)
if date
return joinpath(fullpath(sett), "warmstart_$(Dates.now()).jld")
else
return joinpath(fullpath(sett), "warmstart.jld")
end
end
############################################################################### ###############################################################################
# #
@ -95,8 +101,14 @@ function computeλandP(sett::Naive, Δ::GroupRingElem;
P = value.(SDP_problem[:P]) P = value.(SDP_problem[:P])
λ = value(SDP_problem[]) λ = value(SDP_problem[])
save(filename(sett, :warmstart), if any(isnan.(P))
"warmstart", (ws.primal, ws.dual, ws.slack), "P", P, "λ", λ) @warn "The solution seems to contain NaNs. Not overriding warmstart.jld"
else
save(filename(sett, :warmstart), "warmstart", (ws.primal, ws.dual, ws.slack), "P", P, "λ", λ)
end
save(filename(sett, :warmstart, date=true),
"warmstart", (ws.primal, ws.dual, ws.slack), "P", P, "λ", λ)
return λ, P return λ, P
end end
@ -123,8 +135,14 @@ function computeλandP(sett::Symmetrized, Δ::GroupRingElem;
λ = value(SDP_problem[]) λ = value(SDP_problem[])
Ps = [value.(P) for P in varP] Ps = [value.(P) for P in varP]
save(filename(sett, :warmstart), if any(any(isnan.(P)) for P in Ps)
"warmstart", (ws.primal, ws.dual, ws.slack), "Ps", Ps, "λ", λ) @warn "The solution seems to contain NaNs. Not overriding warmstart.jld"
else
save(filename(sett, :warmstart), "warmstart", (ws.primal, ws.dual, ws.slack), "Ps", Ps, "λ", λ)
end
save(filename(sett, :warmstart, date=true),
"warmstart", (ws.primal, ws.dual, ws.slack), "Ps", Ps, "λ", λ)
@info "Reconstructing P..." @info "Reconstructing P..."
@time P = reconstruct(Ps, orbit_data) @time P = reconstruct(Ps, orbit_data)