last minute functional changes

This commit is contained in:
kalmarek 2018-11-24 13:58:49 +01:00
parent 9fc23c43d7
commit 8666cc6b2c

View File

@ -129,40 +129,48 @@ orbit_data = PropertyT.decimate(orbit_data);
elt = adj+3op; elt = adj+3op;
SDP_problem, varλ, varP = PropertyT.SOS_problem(elt, Δ, orbit_data; upper_bound=sett.upper_bound) const SOLUTION_FILE = PropertyT.filename(sett, :solution)
begin if !isfile(SOLUTION_FILE)
using SCS
scs_solver = SCS.SCSSolver(linearsolver=SCS.Direct,
eps=sett.tol,
max_iters=args["iterations"],
alpha=1.95,
acceleration_lookback=1)
JuMP.setsolver(SDP_problem, scs_solver) SDP_problem, varλ, varP = PropertyT.SOS_problem(elt, Δ, orbit_data; upper_bound=sett.upper_bound)
end
λ = Ps = nothing begin
ws = PropertyT.warmstart(sett) using SCS
scs_solver = SCS.SCSSolver(linearsolver=SCS.Direct,
eps=sett.tol,
max_iters=args["iterations"],
alpha=1.95,
acceleration_lookback=1)
# using ProgressMeter JuMP.setsolver(SDP_problem, scs_solver)
# @showprogress "Running SDP optimization step... " for i in 1:args["repetitions"]
while true
λ, Ps, ws = PropertyT.solve(PropertyT.filename(sett, :solverlog),
SDP_problem, varλ, varP, ws);
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
λ = Ps = nothing
ws = PropertyT.warmstart(sett)
# using ProgressMeter
# @showprogress "Running SDP optimization step... " for i in 1:args["repetitions"]
while true
λ, Ps, ws = PropertyT.solve(PropertyT.filename(sett, :solverlog),
SDP_problem, varλ, varP, ws);
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...")
@time P = PropertyT.reconstruct(Ps, orbit_data);
save(SOLUTION_FILE, "λ", λ, "P", P)
end end
info("Reconstructing P...") P, λ = load(SOLUTION_FILE, "P", "λ")
@time P = PropertyT.reconstruct(Ps, orbit_data); @show λ;
save(PropertyT.filename(sett, :solution), "λ", λ, "P", P)
@time const Q = real(sqrtm(P)); @time const Q = real(sqrtm(P));
@ -172,14 +180,12 @@ function SOS_residual(eoi::GroupRingElem, Q::Matrix)
return eoi - sos return eoi - sos
end end
addprocs(4) info("Floating Point arithmetic:")
@everywhere using PropertyT
@show λ;
EOI = elt - λ*Δ EOI = elt - λ*Δ
b = SOS_residual(EOI, Q) b = SOS_residual(EOI, Q)
@show norm(b, 1); @show norm(b, 1);
info("Interval arithmetic:")
using IntervalArithmetic using IntervalArithmetic
Qint = PropertyT.augIdproj(Q); Qint = PropertyT.augIdproj(Q);
@assert all([zero(eltype(Q)) in sum(view(Qint, :, i)) for i in 1:size(Qint, 2)]) @assert all([zero(eltype(Q)) in sum(view(Qint, :, i)) for i in 1:size(Qint, 2)])
@ -190,4 +196,4 @@ Q_int = PropertyT.augIdproj(Q);
b_int = SOS_residual(EOI_int, Q_int) b_int = SOS_residual(EOI_int, Q_int)
@show norm(b_int, 1); @show norm(b_int, 1);
@interval(λ) - 2^2*norm(b_int,1) info("λ is certified to be > ", (@interval(λ) - 2^2*norm(b_int,1)).lo)