1
0
mirror of https://github.com/kalmarek/PropertyT.jl.git synced 2024-11-14 14:15:28 +01:00

move functions around

This commit is contained in:
kalmar 2017-06-22 15:11:14 +02:00
parent f6155d8382
commit b881a40721

View File

@ -81,26 +81,17 @@ end
sparsify{T}(U::SparseMatrixCSC{T}, eps=eps(T)) = sparsify!(deepcopy(U), eps)
function init_model(Uπs)
m = JuMP.Model();
l = size(Uπs,1)
P = Vector{Array{JuMP.Variable,2}}(l)
for k in 1:l
s = size(Uπs[k],2)
P[k] = JuMP.@variable(m, [i=1:s, j=1:s])
JuMP.@SDconstraint(m, P[k] >= 0.0)
end
JuMP.@variable(m, λ >= 0.0)
JuMP.@objective(m, Max, λ)
return m, P
end
function init_orbit_data(logger, sett::Settings; radius=2)
ex(fname) = isfile(joinpath(sett.name, fname))
files_exists = ex.(["delta.jld", "pm.jld", "U_pis.jld", "orbits.jld"])
if !all(files_exists)
compute_orbit_data(logger, sett.name, sett.G, sett.S, sett.AutS, radius=radius)
end
return 0
end
function transform(U::AbstractArray, V::AbstractArray; sparse=false)
@ -138,6 +129,22 @@ function addconstraints!(m::JuMP.Model, data::OrbitData, l::Int=length(data.lapl
end
end
function init_model(Uπs)
m = JuMP.Model();
l = size(Uπs,1)
P = Vector{Array{JuMP.Variable,2}}(l)
for k in 1:l
s = size(Uπs[k],2)
P[k] = JuMP.@variable(m, [i=1:s, j=1:s])
JuMP.@SDconstraint(m, P[k] >= 0.0)
end
JuMP.@variable(m, λ >= 0.0)
JuMP.@objective(m, Max, λ)
return m, P
end
function create_SDP_problem(name::String; upper_bound=Inf)
info(PropertyT.logger, "Loading orbit data....")
t = @timed SDP_problem, orb_data = OrbitData(name);
@ -176,19 +183,6 @@ function λandP(m::JuMP.Model, data::OrbitData, sett::Settings)
return λ, recP
end
function init_orbit_data(logger, sett::Settings; radius=2)
ex(fname) = isfile(joinpath(sett.name, fname))
files_exists = ex.(["delta.jld", "pm.jld", "U_pis.jld", "orbits.jld"])
if !all(files_exists)
compute_orbit_data(logger, sett.name, sett.G, sett.S, sett.AutS, radius=radius)
end
return 0
end
function orbit_check_propertyT(logger, sett::Settings)
init_orbit_data(logger, sett, radius=sett.radius)