generalize MCG to all FP GAP groups

This commit is contained in:
kalmarek 2018-07-31 16:54:35 +02:00
parent b5cf3946a2
commit 3859a26c22
5 changed files with 181 additions and 49 deletions

77
MCGn.jl
View File

@ -20,10 +20,6 @@ function parse_commandline()
help = "Set number of cpus used by solver (default: auto)" help = "Set number of cpus used by solver (default: auto)"
arg_type = Int arg_type = Int
required = false required = false
"-N"
help = "Consider mapping class group of surface of genus N"
arg_type = Int
default = 2
"--radius" "--radius"
help = "Radius of ball B_r(e,S) to find solution over" help = "Radius of ball B_r(e,S) to find solution over"
arg_type = Int arg_type = Int
@ -31,58 +27,43 @@ function parse_commandline()
"--warmstart" "--warmstart"
help = "Use warmstart.jl as the initial guess for SCS" help = "Use warmstart.jl as the initial guess for SCS"
action = :store_true action = :store_true
"-MCG"
help = "Compute for mapping class group of surface of genus N"
arg_type = Int
required = false
"--Higman"
help = "Compute for Higman Group"
action = :store_true
"--Caprace"
help = "Compute for Higman Group"
action = :store_true
end end
return parse_args(args) return parse_args(args)
end end
const PARSEDARGS = parse_commandline() const PARSEDARGS = parse_commandline()
include("CPUselect.jl") using AbstractAlgebra
set_parallel_mthread(PARSEDARGS, workers=false)
using Nemo
using SCS.SCSSolver
using PropertyT using PropertyT
using Groups using Groups
include("FPGroups_GAP.jl") include("CPUselect.jl")
set_parallel_mthread(PARSEDARGS, workers=false)
include("main_gapgroup.jl")
if PARSEDARGS["Caprace"]
include("groups/caprace.jl")
main(CapraceGroup, PARSEDARGS)
elseif PARSEDARGS["Higman"]
include("groups/higman.jl")
main(HigmanGroup, PARSEDARGS)
elseif PARSEDARGS["N"] != nothing
include("groups/mappingclassgroup.jl") include("groups/mappingclassgroup.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)
isdir(name) || mkdir(name)
G, S = GROUP.generatingset(N)
relations = [k*inv(v) for (k,v) in G.rels]
prepare_pm_delta(name, GAP_groupcode(S, relations), radius)
S = unique([S; inv.(S)])
Id = G()
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, "Radius: $radius")
info(logger, G)
info(logger, "Symmetric generating set of size $(length(S))")
info(logger, "Threads: $(Threads.nthreads())")
info(logger, "Workers: $(workers())")
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(MappingClassGroups, PARSEDARGS) main(MappingClassGroups, PARSEDARGS)
else
warn("You need to specify one of the --Higman, --Caprace, -MCG N")
end

62
groups/caprace.jl Normal file
View File

@ -0,0 +1,62 @@
module CapraceGroup
using AbstractAlgebra
using Groups
###############################################################################
#
# Generating set
#
###############################################################################
Comm(x,y) = x*y*x^-1*y^-1
function generatingset()
CapraceGroup = Groups.FPGroup(["x","y","z","t","r"]);
x,y,z,t,r = gens(CapraceGroup)
relations = [
x^7,
y^7,
t^2,
r^73,
t*r*t*r,
Comm(x,y)*z^-1,
Comm(x,z),
Comm(y,z),
Comm(x^2*y*z^-1, t),
Comm(x*y*z^3, t*r),
Comm(x^3*y*z^2, t*r^17),
Comm(x, t*r^-34),
Comm(y, t*r^-32),
Comm(z, t*r^-29),
Comm(x^-2*y*z, t*r^-25),
Comm(x^-1*y*z^-3, t*r^-19),
Comm(x^-3*y*z^-2, t*r^-11)
];
relations = [relations; [inv(rel) for rel in relations]]
Groups.add_rels!(CapraceGroup, Dict(rel => CapraceGroup() for rel in relations))
return CapraceGroup, gens(CapraceGroup)
end
function generatingset(parsed_args)
return generatingset()
end
###############################################################################
#
# Misc
#
###############################################################################
function groupname(parsed_args)
return groupname(), 0
end
groupname() = "CapraceGroup"
end # of module CapraceGroup

