diff --git a/runcomputations.jl b/runcomputations.jl new file mode 100644 index 0000000..495a182 --- /dev/null +++ b/runcomputations.jl @@ -0,0 +1,41 @@ +using PropertyT + +using PropertyT.LinearAlgebra +using PropertyT.SparseArrays +using PropertyT.JuMP + +using PropertyT.AbstractAlgebra +using PropertyT.Groups +using PropertyT.GroupRings + +using PropertyT.JLD + +BLAS.set_num_threads(2) +ENV["OMP_NUM_THREADS"] = 2 + +if !haskey(ENV, "GAP_EXECUTABLE") + ENV["GAP_EXECUTABLE"] = "/usr/lib/gap/gap" +end + +include(joinpath("src", "FPGroups_GAP.jl")) +include(joinpath("src", "groupparse.jl")) +include(joinpath("src", "utils.jl")) + +const HALFRADIUS = 3 +using SCS +with_SCS() = with_optimizer(SCS.Optimizer, + linear_solver=SCS.Direct, + max_iters=100_000, + eps=1e-9, + alpha=1.5, + acceleration_lookback=10, + warm_start=true) + +groups = parse_grouppresentations("data/presentations_4_4_4.txt") +groups = parse_grouppresentations("data/presentations_3_3_4.txt") + +for (group_name, G) in groups + @info "" group_name + check_propertyT(G, "log/$(group_name)_r$HALFRADIUS", + HALFRADIUS, Inf, AutomaticStructure) +end diff --git a/src/utils.jl b/src/utils.jl new file mode 100644 index 0000000..129f9c1 --- /dev/null +++ b/src/utils.jl @@ -0,0 +1,56 @@ +function check_propertyT(G::FPGroup, name::AbstractString, + halfradius::Integer=2, upper_bound=Inf, reduction=KnuthBendix; kwargs...) + + @info "GAP code defining group:\n $(GAP_code(G))" + S = gens(G) + S = unique([S; inv.(S)]) + + sett = PropertyT.Settings(name, G, S, with_SCS(); + halfradius=halfradius, upper_bound=upper_bound, force_compute=true) + + fp = PropertyT.fullpath(sett) + isdir(fp) || mkpath(fp) + + # runs kbmag through GAP: + prepare_pm_delta(reduction, G, PropertyT.prepath(sett), halfradius; kwargs...) + + return check_propertyT(sett) +end + +function check_propertyT(sett::PropertyT.Settings) + + @info sett + + fp = PropertyT.fullpath(sett) + isdir(fp) || mkpath(fp) + + if isfile(PropertyT.filename(sett,:Δ)) + # cached + @info "Loading precomputed Δ..." + Δ = PropertyT.loadGRElem(PropertyT.filename(sett,:Δ), sett.G) + else + @error "You need to run GAP on your group first, or provide Δ in + $(PropertyT.filename(sett,:Δ))" + end + + RG = parent(Δ) + + ELT = Δ^2; + ELT_NAME = "Δ²" + + λ, P = PropertyT.approximate_by_SOS(sett, ELT, Δ, + solverlog=PropertyT.filename(sett, :solverlog)) + + λ < 0 && @warn "Solver did not produce a valid solution!" + + P .= (P.+P')./2 + + Q = real(sqrt(P)) + Q .= (Q.+Q')./2 + + save(PropertyT.filename(sett, :solution), "λ", λ, "P", P, "Q", Q) + + certified_λ = PropertyT.certify_SOS_decomposition(ELT, Δ, λ, Q, R=sett.halfradius) + + return PropertyT.interpret_results(sett, certified_λ) +end