1
0
mirror of https://github.com/kalmarek/PropertyT.jl.git synced 2024-11-19 15:25:29 +01:00
PropertyT.jl/test/1712.07167.jl

204 lines
5.7 KiB
Julia
Raw Normal View History

2022-11-07 18:45:12 +01:00
@testset "1712.07167 Examples" begin
2019-02-21 16:31:38 +01:00
@testset "SAut(F₃)" begin
N = 3
2022-11-07 18:45:12 +01:00
G = SpecialAutomorphismGroup(FreeGroup(N))
2023-03-19 23:28:36 +01:00
@info "running tests for" G
RG, S, sizes = PropertyT.group_algebra(G; halfradius = 2)
2022-11-07 18:45:12 +01:00
P = PermGroup(perm"(1,2)", Perm(circshift(1:N, -1)))
Σ = PropertyT.Constructions.WreathProduct(PermGroup(perm"(1,2)"), P)
act = PropertyT.action_by_conjugation(G, Σ)
wd = WedderburnDecomposition(
Float64,
Σ,
act,
basis(RG),
StarAlgebras.Basis{UInt16}(@view basis(RG)[1:sizes[2]]),
)
2023-03-19 23:28:36 +01:00
@info wd
2022-11-07 18:45:12 +01:00
Δ = let RG = RG, S = S
RG(length(S)) - sum(RG(s) for s in S)
end
elt = Δ^2
unit = Δ
ub = Inf
status, certified, λ_cert = check_positivity(
elt,
unit,
2023-03-19 23:28:36 +01:00
wd;
upper_bound = ub,
halfradius = 2,
optimizer = cosmo_optimizer(;
eps = 1e-7,
max_iters = 10_000,
accel = 50,
alpha = 1.9,
2022-11-07 18:45:12 +01:00
),
)
@test status == JuMP.OPTIMAL
@test !certified
@test λ_cert < 0
end
2022-11-07 18:45:12 +01:00
@testset "SL(3,Z) has (T)" begin
n = 3
SL = MatrixGroups.SpecialLinearGroup{n}(Int8)
2023-03-19 23:28:36 +01:00
@info "running tests for" SL
RSL, S, sizes = PropertyT.group_algebra(SL; halfradius = 2)
2022-11-07 18:45:12 +01:00
Δ = RSL(length(S)) - sum(RSL(s) for s in S)
@testset "Wedderburn formulation" begin
P = PermGroup(perm"(1,2)", Perm(circshift(1:n, -1)))
Σ = PropertyT.Constructions.WreathProduct(PermGroup(perm"(1,2)"), P)
act = PropertyT.action_by_conjugation(SL, Σ)
wd = WedderburnDecomposition(
Rational{Int},
Σ,
act,
basis(RSL),
StarAlgebras.Basis{UInt16}(@view basis(RSL)[1:sizes[2]]),
)
2023-03-19 23:28:36 +01:00
@info wd
2022-11-07 18:45:12 +01:00
elt = Δ^2
unit = Δ
ub = 0.2801
@test_throws ErrorException PropertyT.sos_problem_primal(
elt,
unit,
wd,
2023-03-19 23:28:36 +01:00
upper_bound = ub,
augmented = false,
2022-11-07 18:45:12 +01:00
)
wdfl = SymbolicWedderburn.WedderburnDecomposition(
Float64,
Σ,
act,
basis(RSL),
StarAlgebras.Basis{UInt16}(@view basis(RSL)[1:sizes[2]]),
)
model, varP = PropertyT.sos_problem_primal(
elt,
unit,
2023-03-19 23:28:36 +01:00
wdfl;
upper_bound = ub,
augmented = false,
2022-11-07 18:45:12 +01:00
)
status, warm = PropertyT.solve(
model,
2023-03-19 23:28:36 +01:00
cosmo_optimizer(;
eps = 1e-10,
max_iters = 20_000,
accel = 50,
alpha = 1.9,
2022-11-08 10:01:31 +01:00
),
)
@test status == JuMP.OPTIMAL
status, _ = PropertyT.solve(
model,
2023-03-19 23:28:36 +01:00
scs_optimizer(;
eps = 1e-10,
max_iters = 100,
accel = -20,
alpha = 1.2,
2022-11-07 18:45:12 +01:00
),
2023-03-19 23:28:36 +01:00
warm,
2022-11-07 18:45:12 +01:00
)
2022-11-08 10:01:31 +01:00
@test status == JuMP.OPTIMAL
2022-11-07 18:45:12 +01:00
Q = @time let varP = varP
Qs = map(varP) do P
2023-03-19 23:28:36 +01:00
return real.(sqrt(JuMP.value.(P)))
2022-11-07 18:45:12 +01:00
end
PropertyT.reconstruct(Qs, wdfl)
end
λ = JuMP.value(model[])
2023-03-19 23:28:36 +01:00
sos = PropertyT.compute_sos(parent(elt), Q; augmented = false)
2022-11-07 18:45:12 +01:00
certified, λ_cert = PropertyT.certify_solution(
elt,
unit,
λ,
2023-03-19 23:28:36 +01:00
Q;
halfradius = 2,
augmented = false,
2022-11-07 18:45:12 +01:00
)
@test certified
@test λ_cert >= 28 // 100
end
@testset "augmented Wedderburn formulation" begin
elt = Δ^2
unit = Δ
ub = Inf
P = PermGroup(perm"(1,2)", Perm(circshift(1:n, -1)))
Σ = PropertyT.Constructions.WreathProduct(PermGroup(perm"(1,2)"), P)
act = PropertyT.action_by_conjugation(SL, Σ)
wdfl = SymbolicWedderburn.WedderburnDecomposition(
Float64,
Σ,
act,
basis(RSL),
StarAlgebras.Basis{UInt16}(@view basis(RSL)[1:sizes[2]]),
)
2023-03-19 23:28:36 +01:00
@info wdfl
2022-11-07 18:45:12 +01:00
opt_problem, varP = PropertyT.sos_problem_primal(
elt,
unit,
2023-03-19 23:28:36 +01:00
wdfl;
upper_bound = ub,
2022-11-07 18:45:12 +01:00
# augmented = true # since both elt and unit are augmented
)
status, _ = PropertyT.solve(
opt_problem,
2023-03-19 23:28:36 +01:00
scs_optimizer(;
eps = 1e-8,
max_iters = 20_000,
accel = 0,
alpha = 1.9,
2022-11-07 18:45:12 +01:00
),
)
@test status == JuMP.OPTIMAL
Q = @time let varP = varP
Qs = map(varP) do P
2023-03-19 23:28:36 +01:00
return real.(sqrt(JuMP.value.(P)))
2022-11-07 18:45:12 +01:00
end
PropertyT.reconstruct(Qs, wdfl)
end
certified, λ_cert = PropertyT.certify_solution(
elt,
unit,
JuMP.objective_value(opt_problem),
2023-03-19 23:28:36 +01:00
Q;
halfradius = 2,
2022-11-07 18:45:12 +01:00
# augmented = true # since both elt and unit are augmented
)
@test certified
@test λ_cert > 28 // 100
end
2019-02-21 16:31:38 +01:00
end
end