From 04a13616c6d8903be2ed263323c2c794d29afa41 Mon Sep 17 00:00:00 2001 From: kalmarek Date: Mon, 13 Nov 2017 10:57:02 +0100 Subject: [PATCH 1/5] Allow different AbstractMathProgSolvers in Settings --- src/Orbit-wise.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Orbit-wise.jl b/src/Orbit-wise.jl index d77e556..afeef29 100644 --- a/src/Orbit-wise.jl +++ b/src/Orbit-wise.jl @@ -3,14 +3,14 @@ using SCS export Settings, OrbitData -immutable Settings +immutable Settings{T<:AbstractMathProgSolver} name::String N::Int G::Group S::Vector autS::Group radius::Int - solver::SCSSolver + solver::T upper_bound::Float64 tol::Float64 end From 39bef16aa7ce90d9f267ae26880d18577cd53c97 Mon Sep 17 00:00:00 2001 From: kalmarek Date: Mon, 13 Nov 2017 10:57:57 +0100 Subject: [PATCH 2/5] filter Upis and dims at LOADTIME for only those which are non-zeros --- src/Orbit-wise.jl | 6 ++++-- src/OrbitDecomposition.jl | 7 +------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/Orbit-wise.jl b/src/Orbit-wise.jl index afeef29..4afa743 100644 --- a/src/Orbit-wise.jl +++ b/src/Orbit-wise.jl @@ -37,11 +37,13 @@ function OrbitData(sett::Settings) splap² = similar(splap) splap² = GroupRings.mul!(splap², splap, splap, pm); - # Uπs = load(joinpath(name, "U_pis.jld"), "Uπs"); Uπs = load(joinpath(prepath(sett), "U_pis.jld"), "Uπs") + nzros = [i for i in 1:length(Uπs) if size(Uπs[i],2) !=0] + Uπs = Uπs[nzros] Uπs = sparsify!.(Uπs, sett.tol, check=true, verbose=true) + #dimensions of the corresponding πs: - dims = load(joinpath(prepath(sett), "U_pis.jld"), "dims") + dims = load(joinpath(prepath(sett), "U_pis.jld"), "dims")[nzros] m, P = init_model(size(Uπs,1), [size(U,2) for U in Uπs]); diff --git a/src/OrbitDecomposition.jl b/src/OrbitDecomposition.jl index ce582cf..07933a8 100644 --- a/src/OrbitDecomposition.jl +++ b/src/OrbitDecomposition.jl @@ -137,12 +137,7 @@ function perm_reps(S::Vector, autS::Group, radius::Int) end function reconstruct_sol{T<:GroupElem, S<:Nemo.perm}(preps::Dict{T, S}, - aUs::Vector, aPs::Vector, adims::Vector) - - idx = [π for π in 1:length(aUs) if size(aUs[π], 2) != 0] - Us = aUs[idx] - Ps = aPs[idx] - dims = adims[idx]; + Us::Vector, Ps::Vector, dims::Vector) l = length(Us) transfP = [dims[π].*Us[π]*Ps[π]*Us[π]' for π in 1:l] From 0d20df8207d640cec24408d1d8edf04ed2463ff5 Mon Sep 17 00:00:00 2001 From: kalmarek Date: Thu, 16 Nov 2017 20:01:12 +0100 Subject: [PATCH 3/5] add dim function for Characters --- src/Projections.jl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Projections.jl b/src/Projections.jl index 8990ae6..81d856f 100644 --- a/src/Projections.jl +++ b/src/Projections.jl @@ -22,6 +22,11 @@ end Nemo.isone(p::GroupElem) = p == parent(p)() +function Nemo.dim(χ::PropertyT.PermCharacter) + G = PermutationGroup(sum(χ.p)) + return χ(G()) +end + ## NOTE: this works only for Z/2!!!! function (chi::DirectProdCharacter)(g::DirectProductGroupElem) return reduce(*, 1, ((-1)^isone(g.elts[j]) for j in 1:chi.i)) From da6a2df814f25287d72cc2573344218022e7583a Mon Sep 17 00:00:00 2001 From: kalmarek Date: Fri, 1 Dec 2017 14:12:52 +0100 Subject: [PATCH 4/5] save primal, dual solutions and slack for future warmstart --- src/PropertyT.jl | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/PropertyT.jl b/src/PropertyT.jl index 32d4897..8e150cb 100644 --- a/src/PropertyT.jl +++ b/src/PropertyT.jl @@ -146,7 +146,7 @@ function λandP(name::String, SDP_problem::JuMP.Model, varλ, varP) DefaultFormatter("{date}| {msg}")), "solver_log") - λ, P = compute_λandP(SDP_problem, varλ, varP) + λ, P, warmstart = compute_λandP(SDP_problem, varλ, varP) remove_handler(solver_logger, "solver_log") @@ -155,6 +155,8 @@ function λandP(name::String, SDP_problem::JuMP.Model, varλ, varP) if λ > 0 save(λ_fname, "λ", λ) save(P_fname, "P", P) + @show warmstart[1] + save(joinpath(name, "warmstart.jld"), "warmstart", warmstart) else throw(ErrorException("Solver did not produce a valid solution!: λ = $λ")) end @@ -162,7 +164,7 @@ function λandP(name::String, SDP_problem::JuMP.Model, varλ, varP) end -function compute_λandP(m, varλ, varP) +function compute_λandP(m, varλ, varP; warmstart=nothing) λ = 0.0 P = nothing while λ == 0.0 @@ -170,11 +172,16 @@ function compute_λandP(m, varλ, varP) solve_SDP(m) λ = JuMP.getvalue(varλ) P = JuMP.getvalue(varP) + + p_sol = m.internalModel.primal_sol + d_sol = m.internalModel.dual_sol + s = m.internalModel.slack + catch y warn(solver_logger, y) end end - return λ, P + return λ, P, (p_sol, d_sol, s) end Kazhdan_from_sgap(λ,N) = sqrt(2*λ/N) From 02cdee0708a3a052511894576b0a8e101285b8ab Mon Sep 17 00:00:00 2001 From: kalmarek Date: Fri, 1 Dec 2017 14:13:19 +0100 Subject: [PATCH 5/5] remove old check for the existence of solver.log --- src/PropertyT.jl | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/PropertyT.jl b/src/PropertyT.jl index 8e150cb..7681f46 100644 --- a/src/PropertyT.jl +++ b/src/PropertyT.jl @@ -137,10 +137,6 @@ function λandP(name::String) end function λandP(name::String, SDP_problem::JuMP.Model, varλ, varP) - if exists(joinpath(name, "solver.log")) - rm(joinpath(name, "solver.log")) - end - add_handler(solver_logger, DefaultHandler(joinpath(name, "solver_$(string(now())).log"), DefaultFormatter("{date}| {msg}")),