rework starting scripts

This commit is contained in:
kalmarek 2018-07-31 12:41:48 +02:00
parent 6acdff2b70
commit df940c8c07
5 changed files with 94 additions and 212 deletions

View File

@ -1,55 +0,0 @@
using ArgParse
###############################################################################
#
# Parsing command line
#
###############################################################################
function parse_commandline()
settings = ArgParseSettings()
@add_arg_table settings 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"
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 automorphisms of free group on N generators"
arg_type = Int
default = 2
"--radius"
help = "Radius of ball B_r(e,S) to find solution over"
arg_type = Int
default = 2
"--warmstart"
help = "Use warmstart.jld as the initial guess for SCS"
action = :store_true
end
return parse_args(settings)
end
parsed_args = parse_commandline()
include("CPUselect.jl")
set_parallel_mthread(parsed_args, workers=true)
include("groups/autfreegroup.jl")
include("Orbit.jl")
main(SpecialAutomorphisms, parsed_args)

View File

@ -26,10 +26,6 @@ function parse_commandline()
help = "Set number of cpus used by solver (default: auto)"
arg_type = Int
required = false
"-N"
help = "Consider automorphisms of free group on N generators"
arg_type = Int
default = 2
"--radius"
help = "Radius of ball B_r(e,S) to find solution over"
arg_type = Int
@ -37,15 +33,18 @@ function parse_commandline()
"--warmstart"
help = "Use warmstart.jld as the initial guess for SCS"
action = :store_true
"--nosymmetry"
help = "Don't use symmetries of the Laplacian"
action = :store_true
"N"
help = "Compute for the automorphisms group of the free group on N generators"
arg_type = Int
required = true
end
return parse_args(s)
end
const PARSEDARGS = parse_commandline()
include("CPUselect.jl")
set_parallel_mthread(PARSEDARGS, workers=true)
#=
Note that the element
α(i,j,k) = ϱ(i,j)*ϱ(i,k)*inv(ϱ(i,j))*inv(ϱ(i,k)),
@ -56,46 +55,16 @@ Moreover, due to work of Potapchik and Rapinchuk [1] every real representation o
We need a different approach: Here we actually compute in (S)Aut(𝔽ₙ)
=#
using Nemo
using SCS.SCSSolver
include("CPUselect.jl")
set_parallel_mthread(PARSEDARGS, workers=true)
using AbstractAlgebra
using PropertyT
using Groups
Nemo.setpermstyle(:cycles)
include("groups/autfreegroup.jl")
function main(GROUP, parsed_args)
radius = parsed_args["radius"]
tol = parsed_args["tol"]
iterations = parsed_args["iterations"]
upper_bound = parsed_args["upper-bound"]
warm = parsed_args["warmstart"]
name, N = GROUP.groupname(parsed_args)
G, S = GROUP.generatingset(parsed_args)
name = "$(name)_r$radius"
isdir(name) || mkdir(name)
logger = PropertyT.setup_logging(joinpath(name, "$(upper_bound)"))
info(logger, "Group: $name")
info(logger, "Iterations: $iterations")
info(logger, "Precision: $tol")
info(logger, "Upper bound: $upper_bound")
info(logger, G)
info(logger, "Symmetric generating set of size $(length(S))")
info(logger, "Threads: $(Threads.nthreads())")
info(logger, "Workers: $(workers())")
Id = G()
solver = SCSSolver(eps=tol, max_iters=iterations, linearsolver=SCS.Direct, alpha=1.95, acceleration_lookback=1)
PropertyT.check_property_T(name, S, Id, solver, upper_bound, tol, radius, warm)
return 0
end
include("main.jl")
main(SpecialAutomorphisms, PARSEDARGS)

96
SL.jl
View File

@ -1,96 +0,0 @@
using ArgParse
###############################################################################
#
# Parsing command line
#
###############################################################################
function parse_commandline()
settings = ArgParseSettings()
@add_arg_table settings begin
"--tol"
help = "set numerical tolerance for the SDP solver"
arg_type = Float64
default = 1e-6
"--iterations"
help = "set maximal number of iterations for the SDP solver"
arg_type = Int
default = 50000
"--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"
arg_type = Int
required = false
"-N"
help = "Consider elementary matrices EL(N)"
arg_type = Int
default = 2
"-p"
help = "Matrices over field of p-elements (p=0 => over ZZ)"
arg_type = Int
default = 0
"--radius"
help = "Radius of ball B_r(e,S) to find solution over"
arg_type = Int
default = 2
"-X"
help = "Consider EL(N, ZZ⟨X⟩)"
action = :store_true
"--warmstart"
help = "Use warmstart.jld as the initial guess for SCS"
action = :store_true
end
return parse_args(settings)
end
const PARSEDARGS = parse_commandline()
include("CPUselect.jl")
set_parallel_mthread(PARSEDARGS, workers=true)
using Nemo
using SCS.SCSSolver
using PropertyT
using Groups
include("groups/speciallinear.jl")
function main(GROUP, parsed_args)
radius = parsed_args["radius"]
tol = parsed_args["tol"]
iterations = parsed_args["iterations"]
upper_bound = parsed_args["upper-bound"]
warm = parsed_args["warmstart"]
name, N = GROUP.groupname(parsed_args)
G, S = GROUP.generatingset(parsed_args)
name = "$(name)_r$radius"
isdir(name) || mkdir(name)
logger = PropertyT.setup_logging(joinpath(name, "$(upper_bound)"))
info(logger, "Group: $name")
info(logger, "Iterations: $iterations")
info(logger, "Precision: $tol")
info(logger, "Upper bound: $upper_bound")
info(logger, G)
info(logger, "Symmetric generating set of size $(length(S))")
info(logger, "Threads: $(Threads.nthreads())")
info(logger, "Workers: $(workers())")
Id = one(G)
solver = SCSSolver(eps=tol, max_iters=iterations, linearsolver=SCS.Direct, alpha=1.95, acceleration_lookback=1)
PropertyT.check_property_T(name, S, Id, solver, upper_bound, tol, radius, warm)
return 0
end
main(SpecialLinear, PARSEDARGS)

