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:
parent
914b068070
commit
92d4ba0c20
@ -24,8 +24,7 @@ const GENUS = 2N
|
|||||||
|
|
||||||
G = MatrixGroups.SymplecticGroup{GENUS}(Int8)
|
G = MatrixGroups.SymplecticGroup{GENUS}(Int8)
|
||||||
|
|
||||||
RG, S, sizes =
|
RG, S, sizes = @time PropertyT.group_algebra(G, halfradius = HALFRADIUS)
|
||||||
@time PropertyT.group_algebra(G, halfradius=HALFRADIUS, twisted=true)
|
|
||||||
|
|
||||||
wd = let RG = RG, N = N
|
wd = let RG = RG, N = N
|
||||||
G = StarAlgebras.object(RG)
|
G = StarAlgebras.object(RG)
|
||||||
@ -42,6 +41,8 @@ wd = let RG = RG, N = N
|
|||||||
basis(RG),
|
basis(RG),
|
||||||
StarAlgebras.Basis{UInt16}(@view basis(RG)[1:sizes[HALFRADIUS]]),
|
StarAlgebras.Basis{UInt16}(@view basis(RG)[1:sizes[HALFRADIUS]]),
|
||||||
)
|
)
|
||||||
|
@info wdfl
|
||||||
|
wdfl
|
||||||
end
|
end
|
||||||
|
|
||||||
Δ = RG(length(S)) - sum(RG(s) for s in S)
|
Δ = RG(length(S)) - sum(RG(s) for s in S)
|
||||||
@ -58,23 +59,22 @@ unit = Δ
|
|||||||
@time model, varP = PropertyT.sos_problem_primal(
|
@time model, varP = PropertyT.sos_problem_primal(
|
||||||
elt,
|
elt,
|
||||||
unit,
|
unit,
|
||||||
wd,
|
wd;
|
||||||
upper_bound=UPPER_BOUND,
|
upper_bound = UPPER_BOUND,
|
||||||
augmented=true,
|
augmented = true,
|
||||||
show_progress=true
|
show_progress = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
solve_in_loop(
|
solve_in_loop(
|
||||||
model,
|
model,
|
||||||
wd,
|
wd,
|
||||||
varP,
|
varP;
|
||||||
logdir="./log/Sp($N,Z)/r=$HALFRADIUS/Adj_C₂-InfΔ",
|
logdir = "./log/Sp($N,Z)/r=$HALFRADIUS/Adj_C₂-InfΔ",
|
||||||
optimizer=cosmo_optimizer(
|
optimizer = cosmo_optimizer(;
|
||||||
eps=1e-10,
|
eps = 1e-10,
|
||||||
max_iters=20_000,
|
max_iters = 20_000,
|
||||||
accel=50,
|
accel = 50,
|
||||||
alpha=1.95,
|
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
|
return solution
|
||||||
end
|
end
|
||||||
|
|
||||||
function get_solution(model, wd, varP; logdir)
|
function get_solution(model, wd, varP)
|
||||||
λ = JuMP.value(model[:λ])
|
λ = JuMP.value(model[:λ])
|
||||||
|
|
||||||
Qs = [real.(sqrt(JuMP.value.(P))) for P in varP]
|
Qs = [real.(sqrt(JuMP.value.(P))) for P in varP]
|
||||||
Q = PropertyT.reconstruct(Qs, wd)
|
Q = PropertyT.reconstruct(Qs, wd)
|
||||||
solution = Dict(:λ => λ, :Q => Q)
|
solution = Dict(:λ => λ, :Q => Q)
|
||||||
|
|
||||||
return solution
|
return solution
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -42,22 +43,23 @@ function solve_in_loop(model::JuMP.Model, args...; logdir, optimizer, data)
|
|||||||
# logstream = current_logger().logger.stream
|
# logstream = current_logger().logger.stream
|
||||||
# v = @ccall setvbuf(logstream.handle::Ptr{Cvoid}, C_NULL::Ptr{Cvoid}, 1::Cint, 0::Cint)::Cint
|
# v = @ccall setvbuf(logstream.handle::Ptr{Cvoid}, C_NULL::Ptr{Cvoid}, 1::Cint, 0::Cint)::Cint
|
||||||
# @warn v
|
# @warn v
|
||||||
status, warm = @time PropertyT.solve(log_file, model, optimizer, warm)
|
status, warm =
|
||||||
|
@time PropertyT.solve(log_file, model, optimizer, warm)
|
||||||
solution = get_solution(model, args...; logdir=logdir)
|
|
||||||
solution[:warm] = warm
|
|
||||||
|
|
||||||
|
solution = get_solution(model, args...)
|
||||||
serialize(joinpath(logdir, "solution_$date.sjl"), solution)
|
serialize(joinpath(logdir, "solution_$date.sjl"), solution)
|
||||||
serialize(joinpath(logdir, "solution.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
|
with_logger(SimpleLogger(io)) do
|
||||||
PropertyT.certify_solution(
|
return PropertyT.certify_solution(
|
||||||
data.elt,
|
data.elt,
|
||||||
data.unit,
|
data.unit,
|
||||||
solution[:λ],
|
solution[:λ],
|
||||||
solution[:Q],
|
solution[:Q];
|
||||||
halfradius=data.halfradius,
|
halfradius = data.halfradius,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -69,7 +71,9 @@ function solve_in_loop(model::JuMP.Model, args...; logdir, optimizer, data)
|
|||||||
@info "Certification done with λ = $certified_λ"
|
@info "Certification done with λ = $certified_λ"
|
||||||
return certified_λ
|
return certified_λ
|
||||||
else
|
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
|
@info "Certification failed with λ = $λ" certified_λ rel_change
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user