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

init model on number and size of SD blocks, not on Uπs

This commit is contained in:
kalmarek 2017-11-08 10:02:38 +01:00
parent bcbf8a03c8
commit ea6a6722be

View File

@ -43,7 +43,7 @@ function OrbitData(sett::Settings)
#dimensions of the corresponding πs: #dimensions of the corresponding πs:
dims = load(joinpath(prepath(sett), "U_pis.jld"), "dims") dims = load(joinpath(prepath(sett), "U_pis.jld"), "dims")
m, P = init_model(Uπs); m, P = init_model(size(Uπs,1), [size(U,2) for U in Uπs]);
orbits = load(joinpath(prepath(sett), "orbits.jld"), "orbits"); orbits = load(joinpath(prepath(sett), "orbits.jld"), "orbits");
n = size(Uπs[1],1) n = size(Uπs[1],1)
@ -160,13 +160,11 @@ function addconstraints!(m::JuMP.Model, data::OrbitData, l::Int=length(data.lapl
println("") println("")
end end
function init_model(s) function init_model(n, sizes)
m = JuMP.Model(); m = JuMP.Model();
l = size(Uπs,1) P = Vector{Array{JuMP.Variable,2}}(n)
P = Vector{Array{JuMP.Variable,2}}(l)
for k in 1:l for (k,s) in enumerate(sizes)
s = size(Uπs[k],2)
P[k] = JuMP.@variable(m, [i=1:s, j=1:s]) P[k] = JuMP.@variable(m, [i=1:s, j=1:s])
JuMP.@SDconstraint(m, P[k] >= 0.0) JuMP.@SDconstraint(m, P[k] >= 0.0)
end end