diff --git a/AutFN.jl b/AutFN.jl index a77e891..f69a3ee 100644 --- a/AutFN.jl +++ b/AutFN.jl @@ -17,6 +17,27 @@ Moreover, due to work of Potapchik and Rapinchuk [1] every real representation o We need a different approach: Here we actually compute in Aut(𝔽₄) =# +############################################################################### +# +# Generating set +# +############################################################################### + +function SOutFN_generating_set(N::Int) + + SOutFN = AutGroup(FreeGroup(N), special=true, outer=true) + S = gens(SOutFN); + S = [S; [inv(s) for s in S]] + + return SOutFN, unique(S) +end + +############################################################################### +# +# Parsing command line +# +############################################################################### + function cpuinfo_physicalcores() maxcore = -1 for line in eachline("/proc/cpuinfo") @@ -33,15 +54,15 @@ function parse_commandline() @add_arg_table s begin "--tol" - help = "set numerical tolerance for the SDP solver (default: 1e-5)" + help = "set numerical tolerance for the SDP solver" arg_type = Float64 - default = 1e-5 + default = 1e-6 "--iterations" - help = "set maximal number of iterations for the SDP solver (default: 20000)" + help = "set maximal number of iterations for the SDP solver" arg_type = Int default = 20000 "--upper-bound" - help = "Set an upper bound for the spectral gap (default: Inf)" + help = "Set an upper bound for the spectral gap" arg_type = Float64 default = Inf "--cpus" @@ -49,7 +70,7 @@ function parse_commandline() arg_type = Int required = false "-N" - help = "Consider automorphisms of free group on N generators (default: N=3)" + help = "Consider automorphisms of free group on N generators" arg_type = Int default = 2 end @@ -57,14 +78,6 @@ function parse_commandline() return parse_args(s) end - -# const name = "SYM$N" -# const upper_bound=factorial(N)-TOL^(1/5) -# S() = generating_set_of_Sym(N) - -# name = "AutF$N" -# S() = generating_set_of_AutF(N) - function main() parsed_args = parse_commandline() @@ -76,32 +89,30 @@ function main() Blas.set_num_threads(parsed_args["cpus"]) end + N = parsed_args["N"] + radius = 2 tol = parsed_args["tol"] iterations = parsed_args["iterations"] - - # solver = SCSSolver(eps=tol, max_iters=iterations, verbose=true, linearsolver=SCS.Indirect) - solver = SCSSolver(eps=tol, max_iters=iterations, linearsolver=SCS.Direct) - - N = parsed_args["N"] upper_bound = parsed_args["upper-bound"] - radius=2 - name = "SOutF$N" - name = "$(name)_$(upper_bound)_r=$radius" + dirname = "SOutF$(N)_$(upper_bound)_r=$radius" - logger = PropertyT.setup_logging(name) + logger = PropertyT.setup_logging(dirname) - info(logger, "Group: $name") + info(logger, "Group: $dirname") info(logger, "Iterations: $iterations") info(logger, "Precision: $tol") info(logger, "Upper bound: $upper_bound") - AutFN = AutGroup(FreeGroup(N), special=true, outer=true) - S = gens(AutFN); - S = unique([S; [inv(s) for s in S]]) - Id = AutFN() + G, S = SOutFN_generating_set(N) + info(logger, G) + info(logger, "Symmetric generating set of size $(length(S))") + info(logger, S) + Id = G() - @time PropertyT.check_property_T(name, S, Id, solver, upper_bound, tol, 2) + solver = SCSSolver(eps=tol, max_iters=iterations, linearsolver=SCS.Direct) + + @time PropertyT.check_property_T(dirname, S, Id, solver, upper_bound, tol, 2) return 0 end diff --git a/AutFN_orbit.jl b/AutFN_orbit.jl index 445a7be..164afad 100644 --- a/AutFN_orbit.jl +++ b/AutFN_orbit.jl @@ -58,20 +58,31 @@ end # ############################################################################### +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() settings = ArgParseSettings() @add_arg_table settings begin "--tol" - help = "set numerical tolerance for the SDP solver (default: 1e-5)" + help = "set numerical tolerance for the SDP solver" arg_type = Float64 - default = 1e-5 + default = 1e-14 "--iterations" help = "set maximal number of iterations for the SDP solver (default: 20000)" arg_type = Int - default = 20000 + default = 100000 "--upper-bound" - help = "Set an upper bound for the spectral gap (default: Inf)" + help = "Set an upper bound for the spectral gap" arg_type = Float64 default = Inf "--cpus" @@ -79,11 +90,11 @@ function parse_commandline() arg_type = Int required = false "-N" - help = "Consider automorphisms of free group on N generators (default: N=2)" + help = "Consider automorphisms of free group on N generators" arg_type = Int default = 2 "--radius" - help = "Find the decomposition over B_r(e,S)" + help = "Radius of ball B_r(e,S) to find solution over" arg_type = Int default = 2 end @@ -100,6 +111,13 @@ end 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 + N = parsed_args["N"] radius = parsed_args["radius"] tol = parsed_args["tol"] @@ -108,7 +126,6 @@ function main() dirname = "oSOutF$(N)_$(upper_bound)_r=$radius" - isdir(dirname) || mkdir(dirname) logger = PropertyT.setup_logging(dirname) info(logger, "Group: $dirname") @@ -123,7 +140,7 @@ function main() AutS = WreathProduct(FiniteField(2,1, "a")[1], PermutationGroup(N)) # AutS = PermutationGroup(N) - solver = SCS.SCSSolver(eps=tol, max_iters=iterations, verbose=true, linearsolver=SCS.Direct) + solver = SCSSolver(eps=tol, max_iters=iterations, linearsolver=SCS.Direct) sett = Settings(dirname, N, G, S, AutS, radius, solver, upper_bound, tol)