using ArgParse using JLD using Nemo import SCS.SCSSolver using PropertyT using Groups function cpuinfo_physicalcores() maxcore = -1 for line in eachline("/proc/cpuinfo") if startswith(line, "core id") maxcore = max(maxcore, parse(Int, split(line, ':')[2])) end end maxcore < 0 && error("failure to read core ids from /proc/cpuinfo") return maxcore + 1 end function parse_commandline() args = ArgParseSettings() @add_arg_table args begin "--tol" help = "set numerical tolerance for the SDP solver" arg_type = Float64 default = 1e-14 "--iterations" help = "set maximal number of iterations for the SDP solver (default: 20000)" arg_type = Int default = 60000 "--upper-bound" help = "Set an upper bound for the spectral gap" arg_type = Float64 default = Inf "--cpus" help = "Set number of cpus used by solver (default: auto)" arg_type = Int required = false "-N" help = "Consider mapping class group of surface of genus N" arg_type = Int default = 2 "--radius" help = "Radius of ball B_r(e,S) to find solution over" arg_type = Int default = 4 "--warmstart" help = "Use warmstart.jl as the initial guess for SCS" action = :store_true end return parse_args(args) end include("FPGroups_GAP.jl") function main() parsed_args = parse_commandline() if parsed_args["cpus"] ≠ nothing if parsed_args["cpus"] > cpuinfo_physicalcores() warn("Number of specified cores exceeds the physical core cound. Performance will suffer.") end BLAS.set_num_threads(parsed_args["cpus"]) end tol = parsed_args["tol"] iterations = parsed_args["iterations"] upper_bound = parsed_args["upper-bound"] radius = parsed_args["radius"] N = parsed_args["N"] prefix = "MCG($N)" name = "$(prefix)" isdir(name) || mkdir(name) prepare_pm_delta(prefix, name, radius) logger = PropertyT.setup_logging(name) info(logger, "Group: $name") info(logger, "Iterations: $iterations") info(logger, "Precision: $tol") info(logger, "Upper bound: $upper_bound") MCGroup = Groups.FPGroup(["a1","a2","a3","a4", "a5"]); S = Nemo.gens(MCGroup) Comm(x,y) = x*y*x^-1*y^-1 k = length(S) relations = [[Comm(S[i], S[j]) for i in 1:k for j in 1:k if abs(i-j) > 1]..., [S[i]*S[i+1]*S[i]*inv(S[i+1]*S[i]*S[i+1]) for i in 1:k-1]..., (S[1]*S[2]*S[3])^4*inv(S[5])^5, Comm(prod(reverse(S))*prod(S), S[1]), (prod(reverse(S))*prod(S))^2 ]; relations = [relations; [inv(rel) for rel in relations]] Groups.add_rels!(MCGroup, Dict(rel => MCGroup() for rel in relations)) S = gens(MCGroup) S = unique([S; [inv(s) for s in S]]) Id = MCGroup() solver = SCSSolver(eps=tol, max_iters=iterations, linearsolver=SCS.Direct, alpha=1.9, acceleration_lookback=1) @time PropertyT.check_property_T(name, S, Id, solver, upper_bound, tol, radius) return 0 end main()