1
0
mirror of https://github.com/kalmarek/PropertyT.jl.git synced 2024-12-27 18:55:30 +01:00

reshuffle sos_sdps for clarity

This commit is contained in:
Marek Kaluba 2023-04-04 23:50:48 +02:00
parent 150b5c2cba
commit 5b4a7f6804
No known key found for this signature in database
GPG Key ID: 8BF1A3855328FC15

View File

@ -198,8 +198,19 @@ function sos_problem_primal(
b = basis(parent(elt)) b = basis(parent(elt))
return sparsevec([b[one(first(b))]], [1 // 1], length(v)) == v return sparsevec([b[one(first(b))]], [1 // 1], length(v)) == v
end end
prog = ProgressMeter.Progress(
length(invariant_vectors(wedderburn));
dt = 1,
desc = "Adding constraints: ",
enabled = show_progress,
barlen = 60,
showspeed = true,
)
feasibility_problem = iszero(orderunit) feasibility_problem = iszero(orderunit)
# problem creation starts here
model = JuMP.Model() model = JuMP.Model()
if !feasibility_problem # add λ or not? if !feasibility_problem # add λ or not?
λ = JuMP.@variable(model, λ) λ = JuMP.@variable(model, λ)
@ -221,27 +232,19 @@ function sos_problem_primal(
return P return P
end end
begin # preallocating begin # Ms are preallocated for the constraints loop
T = eltype(wedderburn) T = eltype(wedderburn)
Ms = [spzeros.(T, size(p)...) for p in P] Ms = [spzeros.(T, size(p)...) for p in Ps]
M_orb = zeros(T, size(parent(elt).mstructure)...) _eps = 10 * eps(T) * max(size(parent(elt).mstructure)...)
end end
X = convert(Vector{T}, StarAlgebras.coeffs(elt)) X = StarAlgebras.coeffs(elt)
U = convert(Vector{T}, StarAlgebras.coeffs(orderunit)) U = StarAlgebras.coeffs(orderunit)
# defining constraints based on the multiplicative structure # defining constraints based on the multiplicative structure
cnstrs = constraints(parent(elt); augmented = augmented) cnstrs = constraints(parent(elt); augmented = augmented)
prog = ProgressMeter.Progress( # adding linear constraints: one per orbit
length(invariant_vectors(wedderburn));
dt = 1,
desc = "Adding constraints: ",
enabled = show_progress,
barlen = 60,
showspeed = true,
)
for (i, iv) in enumerate(invariant_vectors(wedderburn)) for (i, iv) in enumerate(invariant_vectors(wedderburn))
ProgressMeter.next!(prog; showvalues = __show_itrs(i, prog.n)) ProgressMeter.next!(prog; showvalues = __show_itrs(i, prog.n))
augmented && i == id_one && continue augmented && i == id_one && continue