add warmstarting and simple logging to check_positivity.jl
This commit is contained in:
parent
2e2add905b
commit
f5262ebeea
@ -86,10 +86,6 @@ info("Looking for solution.jld in $fullpath")
|
||||
if !isfile(SOLUTION_FILE)
|
||||
info("solution.jld not found, attempting to recreate one.")
|
||||
|
||||
λ = Ps = ws = nothing
|
||||
|
||||
SDP_problem, varλ, varP = PropertyT.SOS_problem(elt, Δ, orbit_data; upper_bound=LAMBDA)
|
||||
|
||||
begin
|
||||
scs_solver = SCS.SCSSolver(linear_solver=SCS.Direct,
|
||||
eps=1e-12,
|
||||
@ -99,15 +95,31 @@ if !isfile(SOLUTION_FILE)
|
||||
|
||||
JuMP.setsolver(SDP_problem, scs_solver)
|
||||
end
|
||||
|
||||
λ = Ps = ws = nothing
|
||||
const WARMSTART_FILE = joinpath(fullpath, "warmstart.jld")
|
||||
if isfile(WARMSTART_FILE)
|
||||
ws = load(WARMSTART_FILE, "warmstart")
|
||||
end
|
||||
|
||||
SDP_problem, varλ, varP = PropertyT.SOS_problem(elt, Δ, orbit_data; upper_bound=LAMBDA)
|
||||
|
||||
i = 0
|
||||
# for i in 1:6
|
||||
status= :Unknown
|
||||
while status !=:Optimal
|
||||
i += 1
|
||||
status, (λ, Ps, ws) = PropertyT.solve(SDP_problem, varλ, varP, ws);
|
||||
SOLVERLOG_FILE = joinpath(fullpath, "solver_$(now()).log")
|
||||
status, (λ, Ps, ws) = PropertyT.solve(SOLVERLOG_FILE, SDP_problem, varλ, varP, ws);
|
||||
precision = abs(λ - LAMBDA)
|
||||
println("i = $i, \t precision = $precision")
|
||||
|
||||
if all((!isnan).(ws[1]))
|
||||
save(WARMSTART_FILE, "warmstart", ws, "λ", λ, "Ps", Ps)
|
||||
save(WARMSTART_FILE[1:end-4]*"_$(now()).jld", "warmstart", ws, "λ", λ, "Ps", Ps)
|
||||
else
|
||||
warn("No valid solution was saved!")
|
||||
end
|
||||
end
|
||||
|
||||
info("Reconstructing P...")
|
||||
|
Loading…
Reference in New Issue
Block a user