1
0
mirror of https://github.com/kalmarek/PropertyT.jl.git synced 2024-12-27 02:45:30 +01:00

update script for SpN_Adj.jl

This commit is contained in:
Marek Kaluba 2023-03-20 01:40:40 +01:00
parent 914b068070
commit 92d4ba0c20
No known key found for this signature in database
GPG Key ID: 8BF1A3855328FC15
2 changed files with 29 additions and 25 deletions

View File

@ -24,8 +24,7 @@ const GENUS = 2N
G = MatrixGroups.SymplecticGroup{GENUS}(Int8)
RG, S, sizes =
@time PropertyT.group_algebra(G, halfradius=HALFRADIUS, twisted=true)
RG, S, sizes = @time PropertyT.group_algebra(G, halfradius = HALFRADIUS)
wd = let RG = RG, N = N
G = StarAlgebras.object(RG)
@ -42,6 +41,8 @@ wd = let RG = RG, N = N
basis(RG),
StarAlgebras.Basis{UInt16}(@view basis(RG)[1:sizes[HALFRADIUS]]),
)
@info wdfl
wdfl
end
Δ = RG(length(S)) - sum(RG(s) for s in S)
@ -58,23 +59,22 @@ unit = Δ
@time model, varP = PropertyT.sos_problem_primal(
elt,
unit,
wd,
wd;
upper_bound = UPPER_BOUND,
augmented = true,
show_progress=true
show_progress = true,
)
solve_in_loop(
model,
wd,
varP,
varP;
logdir = "./log/Sp($N,Z)/r=$HALFRADIUS/Adj_C₂-InfΔ",
optimizer=cosmo_optimizer(
optimizer = cosmo_optimizer(;
eps = 1e-10,
max_iters = 20_000,
accel = 50,
alpha = 1.95,
),
data=(elt=elt, unit=unit, halfradius=HALFRADIUS)
data = (elt = elt, unit = unit, halfradius = HALFRADIUS),
)

View File

@ -11,12 +11,13 @@ function get_solution(model)
return solution
end
function get_solution(model, wd, varP; logdir)
function get_solution(model, wd, varP)
λ = JuMP.value(model[])
Qs = [real.(sqrt(JuMP.value.(P))) for P in varP]
Q = PropertyT.reconstruct(Qs, wd)
solution = Dict( => λ, :Q => Q)
return solution
end
@ -42,21 +43,22 @@ function solve_in_loop(model::JuMP.Model, args...; logdir, optimizer, data)
# logstream = current_logger().logger.stream
# v = @ccall setvbuf(logstream.handle::Ptr{Cvoid}, C_NULL::Ptr{Cvoid}, 1::Cint, 0::Cint)::Cint
# @warn v
status, warm = @time PropertyT.solve(log_file, model, optimizer, warm)
solution = get_solution(model, args...; logdir=logdir)
solution[:warm] = warm
status, warm =
@time PropertyT.solve(log_file, model, optimizer, warm)
solution = get_solution(model, args...)
serialize(joinpath(logdir, "solution_$date.sjl"), solution)
serialize(joinpath(logdir, "solution.sjl"), solution)
flag, λ_cert = open(log_file, append=true) do io
solution[:warm] = warm
flag, λ_cert = open(log_file; append = true) do io
with_logger(SimpleLogger(io)) do
PropertyT.certify_solution(
return PropertyT.certify_solution(
data.elt,
data.unit,
solution[],
solution[:Q],
solution[:Q];
halfradius = data.halfradius,
)
end
@ -69,7 +71,9 @@ function solve_in_loop(model::JuMP.Model, args...; logdir, optimizer, data)
@info "Certification done with λ = $certified_λ"
return certified_λ
else
rel_change = abs(certified_λ - old_lambda) / (abs(certified_λ) + abs(old_lambda))
rel_change =
abs(certified_λ - old_lambda) /
(abs(certified_λ) + abs(old_lambda))
@info "Certification failed with λ = " certified_λ rel_change
end