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)
|
if !isfile(SOLUTION_FILE)
|
||||||
info("solution.jld not found, attempting to recreate one.")
|
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
|
begin
|
||||||
scs_solver = SCS.SCSSolver(linear_solver=SCS.Direct,
|
scs_solver = SCS.SCSSolver(linear_solver=SCS.Direct,
|
||||||
eps=1e-12,
|
eps=1e-12,
|
||||||
@ -100,14 +96,30 @@ if !isfile(SOLUTION_FILE)
|
|||||||
JuMP.setsolver(SDP_problem, scs_solver)
|
JuMP.setsolver(SDP_problem, scs_solver)
|
||||||
end
|
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
|
i = 0
|
||||||
# for i in 1:6
|
# for i in 1:6
|
||||||
status= :Unknown
|
status= :Unknown
|
||||||
while status !=:Optimal
|
while status !=:Optimal
|
||||||
i += 1
|
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)
|
precision = abs(λ - LAMBDA)
|
||||||
println("i = $i, \t precision = $precision")
|
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
|
end
|
||||||
|
|
||||||
info("Reconstructing P...")
|
info("Reconstructing P...")
|
||||||
|
Loading…
Reference in New Issue
Block a user