Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Other approach #78

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions examples/sos_problem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,45 @@ function sos_problem(
return m
end

function other_way(
poly::AbstractPolynomial,
wedderburn::SymbolicWedderburn.WedderburnDecomposition,
basis_psd;
)
m = JuMP.Model()

JuMP.@variable m t
JuMP.@objective m Max t
psds = map(SymbolicWedderburn.direct_summands(wedderburn)) do ds
dim = size(ds, 1)
P = JuMP.@variable m [1:dim, 1:dim] Symmetric
JuMP.@constraint m P in PSDCone()
return P
end

C = DynamicPolynomials.coefficients(
poly - t,
SymbolicWedderburn.basis(wedderburn),
)
equations = [-dot(C, iv) for iv in invariant_vectors(wedderburn)]
for ds in SymbolicWedderburn.direct_summands(wedderburn)
dim = size(ds, 1)
P = JuMP.@variable(m, [1:dim, 1:dim] in PSDCone())
U = image_basis(ds)
q = U * basis_psd
for j in 1:dim
for i in 1:dim
qq = SA.star(q[i]) * q[j]
for (k, iv) in enumerate(invariant_vectors(wedderburn))
MA.operate!(MA.add_mul, equations[k], dot(qq, iv), P[i, j])
end
end
end
end
@constraint(m, equations in Zeros())
return m
end

function sos_problem(
poly::AbstractPolynomial,
G::Group,
Expand Down
Loading