mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-11-19 07:20:28 +01:00
update script for SpN_Adj.jl
This commit is contained in:
parent
914b068070
commit
92d4ba0c20
@ -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,
|
||||
upper_bound=UPPER_BOUND,
|
||||
augmented=true,
|
||||
show_progress=true
|
||||
wd;
|
||||
upper_bound = UPPER_BOUND,
|
||||
augmented = true,
|
||||
show_progress = true,
|
||||
)
|
||||
|
||||
solve_in_loop(
|
||||
model,
|
||||
wd,
|
||||
varP,
|
||||
logdir="./log/Sp($N,Z)/r=$HALFRADIUS/Adj_C₂-InfΔ",
|
||||
optimizer=cosmo_optimizer(
|
||||
eps=1e-10,
|
||||
max_iters=20_000,
|
||||
accel=50,
|
||||
alpha=1.95,
|
||||
varP;
|
||||
logdir = "./log/Sp($N,Z)/r=$HALFRADIUS/Adj_C₂-InfΔ",
|
||||
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),
|
||||
)
|
||||
|
||||
|
@ -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,22 +43,23 @@ 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],
|
||||
halfradius=data.halfradius,
|
||||
solution[:Q];
|
||||
halfradius = data.halfradius,
|
||||
)
|
||||
end
|
||||
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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user