mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-11-29 17:50: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:
parent
cfb3eaf358
commit
6fde981b32
@ -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,11 +61,17 @@ 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
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#
|
#
|
||||||
# λandP
|
# λandP
|
||||||
@ -95,7 +101,13 @@ 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))
|
||||||
|
@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, "λ", λ)
|
"warmstart", (ws.primal, ws.dual, ws.slack), "P", P, "λ", λ)
|
||||||
|
|
||||||
return λ, P
|
return λ, P
|
||||||
@ -123,7 +135,13 @@ 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)
|
||||||
|
@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, "λ", λ)
|
"warmstart", (ws.primal, ws.dual, ws.slack), "Ps", Ps, "λ", λ)
|
||||||
|
|
||||||
@info "Reconstructing P..."
|
@info "Reconstructing P..."
|
||||||
|
Loading…
Reference in New Issue
Block a user