mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-12-26 02:30:29 +01:00
add really quick tests to be run first
tests run really fast, but compilation time is killing it...
This commit is contained in:
parent
d1d46d13ef
commit
18f681b12b
@ -1,20 +1,3 @@
|
||||
function check_positivity(elt, unit; upper_bound=Inf, halfradius=2, optimizer)
|
||||
@time sos_problem =
|
||||
PropertyT.sos_problem_primal(elt, unit, upper_bound=upper_bound)
|
||||
|
||||
status, _ = PropertyT.solve(sos_problem, optimizer)
|
||||
P = JuMP.value.(sos_problem[:P])
|
||||
Q = real.(sqrt(P))
|
||||
certified, λ_cert = PropertyT.certify_solution(
|
||||
elt,
|
||||
unit,
|
||||
JuMP.objective_value(sos_problem),
|
||||
Q,
|
||||
halfradius=halfradius,
|
||||
)
|
||||
return status, certified, λ_cert
|
||||
end
|
||||
|
||||
@testset "1703.09680 Examples" begin
|
||||
|
||||
@testset "SL(2,Z)" begin
|
||||
|
@ -1,27 +1,3 @@
|
||||
function check_positivity(elt, unit, wd; upper_bound=Inf, halfradius=2, optimizer)
|
||||
@assert aug(elt) == aug(unit) == 0
|
||||
@time sos_problem, Ps =
|
||||
PropertyT.sos_problem_primal(elt, unit, wd, upper_bound=upper_bound)
|
||||
|
||||
@time status, _ = PropertyT.solve(sos_problem, optimizer)
|
||||
|
||||
Q = let Ps = Ps
|
||||
Qs = [real.(sqrt(JuMP.value.(P))) for P in Ps]
|
||||
PropertyT.reconstruct(Qs, wd)
|
||||
end
|
||||
|
||||
λ = JuMP.value(sos_problem[:λ])
|
||||
|
||||
certified, λ_cert = PropertyT.certify_solution(
|
||||
elt,
|
||||
unit,
|
||||
λ,
|
||||
Q,
|
||||
halfradius=2
|
||||
)
|
||||
return status, certified, λ_cert
|
||||
end
|
||||
|
||||
@testset "1712.07167 Examples" begin
|
||||
|
||||
@testset "SAut(F₃)" begin
|
||||
|
41
test/check_positivity.jl
Normal file
41
test/check_positivity.jl
Normal file
@ -0,0 +1,41 @@
|
||||
function check_positivity(elt, unit; upper_bound=Inf, halfradius=2, optimizer)
|
||||
@time sos_problem =
|
||||
PropertyT.sos_problem_primal(elt, unit, upper_bound=upper_bound)
|
||||
|
||||
status, _ = PropertyT.solve(sos_problem, optimizer)
|
||||
P = JuMP.value.(sos_problem[:P])
|
||||
Q = real.(sqrt(P))
|
||||
certified, λ_cert = PropertyT.certify_solution(
|
||||
elt,
|
||||
unit,
|
||||
JuMP.objective_value(sos_problem),
|
||||
Q,
|
||||
halfradius=halfradius,
|
||||
)
|
||||
return status, certified, λ_cert
|
||||
end
|
||||
|
||||
function check_positivity(elt, unit, wd; upper_bound=Inf, halfradius=2, optimizer)
|
||||
@assert aug(elt) == aug(unit) == 0
|
||||
@time sos_problem, Ps =
|
||||
PropertyT.sos_problem_primal(elt, unit, wd, upper_bound=upper_bound)
|
||||
|
||||
@time status, _ = PropertyT.solve(sos_problem, optimizer)
|
||||
|
||||
Q = let Ps = Ps
|
||||
Qs = [real.(sqrt(JuMP.value.(P))) for P in Ps]
|
||||
PropertyT.reconstruct(Qs, wd)
|
||||
end
|
||||
|
||||
λ = JuMP.value(sos_problem[:λ])
|
||||
|
||||
certified, λ_cert = PropertyT.certify_solution(
|
||||
elt,
|
||||
unit,
|
||||
λ,
|
||||
Q,
|
||||
halfradius=halfradius
|
||||
)
|
||||
return status, certified, λ_cert
|
||||
end
|
||||
|
80
test/quick_tests.jl
Normal file
80
test/quick_tests.jl
Normal file
@ -0,0 +1,80 @@
|
||||
@testset "Quick tests" begin
|
||||
|
||||
@testset "SL(2,F₇)" begin
|
||||
N = 2
|
||||
p = 7
|
||||
halfradius = 3
|
||||
G = MatrixGroups.SpecialLinearGroup{N}(SymbolicWedderburn.Characters.FiniteFields.GF{p})
|
||||
RG, S, sizes = PropertyT.group_algebra(G, halfradius=3, twisted=true)
|
||||
|
||||
Δ = let RG = RG, S = S
|
||||
RG(length(S)) - sum(RG(s) for s in S)
|
||||
end
|
||||
|
||||
elt = Δ^2
|
||||
unit = Δ
|
||||
ub = 0.58578# Inf# 1.5
|
||||
|
||||
@testset "standard formulation" begin
|
||||
status, certified, λ_cert = check_positivity(
|
||||
elt,
|
||||
unit,
|
||||
upper_bound=ub,
|
||||
halfradius=2,
|
||||
optimizer=cosmo_optimizer(
|
||||
eps=1e-7,
|
||||
max_iters=5_000,
|
||||
accel=50,
|
||||
alpha=1.95,
|
||||
)
|
||||
)
|
||||
|
||||
@test status == JuMP.OPTIMAL
|
||||
@test certified
|
||||
@test λ_cert > 5857 // 10000
|
||||
|
||||
m = PropertyT.sos_problem_dual(elt, unit)
|
||||
PropertyT.solve(m, cosmo_optimizer(
|
||||
eps=1e-7,
|
||||
max_iters=10_000,
|
||||
accel=50,
|
||||
alpha=1.95,
|
||||
))
|
||||
|
||||
@test JuMP.termination_status(m) in (JuMP.ALMOST_OPTIMAL, JuMP.OPTIMAL)
|
||||
@test JuMP.objective_value(m) ≈ λ_cert atol = 1e-2
|
||||
end
|
||||
|
||||
@testset "Wedderburn decomposition" begin
|
||||
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[halfradius]]),
|
||||
)
|
||||
|
||||
status, certified, λ_cert = check_positivity(
|
||||
elt,
|
||||
unit,
|
||||
wd,
|
||||
upper_bound=ub,
|
||||
halfradius=2,
|
||||
optimizer=cosmo_optimizer(
|
||||
eps=1e-7,
|
||||
max_iters=10_000,
|
||||
accel=50,
|
||||
alpha=1.9,
|
||||
),
|
||||
)
|
||||
|
||||
@test status == JuMP.OPTIMAL
|
||||
@test certified
|
||||
@test λ_cert > 5857 // 10000
|
||||
end
|
||||
end
|
||||
end
|
@ -1,8 +1,6 @@
|
||||
using Test
|
||||
using LinearAlgebra
|
||||
using SparseArrays
|
||||
BLAS.set_num_threads(1)
|
||||
ENV["OMP_NUM_THREADS"] = 4
|
||||
|
||||
using Groups
|
||||
using Groups.GroupsCore
|
||||
@ -14,15 +12,18 @@ using SymbolicWedderburn.StarAlgebras
|
||||
using SymbolicWedderburn.PermutationGroups
|
||||
|
||||
include("optimizers.jl")
|
||||
include("check_positivity.jl")
|
||||
include("quick_tests.jl")
|
||||
|
||||
@testset "PropertyT" begin
|
||||
if haskey(ENV, "FULL_TEST") || haskey(ENV, "CI")
|
||||
@testset "PropertyT" begin
|
||||
include("constratint_matrices.jl")
|
||||
include("actions.jl")
|
||||
|
||||
include("constratint_matrices.jl")
|
||||
include("actions.jl")
|
||||
include("1703.09680.jl")
|
||||
include("1712.07167.jl")
|
||||
include("1812.03456.jl")
|
||||
|
||||
include("1703.09680.jl")
|
||||
include("1712.07167.jl")
|
||||
include("1812.03456.jl")
|
||||
|
||||
include("graded_adj.jl")
|
||||
include("graded_adj.jl")
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user