rename ProblemData -> OrbitData

This commit is contained in:
kalmar 2017-06-08 21:38:14 +02:00
parent 34cb1c80ab
commit 633f2222c8

View File

@ -10,7 +10,7 @@ using ArgParse
include("OrbitDecomposition.jl")
immutable ProblemData{T}
immutable OrbitData
name::String
Us::Vector
Ps::Vector{Array{JuMP.Variable,2}}
@ -59,7 +59,7 @@ function init_model(Uπs)
return m, P
end
function init_ProblemData(name::String)
function init_OrbitData(name::String)
splap = load(joinpath(name, "delta.jld"), "Δ");
pm = load(joinpath(name, "pm.jld"), "pm");
cnstr = PropertyT.constraints_from_pm(pm);
@ -78,9 +78,9 @@ function init_ProblemData(name::String)
orb_splap = orbit_spvector(splap, orbits)
orb_splap² = orbit_spvector(splap², orbits)
orb_SOutF4data = ProblemData(name, Uπs, P, orb_spcnstrm, orb_splap, orb_splap², dims);
orbData = OrbitData(name, Uπs, P, orb_spcnstrm, orb_splap, orb_splap², dims);
return m, orb_SOutF4data
return m, orbData
end
function transform{T}(U::AbstractArray{T,2}, V::AbstractArray{T,2}, eps=eps(T))
@ -90,15 +90,15 @@ function transform{T}(U::AbstractArray{T,2}, V::AbstractArray{T,2}, eps=eps(T))
return w
end
A(data::ProblemData, π, t) = data.dims[π]*transform(data.Us[π], data.cnstr[t])
A(data::OrbitData, π, t) = data.dims[π]*transform(data.Us[π], data.cnstr[t])
function constrLHS(m::JuMP.Model, data::ProblemData, t)
function constrLHS(m::JuMP.Model, data::OrbitData, t)
l = endof(data.Us)
lhs = @expression(m, sum(vecdot(A(data, π, t), data.Ps[π]) for π in 1:l))
return lhs
end
function addconstraints!(m::JuMP.Model, data::ProblemData, l::Int=length(data.cnstr); var::Symbol = )
function addconstraints!(m::JuMP.Model, data::OrbitData, l::Int=length(data.cnstr); var::Symbol = )
λ = getvariable(m, var)
for t in 1:l
d, = data.laplacian[t], data.laplacianSq[t]
@ -115,14 +115,14 @@ function addconstraints!(m::JuMP.Model, data::ProblemData, l::Int=length(data.cn
end
end
function reconstructP(m::JuMP.Model, data::ProblemData)
function reconstructP(m::JuMP.Model, data::OrbitData)
computedPs = [getvalue(P) for P in data.Ps]
return sum(data.dims[π]*data.Us[π]*computedPs[π]*data.Us[π]' for π in 1:endof(data.Ps))
end
function create_SDP_problem(name::String; upper_bound=Inf)
info(PropertyT.logger, "Loading data....")
t = @timed SDP_problem, orb_data = init_ProblemData(name);
t = @timed SDP_problem, orb_data = init_OrbitData(name);
info(PropertyT.logger, PropertyT.timed_msg(t))
if upper_bound < Inf
@ -137,7 +137,7 @@ function create_SDP_problem(name::String; upper_bound=Inf)
return SDP_problem, orb_data
end
function λandP(m::JuMP.Model, data::ProblemData)
function λandP(m::JuMP.Model, data::OrbitData)
info(PropertyT.logger, "Solving SDP problem...")
varλ = JuMP.getvariable(m, )
varP = data.Ps