mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-12-26 02:30:29 +01:00
better logging
This commit is contained in:
parent
e23b6a85dc
commit
4bce106c2d
@ -79,12 +79,13 @@ end
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
function warmstart(sett::Settings)
|
function warmstart(sett::Settings)
|
||||||
|
warmstart_fname = filename(sett, :warmstart)
|
||||||
try
|
try
|
||||||
ws = load(filename(sett, :warmstart), "warmstart")
|
ws = load(filename(sett, :warmstart), "warmstart")
|
||||||
@info "Loaded $(filename(sett, :warmstart))."
|
@info "Loaded $warmstart_fname."
|
||||||
return ws
|
return ws
|
||||||
catch
|
catch ex
|
||||||
@info "Couldn't load $(filename(sett, :warmstart))."
|
@warn "$(ex.msg). Not providing a warmstart to the solver."
|
||||||
return nothing
|
return nothing
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -128,10 +129,12 @@ function approximate_by_SOS(sett::Symmetrized,
|
|||||||
|
|
||||||
orbit_data = try
|
orbit_data = try
|
||||||
orbit_data = load(filename(sett, :OrbitData), "OrbitData")
|
orbit_data = load(filename(sett, :OrbitData), "OrbitData")
|
||||||
@info "Loaded Orbit Data"
|
@info "Loaded orbit data."
|
||||||
orbit_data
|
orbit_data
|
||||||
catch
|
catch ex
|
||||||
|
@warn ex.msg
|
||||||
isdefined(parent(orderunit), :basis) || throw("You need to define basis of Group Ring to compute orbit decomposition!")
|
isdefined(parent(orderunit), :basis) || throw("You need to define basis of Group Ring to compute orbit decomposition!")
|
||||||
|
@info "Computing orbit and Wedderburn decomposition..."
|
||||||
orbit_data = OrbitData(parent(orderunit), sett.autS)
|
orbit_data = OrbitData(parent(orderunit), sett.autS)
|
||||||
save(filename(sett, :OrbitData), "OrbitData", orbit_data)
|
save(filename(sett, :OrbitData), "OrbitData", orbit_data)
|
||||||
orbit_data
|
orbit_data
|
||||||
@ -275,26 +278,39 @@ function spectral_gap(sett::Settings)
|
|||||||
isdir(fp) || mkpath(fp)
|
isdir(fp) || mkpath(fp)
|
||||||
|
|
||||||
Δ = try
|
Δ = try
|
||||||
@info "Loading precomputed Δ..."
|
Δ = loadGRElem(filename(sett,:Δ), sett.G)
|
||||||
loadGRElem(filename(sett,:Δ), sett.G)
|
@info "Loaded precomputed Δ."
|
||||||
catch
|
Δ
|
||||||
# compute
|
catch ex
|
||||||
|
@warn ex.msg
|
||||||
|
@info "Computing Δ..."
|
||||||
Δ = Laplacian(sett.S, sett.halfradius)
|
Δ = Laplacian(sett.S, sett.halfradius)
|
||||||
saveGRElem(filename(sett, :Δ), Δ)
|
saveGRElem(filename(sett, :Δ), Δ)
|
||||||
Δ
|
Δ
|
||||||
end
|
end
|
||||||
|
|
||||||
λ, P = try
|
function compute(sett, Δ)
|
||||||
sett.warmstart && error()
|
@info "Computing λ and P..."
|
||||||
load(filename(sett, :solution), "λ", "P")
|
|
||||||
catch
|
|
||||||
λ, P = approximate_by_SOS(sett, Δ^2, Δ;
|
λ, P = approximate_by_SOS(sett, Δ^2, Δ;
|
||||||
solverlog=filename(sett, :solverlog))
|
solverlog=filename(sett, :solverlog))
|
||||||
|
|
||||||
save(filename(sett, :solution), "λ", λ, "P", P)
|
save(filename(sett, :solution), "λ", λ, "P", P)
|
||||||
|
|
||||||
λ < 0 && @warn "Solver did not produce a valid solution!"
|
λ < 0 && @warn "Solver did not produce a valid solution!"
|
||||||
|
return λ, P
|
||||||
|
end
|
||||||
|
|
||||||
|
if sett.warmstart
|
||||||
|
λ, P = compute(sett, Δ)
|
||||||
|
else
|
||||||
|
λ, P =try
|
||||||
|
λ, P = load(filename(sett, :solution), "λ", "P")
|
||||||
|
@info "Loaded existing λ and P."
|
||||||
λ, P
|
λ, P
|
||||||
|
catch ex
|
||||||
|
@warn ex.msg
|
||||||
|
compute(sett, Δ)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
info_strs = ["Numerical metrics of matrix solution:",
|
info_strs = ["Numerical metrics of matrix solution:",
|
||||||
|
Loading…
Reference in New Issue
Block a user