update SL_orbit.jl

This commit is contained in:
kalmarek 2017-09-10 15:41:49 +02:00
parent 8a022c03e0
commit 563c69db28

View File

@ -1,5 +1,5 @@
using ArgParse
using SCS
using SCS.SCSSolver
using Nemo
using PropertyT
@ -82,12 +82,23 @@ 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-14
"--iterations"
@ -95,27 +106,27 @@ function parse_commandline()
arg_type = Int
default = 200000
"--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"
help = "Set number of cpus used by solver (default: auto)"
help = "Set number of cpus used by solver"
arg_type = Int
required = false
"-N"
help = "Consider automorphisms of free group on N generators (default: N=2)"
help = "Consider elementary matrices EL(N)"
arg_type = Int
default = 2
"-p"
help = "Matrices over filed of p-elements (default: p=0 => over ZZ)"
help = "Matrices over field of p-elements (p=0 => over ZZ)"
arg_type = Int
default = 0
"--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
"-X"
help = "Matrices are over ZZ⟨X⟩"
help = "Consider EL(N, ZZ⟨X⟩)"
action = :store_true
end
@ -131,6 +142,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"]
p = parsed_args["p"]
@ -151,7 +169,6 @@ function main()
dirname = "$(dirname)_$(upper_bound)_r=$radius"
isdir(dirname) || mkdir(dirname)
logger = PropertyT.setup_logging(dirname)
info(logger, "Group: $dirname")
@ -162,11 +179,11 @@ function main()
G, S = SL_generatingset(N, p, parsed_args["X"])
info(logger, G)
info(logger, "Symmetric generating set of size $(length(S))")
info(logger, S)
# info(logger, S)
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)