mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-11-19 07:20:28 +01:00
fix Memento deprecations; make clear when logger is global
This commit is contained in:
parent
ce34633df7
commit
fc54803b58
@ -51,10 +51,10 @@ function distance_to_cone{T<:Interval}(elt::GroupRingElem, Q::AbstractArray{T,2}
|
|||||||
SOS_diff = elt - SOS
|
SOS_diff = elt - SOS
|
||||||
|
|
||||||
ɛ_dist = GroupRings.augmentation(SOS_diff)
|
ɛ_dist = GroupRings.augmentation(SOS_diff)
|
||||||
info(logger, "ɛ(∑ξᵢ*ξᵢ) ∈ $(ɛ_dist)")
|
info(LOGGER, "ɛ(∑ξᵢ*ξᵢ) ∈ $(ɛ_dist)")
|
||||||
|
|
||||||
eoi_SOS_L1_dist = norm(SOS_diff,1)
|
eoi_SOS_L1_dist = norm(SOS_diff,1)
|
||||||
info(logger, "‖Δ² - λΔ - ∑ξᵢ*ξᵢ‖₁ ∈ $(eoi_SOS_L1_dist)")
|
info(LOGGER, "‖Δ² - λΔ - ∑ξᵢ*ξᵢ‖₁ ∈ $(eoi_SOS_L1_dist)")
|
||||||
|
|
||||||
dist = 2^(wlen-1)*eoi_SOS_L1_dist
|
dist = 2^(wlen-1)*eoi_SOS_L1_dist
|
||||||
return dist
|
return dist
|
||||||
@ -65,10 +65,10 @@ function distance_to_cone{T}(elt::GroupRingElem, Q::AbstractArray{T,2}, wlen::In
|
|||||||
SOS_diff = elt - SOS
|
SOS_diff = elt - SOS
|
||||||
|
|
||||||
ɛ_dist = GroupRings.augmentation(SOS_diff)
|
ɛ_dist = GroupRings.augmentation(SOS_diff)
|
||||||
info(logger, "ɛ(Δ² - λΔ - ∑ξᵢ*ξᵢ) ≈ $(@sprintf("%.10f", ɛ_dist))")
|
info(LOGGER, "ɛ(Δ² - λΔ - ∑ξᵢ*ξᵢ) ≈ $(@sprintf("%.10f", ɛ_dist))")
|
||||||
|
|
||||||
eoi_SOS_L1_dist = norm(SOS_diff,1)
|
eoi_SOS_L1_dist = norm(SOS_diff,1)
|
||||||
info(logger, "‖Δ² - λΔ - ∑ξᵢ*ξᵢ‖₁ ≈ $(@sprintf("%.10f", eoi_SOS_L1_dist))")
|
info(LOGGER, "‖Δ² - λΔ - ∑ξᵢ*ξᵢ‖₁ ≈ $(@sprintf("%.10f", eoi_SOS_L1_dist))")
|
||||||
|
|
||||||
dist = 2^(wlen-1)*eoi_SOS_L1_dist
|
dist = 2^(wlen-1)*eoi_SOS_L1_dist
|
||||||
return dist
|
return dist
|
||||||
@ -99,7 +99,7 @@ function augIdproj{T}(Q::AbstractArray{T,2}, logger)
|
|||||||
return Q
|
return Q
|
||||||
end
|
end
|
||||||
|
|
||||||
function distance_to_positive_cone(Δ::GroupRingElem, λ, Q, wlen::Int)
|
function distance_to_positive_cone(Δ::GroupRingElem, λ, Q, wlen::Int, logger)
|
||||||
info(logger, "------------------------------------------------------------")
|
info(logger, "------------------------------------------------------------")
|
||||||
info(logger, "λ = $λ")
|
info(logger, "λ = $λ")
|
||||||
info(logger, "Checking in floating-point arithmetic...")
|
info(logger, "Checking in floating-point arithmetic...")
|
||||||
|
@ -79,7 +79,7 @@ function sparsify!{Tv,Ti}(M::SparseMatrixCSC{Tv,Ti}, eps=eps(Tv); verbose=false)
|
|||||||
m = nnz(M)
|
m = nnz(M)
|
||||||
|
|
||||||
if verbose
|
if verbose
|
||||||
info(logger, "Sparsified density:", rpad(densM, 20), " → ", rpad(dens(M), 20))
|
info(LOGGER, "Sparsified density:", rpad(densM, 20), " → ", rpad(dens(M), 20))
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
@ -91,11 +91,11 @@ function sparsify!{T}(M::AbstractArray{T}, eps=eps(T); check=false, verbose=fals
|
|||||||
M[abs.(M) .< eps] .= zero(T)
|
M[abs.(M) .< eps] .= zero(T)
|
||||||
|
|
||||||
if check && rankM != rank(M)
|
if check && rankM != rank(M)
|
||||||
warn(logger, "Sparsification decreased the rank!")
|
warn(LOGGER, "Sparsification decreased the rank!")
|
||||||
end
|
end
|
||||||
|
|
||||||
if verbose
|
if verbose
|
||||||
info(logger, "Sparsified density:", rpad(densM, 20), " → ", rpad(dens(M),20))
|
info(LOGGER, "Sparsified density:", rpad(densM, 20), " → ", rpad(dens(M),20))
|
||||||
end
|
end
|
||||||
|
|
||||||
return sparse(M)
|
return sparse(M)
|
||||||
@ -178,8 +178,8 @@ function init_model(n, sizes)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function create_SDP_problem(sett::Settings)
|
function create_SDP_problem(sett::Settings)
|
||||||
info(logger, "Loading orbit data....")
|
info(LOGGER, "Loading orbit data....")
|
||||||
@logtime logger SDP_problem, orb_data = OrbitData(sett);
|
@logtime LOGGER SDP_problem, orb_data = OrbitData(sett);
|
||||||
|
|
||||||
if sett.upper_bound < Inf
|
if sett.upper_bound < Inf
|
||||||
λ = JuMP.getvariable(SDP_problem, :λ)
|
λ = JuMP.getvariable(SDP_problem, :λ)
|
||||||
@ -187,8 +187,8 @@ function create_SDP_problem(sett::Settings)
|
|||||||
end
|
end
|
||||||
|
|
||||||
t = length(orb_data.laplacian)
|
t = length(orb_data.laplacian)
|
||||||
info(logger, "Adding $t constraints ... ")
|
info(LOGGER, "Adding $t constraints ... ")
|
||||||
@logtime logger addconstraints!(SDP_problem, orb_data)
|
@logtime LOGGER addconstraints!(SDP_problem, orb_data)
|
||||||
|
|
||||||
return SDP_problem, orb_data
|
return SDP_problem, orb_data
|
||||||
end
|
end
|
||||||
@ -201,14 +201,14 @@ function λandP(m::JuMP.Model, data::OrbitData, warmstart=true)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function λandP(m::JuMP.Model, data::OrbitData, sett::Settings)
|
function λandP(m::JuMP.Model, data::OrbitData, sett::Settings)
|
||||||
info(logger, "Solving SDP problem...")
|
info(LOGGER, "Solving SDP problem...")
|
||||||
λ, Ps = λandP(m, data, sett.warmstart)
|
λ, Ps = λandP(m, data, sett.warmstart)
|
||||||
|
|
||||||
info(logger, "Reconstructing P...")
|
info(LOGGER, "Reconstructing P...")
|
||||||
|
|
||||||
preps = load_preps(joinpath(prepath(sett), "preps.jld"), sett.autS)
|
preps = load_preps(joinpath(prepath(sett), "preps.jld"), sett.autS)
|
||||||
|
|
||||||
@logtime logger recP = reconstruct_sol(preps, data.Us, Ps, data.dims)
|
@logtime LOGGER recP = reconstruct_sol(preps, data.Us, Ps, data.dims)
|
||||||
|
|
||||||
fname = PropertyT.λSDPfilenames(fullpath(sett))[2]
|
fname = PropertyT.λSDPfilenames(fullpath(sett))[2]
|
||||||
save(fname, "origP", Ps, "P", recP)
|
save(fname, "origP", Ps, "P", recP)
|
||||||
@ -229,22 +229,22 @@ end
|
|||||||
|
|
||||||
function check_property_T(sett::Settings)
|
function check_property_T(sett::Settings)
|
||||||
|
|
||||||
init_orbit_data(logger, sett, radius=sett.radius)
|
init_orbit_data(LOGGER, sett, radius=sett.radius)
|
||||||
|
|
||||||
if !sett.warmstart && all(isfile.(λSDPfilenames(fullpath(sett))))
|
if !sett.warmstart && all(isfile.(λSDPfilenames(fullpath(sett))))
|
||||||
λ, P = PropertyT.λandP(fullpath(sett))
|
λ, P = PropertyT.λandP(fullpath(sett))
|
||||||
else
|
else
|
||||||
info(logger, "Creating SDP problem...")
|
info(LOGGER, "Creating SDP problem...")
|
||||||
SDP_problem, orb_data = create_SDP_problem(sett)
|
SDP_problem, orb_data = create_SDP_problem(sett)
|
||||||
JuMP.setsolver(SDP_problem, sett.solver)
|
JuMP.setsolver(SDP_problem, sett.solver)
|
||||||
|
|
||||||
λ, P = λandP(SDP_problem, orb_data, sett)
|
λ, P = λandP(SDP_problem, orb_data, sett)
|
||||||
end
|
end
|
||||||
|
|
||||||
info(logger, "λ = $λ")
|
info(LOGGER, "λ = $λ")
|
||||||
info(logger, "sum(P) = $(sum(P))")
|
info(LOGGER, "sum(P) = $(sum(P))")
|
||||||
info(logger, "maximum(P) = $(maximum(P))")
|
info(LOGGER, "maximum(P) = $(maximum(P))")
|
||||||
info(logger, "minimum(P) = $(minimum(P))")
|
info(LOGGER, "minimum(P) = $(minimum(P))")
|
||||||
|
|
||||||
if λ > 0
|
if λ > 0
|
||||||
pm_fname, Δ_fname = pmΔfilenames(prepath(sett))
|
pm_fname, Δ_fname = pmΔfilenames(prepath(sett))
|
||||||
@ -254,24 +254,24 @@ function check_property_T(sett::Settings)
|
|||||||
isapprox(eigvals(P), abs.(eigvals(P)), atol=sett.tol) ||
|
isapprox(eigvals(P), abs.(eigvals(P)), atol=sett.tol) ||
|
||||||
warn("The solution matrix doesn't seem to be positive definite!")
|
warn("The solution matrix doesn't seem to be positive definite!")
|
||||||
# @assert P == Symmetric(P)
|
# @assert P == Symmetric(P)
|
||||||
@logtime logger Q = real(sqrtm(Symmetric(P)))
|
@logtime LOGGER Q = real(sqrtm(Symmetric(P)))
|
||||||
|
|
||||||
sgap = distance_to_positive_cone(Δ, λ, Q, 2*sett.radius)
|
sgap = distance_to_positive_cone(Δ, λ, Q, 2*sett.radius, LOGGER)
|
||||||
if isa(sgap, Interval)
|
if isa(sgap, Interval)
|
||||||
sgap = sgap.lo
|
sgap = sgap.lo
|
||||||
end
|
end
|
||||||
if sgap > 0
|
if sgap > 0
|
||||||
info(logger, "λ ≥ $(Float64(trunc(sgap,12)))")
|
info(LOGGER, "λ ≥ $(Float64(trunc(sgap,12)))")
|
||||||
Kazhdan_κ = PropertyT.Kazhdan_from_sgap(sgap, length(sett.S))
|
Kazhdan_κ = PropertyT.Kazhdan_from_sgap(sgap, length(sett.S))
|
||||||
Kazhdan_κ = Float64(trunc(Kazhdan_κ, 12))
|
Kazhdan_κ = Float64(trunc(Kazhdan_κ, 12))
|
||||||
info(logger, "κ($(sett.name), S) ≥ $Kazhdan_κ: Group HAS property (T)!")
|
info(LOGGER, "κ($(sett.name), S) ≥ $Kazhdan_κ: Group HAS property (T)!")
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
sgap = Float64(trunc(sgap, 12))
|
sgap = Float64(trunc(sgap, 12))
|
||||||
info(logger, "λ($(sett.name), S) ≥ $sgap: Group may NOT HAVE property (T)!")
|
info(LOGGER, "λ($(sett.name), S) ≥ $sgap: Group may NOT HAVE property (T)!")
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
info(logger, "κ($(sett.name), S) ≥ $λ < 0: Tells us nothing about property (T)")
|
info(LOGGER, "κ($(sett.name), S) ≥ $λ < 0: Tells us nothing about property (T)")
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
@ -12,19 +12,21 @@ using MathProgBase
|
|||||||
|
|
||||||
using Memento
|
using Memento
|
||||||
|
|
||||||
const logger = Memento.config("info", fmt="{msg}")
|
const LOGGER = Memento.config("info", fmt="{msg}")
|
||||||
const solver_logger = Memento.config("info", fmt="{msg}")
|
const LOGGER_SOLVER = Memento.config("info", fmt="{msg}")
|
||||||
|
|
||||||
function setup_logging(name::String)
|
function setup_logging(name::String)
|
||||||
isdir(name) || mkdir(name)
|
isdir(name) || mkdir(name)
|
||||||
|
|
||||||
Memento.add_handler(logger,
|
handler = Memento.DefaultHandler(
|
||||||
Memento.DefaultHandler(joinpath(name,"full_$(string((now()))).log"),
|
joinpath(name,"full_$(string((now()))).log"), Memento.DefaultFormatter("{date}| {msg}")
|
||||||
Memento.DefaultFormatter("{date}| {msg}")), "full_log")
|
)
|
||||||
|
handler.levels.x = LOGGER.levels
|
||||||
|
LOGGER.handlers["full_log"] = handler
|
||||||
|
|
||||||
e = redirect_stderr(logger.handlers["full_log"].io)
|
e = redirect_stderr(logger.handlers["full_log"].io)
|
||||||
|
|
||||||
return logger
|
return logger
|
||||||
end
|
end
|
||||||
|
|
||||||
macro logtime(logger, ex)
|
macro logtime(logger, ex)
|
||||||
@ -35,7 +37,7 @@ macro logtime(logger, ex)
|
|||||||
elapsedtime = Base.time_ns() - elapsedtime
|
elapsedtime = Base.time_ns() - elapsedtime
|
||||||
local diff = Base.GC_Diff(Base.gc_num(), stats)
|
local diff = Base.GC_Diff(Base.gc_num(), stats)
|
||||||
local ts = time_string(elapsedtime, diff.allocd, diff.total_time,
|
local ts = time_string(elapsedtime, diff.allocd, diff.total_time,
|
||||||
Base.gc_alloc_count(diff))
|
Base.gc_alloc_count(diff))
|
||||||
esc(info(logger, ts))
|
esc(info(logger, ts))
|
||||||
val
|
val
|
||||||
end
|
end
|
||||||
@ -85,7 +87,7 @@ function λSDPfilenames(prefix::String)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function ΔandSDPconstraints(prefix::String, G::Group)
|
function ΔandSDPconstraints(prefix::String, G::Group)
|
||||||
info(logger, "Loading precomputed pm, Δ, sdp_constraints...")
|
info(LOGGER, "Loading precomputed pm, Δ, sdp_constraints...")
|
||||||
pm_fname, Δ_fname = pmΔfilenames(prefix)
|
pm_fname, Δ_fname = pmΔfilenames(prefix)
|
||||||
|
|
||||||
product_matrix = load(pm_fname, "pm")
|
product_matrix = load(pm_fname, "pm")
|
||||||
@ -98,7 +100,7 @@ function ΔandSDPconstraints(prefix::String, G::Group)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function ΔandSDPconstraints{T<:GroupElem}(name::String, S::Vector{T}, Id::T; radius::Int=2)
|
function ΔandSDPconstraints{T<:GroupElem}(name::String, S::Vector{T}, Id::T; radius::Int=2)
|
||||||
info(logger, "Computing pm, Δ, sdp_constraints...")
|
info(LOGGER, "Computing pm, Δ, sdp_constraints...")
|
||||||
Δ, sdp_constraints = ΔandSDPconstraints(S, Id, radius=radius)
|
Δ, sdp_constraints = ΔandSDPconstraints(S, Id, radius=radius)
|
||||||
pm_fname, Δ_fname = pmΔfilenames(name)
|
pm_fname, Δ_fname = pmΔfilenames(name)
|
||||||
save(pm_fname, "pm", parent(Δ).pm)
|
save(pm_fname, "pm", parent(Δ).pm)
|
||||||
@ -107,14 +109,14 @@ function ΔandSDPconstraints{T<:GroupElem}(name::String, S::Vector{T}, Id::T; ra
|
|||||||
end
|
end
|
||||||
|
|
||||||
function ΔandSDPconstraints{T<:GroupElem}(S::Vector{T}, Id::T; radius::Int=2)
|
function ΔandSDPconstraints{T<:GroupElem}(S::Vector{T}, Id::T; radius::Int=2)
|
||||||
info(logger, "Generating balls of sizes $sizes")
|
info(LOGGER, "Generating balls of sizes $sizes")
|
||||||
@logtime logger E_R, sizes = Groups.generate_balls(S, Id, radius=2*radius)
|
@logtime LOGGER E_R, sizes = Groups.generate_balls(S, Id, radius=2*radius)
|
||||||
|
|
||||||
info(logger, "Creating product matrix...")
|
info(LOGGER, "Creating product matrix...")
|
||||||
@logtime logger pm = GroupRings.create_pm(E_R, GroupRings.reverse_dict(E_R), sizes[radius]; twisted=true)
|
@logtime LOGGER pm = GroupRings.create_pm(E_R, GroupRings.reverse_dict(E_R), sizes[radius]; twisted=true)
|
||||||
|
|
||||||
info(logger, "Creating sdp_constratints...")
|
info(LOGGER, "Creating sdp_constratints...")
|
||||||
@logtime logger sdp_constraints = PropertyT.constraints(pm)
|
@logtime LOGGER sdp_constraints = PropertyT.constraints(pm)
|
||||||
|
|
||||||
RG = GroupRing(parent(Id), E_R, pm)
|
RG = GroupRing(parent(Id), E_R, pm)
|
||||||
|
|
||||||
@ -128,7 +130,7 @@ function λandP(name::String)
|
|||||||
f₂ = exists(SDP_fname)
|
f₂ = exists(SDP_fname)
|
||||||
|
|
||||||
if f₁ && f₂
|
if f₁ && f₂
|
||||||
info(logger, "Loading precomputed λ, P...")
|
info(LOGGER, "Loading precomputed λ, P...")
|
||||||
λ = load(λ_fname, "λ")
|
λ = load(λ_fname, "λ")
|
||||||
P = load(SDP_fname, "P")
|
P = load(SDP_fname, "P")
|
||||||
else
|
else
|
||||||
@ -138,10 +140,14 @@ function λandP(name::String)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function λandP(name::String, SDP_problem::JuMP.Model, varλ, varP, warmstart=false)
|
function λandP(name::String, SDP_problem::JuMP.Model, varλ, varP, warmstart=false)
|
||||||
add_handler(solver_logger,
|
|
||||||
DefaultHandler(joinpath(name, "solver_$(string(now())).log"),
|
handler = DefaultHandler(
|
||||||
DefaultFormatter("{date}| {msg}")),
|
joinpath(name, "solver_$(string(now())).log"),
|
||||||
"solver_log")
|
DefaultFormatter("{date}| {msg}")
|
||||||
|
)
|
||||||
|
handler.levels.x = LOGGER_SOLVER.levels
|
||||||
|
LOGGER_SOLVER.handlers["solver_log"] = handler
|
||||||
|
|
||||||
if warmstart && isfile(joinpath(name, "warmstart.jld"))
|
if warmstart && isfile(joinpath(name, "warmstart.jld"))
|
||||||
ws = load(joinpath(name, "warmstart.jld"), "warmstart")
|
ws = load(joinpath(name, "warmstart.jld"), "warmstart")
|
||||||
else
|
else
|
||||||
@ -150,7 +156,7 @@ function λandP(name::String, SDP_problem::JuMP.Model, varλ, varP, warmstart=fa
|
|||||||
|
|
||||||
λ, P, warmstart = compute_λandP(SDP_problem, varλ, varP, warmstart=ws)
|
λ, P, warmstart = compute_λandP(SDP_problem, varλ, varP, warmstart=ws)
|
||||||
|
|
||||||
remove_handler(solver_logger, "solver_log")
|
delete!(LOGGER_SOLVER.handlers, "solver_log")
|
||||||
|
|
||||||
λ_fname, P_fname = λSDPfilenames(name)
|
λ_fname, P_fname = λSDPfilenames(name)
|
||||||
|
|
||||||
@ -276,7 +282,7 @@ function compute_λandP(m, varλ, varP; warmstart=nothing)
|
|||||||
solve_SDP(m)
|
solve_SDP(m)
|
||||||
λ = MathProgBase.getobjval(m.internalModel)
|
λ = MathProgBase.getobjval(m.internalModel)
|
||||||
catch y
|
catch y
|
||||||
warn(solver_logger, y)
|
warn(LOGGER_SOLVER, y)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -308,7 +314,7 @@ function check_property_T(name::String, S, Id, solver, upper_bound, tol, radius)
|
|||||||
if all(exists.(λSDPfilenames(name)))
|
if all(exists.(λSDPfilenames(name)))
|
||||||
λ, P = λandP(name)
|
λ, P = λandP(name)
|
||||||
else
|
else
|
||||||
info(logger, "Creating SDP problem...")
|
info(LOGGER, "Creating SDP problem...")
|
||||||
SDP_problem, λ, P = create_SDP_problem(Δ, sdp_constraints, upper_bound=upper_bound)
|
SDP_problem, λ, P = create_SDP_problem(Δ, sdp_constraints, upper_bound=upper_bound)
|
||||||
JuMP.setsolver(SDP_problem, solver)
|
JuMP.setsolver(SDP_problem, solver)
|
||||||
|
|
||||||
@ -316,10 +322,10 @@ function check_property_T(name::String, S, Id, solver, upper_bound, tol, radius)
|
|||||||
λ, P = λandP(name, SDP_problem, λ, P)
|
λ, P = λandP(name, SDP_problem, λ, P)
|
||||||
end
|
end
|
||||||
|
|
||||||
info(logger, "λ = $λ")
|
info(LOGGER, "λ = $λ")
|
||||||
info(logger, "sum(P) = $(sum(P))")
|
info(LOGGER, "sum(P) = $(sum(P))")
|
||||||
info(logger, "maximum(P) = $(maximum(P))")
|
info(LOGGER, "maximum(P) = $(maximum(P))")
|
||||||
info(logger, "minimum(P) = $(minimum(P))")
|
info(LOGGER, "minimum(P) = $(minimum(P))")
|
||||||
|
|
||||||
if λ > 0
|
if λ > 0
|
||||||
pm_fname, Δ_fname = pmΔfilenames(name)
|
pm_fname, Δ_fname = pmΔfilenames(name)
|
||||||
@ -329,25 +335,25 @@ function check_property_T(name::String, S, Id, solver, upper_bound, tol, radius)
|
|||||||
isapprox(eigvals(P), abs(eigvals(P)), atol=tol) ||
|
isapprox(eigvals(P), abs(eigvals(P)), atol=tol) ||
|
||||||
warn("The solution matrix doesn't seem to be positive definite!")
|
warn("The solution matrix doesn't seem to be positive definite!")
|
||||||
# @assert P == Symmetric(P)
|
# @assert P == Symmetric(P)
|
||||||
@logtime logger Q = real(sqrtm(Symmetric(P)))
|
@logtime LOGGER Q = real(sqrtm(Symmetric(P)))
|
||||||
|
|
||||||
sgap = distance_to_positive_cone(Δ, λ, Q, 2*radius)
|
sgap = distance_to_positive_cone(Δ, λ, Q, 2*radius, LOGGER)
|
||||||
if isa(sgap, Interval)
|
if isa(sgap, Interval)
|
||||||
sgap = sgap.lo
|
sgap = sgap.lo
|
||||||
end
|
end
|
||||||
if sgap > 0
|
if sgap > 0
|
||||||
info(logger, "λ ≥ $(Float64(trunc(sgap,12)))")
|
info(LOGGER, "λ ≥ $(Float64(trunc(sgap,12)))")
|
||||||
Kazhdan_κ = Kazhdan_from_sgap(sgap, length(S))
|
Kazhdan_κ = Kazhdan_from_sgap(sgap, length(S))
|
||||||
Kazhdan_κ = Float64(trunc(Kazhdan_κ, 12))
|
Kazhdan_κ = Float64(trunc(Kazhdan_κ, 12))
|
||||||
info(logger, "κ($name, S) ≥ $Kazhdan_κ: Group HAS property (T)!")
|
info(LOGGER, "κ($name, S) ≥ $Kazhdan_κ: Group HAS property (T)!")
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
sgap = Float64(trunc(sgap, 12))
|
sgap = Float64(trunc(sgap, 12))
|
||||||
info(logger, "λ($name, S) ≥ $sgap: Group may NOT HAVE property (T)!")
|
info(LOGGER, "λ($name, S) ≥ $sgap: Group may NOT HAVE property (T)!")
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
info(logger, "κ($name, S) ≥ $λ < 0: Tells us nothing about property (T)")
|
info(LOGGER, "κ($name, S) ≥ $λ < 0: Tells us nothing about property (T)")
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
10
src/SDPs.jl
10
src/SDPs.jl
@ -56,20 +56,20 @@ function create_SDP_problem(Δ::GroupRingElem, matrix_constraints; upper_bound=I
|
|||||||
end
|
end
|
||||||
|
|
||||||
function solve_SDP(SDP_problem)
|
function solve_SDP(SDP_problem)
|
||||||
info(logger, Base.repr(SDP_problem))
|
info(LOGGER, Base.repr(SDP_problem))
|
||||||
|
|
||||||
o = redirect_stdout(solver_logger.handlers["solver_log"].io)
|
o = redirect_stdout(LOGGER_SOLVER.handlers["solver_log"].io)
|
||||||
Base.Libc.flush_cstdio()
|
Base.Libc.flush_cstdio()
|
||||||
|
|
||||||
@logtime logger solution_status = MathProgBase.optimize!(SDP_problem.internalModel)
|
@logtime LOGGER solution_status = MathProgBase.optimize!(SDP_problem.internalModel)
|
||||||
Base.Libc.flush_cstdio()
|
Base.Libc.flush_cstdio()
|
||||||
|
|
||||||
redirect_stdout(o)
|
redirect_stdout(o)
|
||||||
|
|
||||||
if solution_status != :Optimal
|
if solution_status != :Optimal
|
||||||
warn(logger, "The solver did not solve the problem successfully!")
|
warn(LOGGER, "The solver did not solve the problem successfully!")
|
||||||
end
|
end
|
||||||
info(logger, solution_status)
|
info(LOGGER, solution_status)
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user