View File

@ -13,11 +13,11 @@ function parse_commandline()
"--tol"
help = "set numerical tolerance for the SDP solver"
arg_type = Float64
default = 1e-14
default = 1e-6
"--iterations"
help = "set maximal number of iterations for the SDP solver"
arg_type = Int
default = 60000
default = 50000
"--upper-bound"
help = "Set an upper bound for the spectral gap"
arg_type = Float64
@ -26,36 +26,40 @@ function parse_commandline()
help = "Set number of cpus used by solver"
arg_type = Int
required = false
"-N"
help = "Consider elementary matrices EL(N)"
arg_type = Int
default = 2
"-p"
help = "Matrices over field of p-elements (p=0 => over ZZ)"
arg_type = Int
default = 0
"--radius"
help = "Radius of ball B_r(e,S) to find solution over"
arg_type = Int
default = 2
"-X"
help = "Consider EL(N, ZZ⟨X⟩)"
action = :store_true
"--warmstart"
help = "Use warmstart.jld as the initial guess for SCS"
action = :store_true
"--nosymmetry"
help = "Don't use symmetries of the Laplacian"
action = :store_true
"-p"
help = "Matrices over field of p-elements (p=0 => over ZZ)"
arg_type = Int
default = 0
"-X"
help = "Consider EL(N, ZZ⟨X⟩)"
action = :store_true
"N"
help = "Compute with the group generated by elementary matrices of size n×n"
arg_type = Int
default = 2
end
return parse_args(settings)
end
const PARSEDARGS = parse_commandline()
include("CPUselect.jl")
set_parallel_mthread(PARSEDARGS, workers=true)
using PropertyT
using Groups
include("groups/speciallinear.jl")
include("Orbit.jl")
include("main.jl")
main(SpecialLinear, PARSEDARGS)

60
main.jl Normal file
View File

@ -0,0 +1,60 @@
using SCS.SCSSolver
# using Mosek
# using CSDP
# using SDPA
function main(GROUP, parsed_args)
radius = parsed_args["radius"]
tol = parsed_args["tol"]
iterations = parsed_args["iterations"]
upper_bound = parsed_args["upper-bound"]
warm = parsed_args["warmstart"]
name, N = GROUP.groupname(parsed_args)
G, S = GROUP.generatingset(parsed_args)
if !PARSEDARGS["nosymmetry"]
autS = GROUP.autS(parsed_args)
end
if !PARSEDARGS["nosymmetry"]
name = "o$(name)_r$radius"
else
name = "$(name)_r$radius"
end
isdir(name) || mkdir(name)
logger = PropertyT.setup_logging(joinpath(name, "$(upper_bound)"), :fulllog)
info(logger, "Group: $name")
info(logger, "Iterations: $iterations")
info(logger, "Precision: $tol")
info(logger, "Upper bound: $upper_bound")
info(logger, "Threads: $(Threads.nthreads())")
info(logger, "Workers: $(workers())")
info(logger, G)
info(logger, "with generating set of size $(length(S))")
if !PARSEDARGS["nosymmetry"]
info(logger, "Symmetrising with $autS")
end
solver = SCSSolver(eps=tol, max_iters=iterations, linearsolver=SCS.Direct, alpha=1.95, acceleration_lookback=1)
# solver = Mosek.MosekSolver(
# MSK_DPAR_INTPNT_CO_TOL_REL_GAP=tol,
# MSK_IPAR_INTPNT_MAX_ITERATIONS=iterations,
# QUIET=false)
# solver = CSDP.CSDPSolver(axtol=tol, atytol=tol, objtol=tol, minstepp=tol*10.0^-1, minstepd=tol*10.0^-1)
# solver = SDPA.SDPASolver(epsilonStar=tol, epsilonDash=tol)
if !PARSEDARGS["nosymmetry"]
sett = Settings(name, N, G, S, autS, radius, solver, upper_bound, tol, warm, logger)
return PropertyT.check_property_T(sett)
else
return PropertyT.check_property_T(name, S, G(), solver, upper_bound, tol, radius, warm)
end
end