1
0
mirror of https://github.com/kalmarek/SmallHyperbolic synced 2024-11-30 17:15:28 +01:00

add glue code

This commit is contained in:
kalmarek 2019-12-18 00:34:21 +01:00
parent 1a90b56820
commit e8a708dfcb
2 changed files with 97 additions and 0 deletions

41
runcomputations.jl Normal file
View File

@ -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

56
src/utils.jl Normal file
View File

@ -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