49
groups/higman.jl Normal file
View File

@ -0,0 +1,49 @@
module HigmanGroup
using AbstractAlgebra
using Groups
###############################################################################
#
# Generating set
#
###############################################################################
Comm(x,y) = x*y*x^-1*y^-1
function generatingset()
HigmanGr = Groups.FPGroup(["a","b","c","d"]);
a,b,c,d = gens(HigmanGr)
relations = [
b^-1*Comm(b,a),
c^-1*Comm(c,b),
d^-1*Comm(d,c),
a^-1*Comm(a,d)
];
relations = [relations; [inv(rel) for rel in relations]]
Groups.add_rels!(HigmanGr, Dict(rel => HigmanGr() for rel in relations))
return HigmanGr, gens(HigmanGr)
end
function generatingset(parsed_args)
return generatingset()
end
###############################################################################
#
# Misc
#
###############################################################################
function groupname(parsed_args)
return groupname(), 0
end
groupname() = "HigmanGroup"
end # of module CapraceGroup

View File

@ -12,9 +12,11 @@ using Groups
Comm(x,y) = x*y*x^-1*y^-1 Comm(x,y) = x*y*x^-1*y^-1
function generatingset(N::Int) function generatingset(N::Int)
if N == 2 if N < 2
throw("Genus must be at least 2!")
elseif N == 2
MCGroup = Groups.FPGroup(["a1","a2","a3","a4","a5"]); MCGroup = Groups.FPGroup(["a1","a2","a3","a4","a5"]);
S = Nemo.gens(MCGroup) S = gens(MCGroup)
N = length(S) N = length(S)
A = prod(reverse(S))*prod(S) A = prod(reverse(S))*prod(S)
@ -31,12 +33,10 @@ function generatingset(N::Int)
Groups.add_rels!(MCGroup, Dict(rel => MCGroup() for rel in relations)) Groups.add_rels!(MCGroup, Dict(rel => MCGroup() for rel in relations))
return MCGroup return MCGroup
elseif N < 2
throw("Genus must be at least 2!")
end end
MCGroup = Groups.FPGroup(["a$i" for i in 0:2N]) MCGroup = Groups.FPGroup(["a$i" for i in 0:2N])
S = Nemo.gens(MCGroup) S = gens(MCGroup)
a0 = S[1] a0 = S[1]
A = S[2:end] A = S[2:end]

40
main_gapgroup.jl Normal file
View File

@ -0,0 +1,40 @@
using SCS.SCSSolver
# using Mosek
# using CSDP
# using SDPA
include("FPGroups_GAP.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(N)
isdir(name) || mkdir(name)
logger = PropertyT.setup_logging(joinpath(name, "$(upper_bound)"), :fulllog)
relations = [k*inv(v) for (k,v) in G.rels]
prepare_pm_delta(name, GAP_groupcode(S, relations), radius)
S = unique([S; inv.(S)])
info(logger, "Group: $name")
info(logger, "Iterations: $iterations")
info(logger, "Precision: $tol")
info(logger, "Upper bound: $upper_bound")
info(logger, "Radius: $radius")
info(logger, "Threads: $(Threads.nthreads())")
info(logger, "Workers: $(workers())")
info(logger, G)
info(logger, "Symmetric generating set of size $(length(S))")
solver = SCSSolver(eps=tol, max_iters=iterations, linearsolver=SCS.Direct, alpha=1.95, acceleration_lookback=1)
return PropertyT.check_property_T(name, S, G(), solver, upper_bound, tol, radius, warm)
end