use Settings type to pass arguments
This commit is contained in:
parent
e868312a2a
commit
2859602639
@ -102,7 +102,9 @@ function main()
|
|||||||
|
|
||||||
solver = SCS.SCSSolver(eps=tol, max_iters=iterations, verbose=true, linearsolver=SCS.Indirect)
|
solver = SCS.SCSSolver(eps=tol, max_iters=iterations, verbose=true, linearsolver=SCS.Indirect)
|
||||||
|
|
||||||
orbit_check_propertyT(logger, dirname, G, S, AutS, solver, upper_bound)
|
sett = Settings(dirname, N, G, S, AutS, radius, solver, upper_bound, tol)
|
||||||
|
|
||||||
|
orbit_check_propertyT(logger, sett)
|
||||||
end
|
end
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
28
Orb_AutFN.jl
28
Orb_AutFN.jl
@ -20,6 +20,18 @@ immutable ProblemData{T}
|
|||||||
dims::Vector{Int}
|
dims::Vector{Int}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
immutable Settings
|
||||||
|
name::String
|
||||||
|
N::Int
|
||||||
|
G::Group
|
||||||
|
S::Vector
|
||||||
|
AutS::Group
|
||||||
|
radius::Int
|
||||||
|
solver::SCSSolver
|
||||||
|
upper_bound::Float64
|
||||||
|
tol::Float64
|
||||||
|
end
|
||||||
|
|
||||||
function sparsify!{T}(U::AbstractArray{T}, eps=eps(T))
|
function sparsify!{T}(U::AbstractArray{T}, eps=eps(T))
|
||||||
# n = rank(U)
|
# n = rank(U)
|
||||||
U[abs.(U) .< eps] = zero(T)
|
U[abs.(U) .< eps] = zero(T)
|
||||||
@ -151,20 +163,20 @@ function init_orbit_data{T<:Nemo.GroupElem}(logger, name::String, G::Nemo.Group,
|
|||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
function orbit_check_propertyT(logger, dirname, G, S, AutS, solver, upper_bound)
|
function orbit_check_propertyT(logger, sett::Settings)
|
||||||
|
|
||||||
init_orbit_data(logger, dirname, G, S, AutS; radius=2)
|
init_orbit_data(logger, sett, radius=sett.radius)
|
||||||
|
|
||||||
Δ = PropertyT.ΔandSDPconstraints(name, G)[1]
|
Δ = float(PropertyT.ΔandSDPconstraints(sett.name, sett.G)[1])
|
||||||
|
|
||||||
fnames = PropertyT.λSDPfilenames(dirname)
|
fnames = PropertyT.λSDPfilenames(sett.name)
|
||||||
|
|
||||||
if all(isfile.(fnames))
|
if all(isfile.(fnames))
|
||||||
λ, P = PropertyT.λandP(dirname)
|
λ, P = PropertyT.λandP(sett.name)
|
||||||
else
|
else
|
||||||
info(logger, "Creating SDP problem...")
|
info(logger, "Creating SDP problem...")
|
||||||
SDP_problem, orb_data = create_SDP_problem(dirname, upper_bound=upper_bound)
|
SDP_problem, orb_data = create_SDP_problem(sett.name, upper_bound=sett.upper_bound)
|
||||||
JuMP.setsolver(SDP_problem, solver)
|
JuMP.setsolver(SDP_problem, sett.solver)
|
||||||
λ, P = λandP(SDP_problem, orb_data)
|
λ, P = λandP(SDP_problem, orb_data)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -174,7 +186,7 @@ function orbit_check_propertyT(logger, dirname, G, S, AutS, solver, upper_bound)
|
|||||||
info(PropertyT.logger, "minimum(P) = $(minimum(P))")
|
info(PropertyT.logger, "minimum(P) = $(minimum(P))")
|
||||||
|
|
||||||
if λ > 0
|
if λ > 0
|
||||||
sgap = PropertyT.check_distance_to_positive_cone(Δ, λ, P, tol=tol, rational=false, len=2*radius)
|
sgap = PropertyT.check_distance_to_positive_cone(Δ, λ, P, tol=sett.tol, rational=false, len=2*sett.radius)
|
||||||
if isa(sgap, Interval)
|
if isa(sgap, Interval)
|
||||||
sgap = sgap.lo
|
sgap = sgap.lo
|
||||||
end
|
end
|
||||||
|
@ -139,7 +139,9 @@ function main()
|
|||||||
|
|
||||||
solver = SCS.SCSSolver(eps=tol, max_iters=iterations, verbose=true, linearsolver=SCS.Indirect)
|
solver = SCS.SCSSolver(eps=tol, max_iters=iterations, verbose=true, linearsolver=SCS.Indirect)
|
||||||
|
|
||||||
orbit_check_propertyT(logger, dirname, G, S, AutS, solver, upper_bound)
|
sett = Settings(dirname, N, G, S, AutS, radius, solver, upper_bound, tol)
|
||||||
|
|
||||||
|
orbit_check_propertyT(logger, sett)
|
||||||
end
|
end
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
Loading…
Reference in New Issue
Block a user