mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-10-19 09:05:36 +02:00
use prepath/fullpath(::Settings) in OrbitData
and in create_SDP_problem generation
This commit is contained in:
parent
36a1151a73
commit
b3f1961fbf
@ -30,27 +30,27 @@ immutable OrbitData
|
|||||||
dims::Vector{Int}
|
dims::Vector{Int}
|
||||||
end
|
end
|
||||||
|
|
||||||
function OrbitData(name::String)
|
function OrbitData(sett::Settings)
|
||||||
splap = load(joinpath(name, "delta.jld"), "Δ");
|
splap = load(joinpath(prepath(sett), "delta.jld"), "Δ");
|
||||||
pm = load(joinpath(name, "pm.jld"), "pm");
|
pm = load(joinpath(prepath(sett), "pm.jld"), "pm");
|
||||||
cnstr = PropertyT.constraints_from_pm(pm);
|
cnstr = PropertyT.constraints_from_pm(pm);
|
||||||
splap² = similar(splap)
|
splap² = similar(splap)
|
||||||
splap² = GroupRings.mul!(splap², splap, splap, pm);
|
splap² = GroupRings.mul!(splap², splap, splap, pm);
|
||||||
|
|
||||||
# Uπs = load(joinpath(name, "U_pis.jld"), "Uπs");
|
# Uπs = load(joinpath(name, "U_pis.jld"), "Uπs");
|
||||||
Uπs = load(joinpath(name, "U_pis.jld"), "spUπs");
|
Uπs = load(joinpath(prepath(sett), "U_pis.jld"), "spUπs");
|
||||||
#dimensions of the corresponding πs:
|
#dimensions of the corresponding πs:
|
||||||
dims = load(joinpath(name, "U_pis.jld"), "dims")
|
dims = load(joinpath(prepath(sett), "U_pis.jld"), "dims")
|
||||||
|
|
||||||
m, P = init_model(Uπs);
|
m, P = init_model(Uπs);
|
||||||
|
|
||||||
orbits = load(joinpath(name, "orbits.jld"), "orbits");
|
orbits = load(joinpath(prepath(sett), "orbits.jld"), "orbits");
|
||||||
n = size(Uπs[1],1)
|
n = size(Uπs[1],1)
|
||||||
orb_spcnstrm = [orbit_constraint(cnstr[collect(orb)], n) for orb in orbits]
|
orb_spcnstrm = [orbit_constraint(cnstr[collect(orb)], n) for orb in orbits]
|
||||||
orb_splap = orbit_spvector(splap, orbits)
|
orb_splap = orbit_spvector(splap, orbits)
|
||||||
orb_splap² = orbit_spvector(splap², orbits)
|
orb_splap² = orbit_spvector(splap², orbits)
|
||||||
|
|
||||||
orbData = OrbitData(name, Uπs, P, orb_spcnstrm, orb_splap, orb_splap², dims);
|
orbData = OrbitData(fullpath(sett), Uπs, P, orb_spcnstrm, orb_splap, orb_splap², dims);
|
||||||
|
|
||||||
# orbData = OrbitData(name, Uπs, P, orb_spcnstrm, splap, splap², dims);
|
# orbData = OrbitData(name, Uπs, P, orb_spcnstrm, splap, splap², dims);
|
||||||
|
|
||||||
@ -175,14 +175,14 @@ function init_model(Uπs)
|
|||||||
return m, P
|
return m, P
|
||||||
end
|
end
|
||||||
|
|
||||||
function create_SDP_problem(name::String; upper_bound=Inf)
|
function create_SDP_problem(sett::Settings)
|
||||||
info(logger, "Loading orbit data....")
|
info(logger, "Loading orbit data....")
|
||||||
t = @timed SDP_problem, orb_data = OrbitData(name);
|
t = @timed SDP_problem, orb_data = OrbitData(sett);
|
||||||
info(logger, PropertyT.timed_msg(t))
|
info(logger, PropertyT.timed_msg(t))
|
||||||
|
|
||||||
if upper_bound < Inf
|
if sett.upper_bound < Inf
|
||||||
λ = JuMP.getvariable(SDP_problem, :λ)
|
λ = JuMP.getvariable(SDP_problem, :λ)
|
||||||
JuMP.@constraint(SDP_problem, λ <= upper_bound)
|
JuMP.@constraint(SDP_problem, λ <= sett.upper_bound)
|
||||||
end
|
end
|
||||||
|
|
||||||
t = length(orb_data.laplacian)
|
t = length(orb_data.laplacian)
|
||||||
@ -227,7 +227,7 @@ function check_property_T(sett::Settings)
|
|||||||
λ, P = PropertyT.λandP(sett.name)
|
λ, P = PropertyT.λandP(sett.name)
|
||||||
else
|
else
|
||||||
info(logger, "Creating SDP problem...")
|
info(logger, "Creating SDP problem...")
|
||||||
SDP_problem, orb_data = create_SDP_problem(sett.name, upper_bound=sett.upper_bound)
|
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user