using AbstractAlgebra using Nemo using PropertyT using Groups using SCS.SCSSolver # using Mosek # using CSDP # using SDPA include("groups/Allgroups.jl") using PropertyTGroups struct Symmetrize end struct Standard end function summarize(logger, groupdir, iterations, tol, upper_bound, radius, G, S) info(logger, "Group: $groupdir") 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, string(G)) info(logger, "with generating set of size $(length(S))") end function params(Gr::SymmetricGroup) radius = Gr.args["radius"] tol = Gr.args["tol"] iterations = Gr.args["iterations"] upper_bound = Gr.args["upper-bound"] warm = Gr.args["warmstart"] N = Gr.args["N"] return radius, tol, iterations, upper_bound, warm, N end function params(Gr::PropertyTGroup) radius = Gr.args["radius"] tol = Gr.args["tol"] iterations = Gr.args["iterations"] upper_bound = Gr.args["upper-bound"] warm = Gr.args["warmstart"] return radius, tol, iterations, upper_bound, warm end main(G::SymmetricGroup) = main(Symmetrize, G) function main(::Type{Symmetrize}, Gr::SymmetricGroup) radius, tol, iterations, upper_bound, warm, N = params(Gr) groupdir = "$(PropertyTGroups.name(Gr))_r$radius" isdir(groupdir) || mkdir(groupdir) logger = PropertyT.setup_logging(joinpath(groupdir, "$(upper_bound)"), :fulllog) G = PropertyTGroups.group(Gr) S = PropertyTGroups.generatingset(Gr) summarize(logger, groupdir, iterations, tol, upper_bound, radius, G, S) autS = PropertyTGroups.autS(Gr) info(logger, "Symmetrising with $(autS)") 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) sett = Settings(groupdir, N, G, S, autS, radius, solver, upper_bound, tol, warm, logger) return PropertyT.check_property_T(sett) end function main(::Type{Standard}, Gr::SymmetricGroup) radius, tol, iterations, upper_bound, warm, _ = params(Gr) groupdir = "$(PropertyTGroups.name(Gr))_r$radius" isdir(groupdir) || mkdir(groupdir) logger = PropertyT.setup_logging(joinpath(groupdir, "$(upper_bound)"), :fulllog) G = PropertyTGroups.group(Gr) S = PropertyTGroups.generatingset(Gr) summarize(logger, groupdir, iterations, tol, upper_bound, radius, G, S) solver = SCSSolver(eps=tol, max_iters=iterations, linearsolver=SCS.Direct, alpha=1.95, acceleration_lookback=1) return PropertyT.check_property_T(groupdir, S, G(), solver, upper_bound, tol, radius, warm) end function main(Gr::GAPGroup) include("FPGroups_GAP.jl") radius, tol, iterations, upper_bound, warm = params(Gr) groupdir = groupname(Gr) isdir(groupdir) || mkdir(groupdir) logger = PropertyT.setup_logging(joinpath(groupdir, "$(upper_bound)"), :fulllog) G = PropertyTGroups.group(Gr) S = PropertyTGroups.generatingset(Gr) relations = [k*inv(v) for (k,v) in G.rels] prepare_pm_delta(groupdir, GAP_groupcode(S, relations), radius) S = unique([S; inv.(S)]) summarize(logger, groupdir, iterations, tol, upper_bound, radius, G, S) solver = SCSSolver(eps=tol, max_iters=iterations, linearsolver=SCS.Direct, alpha=1.95, acceleration_lookback=1) return PropertyT.check_property_T(groupdir, S, G(), solver, upper_bound, tol, radius, warm) end