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

modernize naive sdp formulation

This commit is contained in:
kalmarek 2019-08-02 11:52:19 +02:00
parent e3a58fdef0
commit a5a3d9d069
No known key found for this signature in database
GPG Key ID: 8BF1A3855328FC15

View File

@ -47,7 +47,8 @@ function SOS_problem(X::GroupRingElem, orderunit::GroupRingElem; upper_bound::Fl
m = JuMP.Model();
JuMP.@variable(m, P[1:N, 1:N])
JuMP.@constraint(m, P in PSDCone())
# SP = Symmetric(P)
JuMP.@constraint(m, sdp, P in PSDCone())
JuMP.@constraint(m, sum(P[i] for i in eachindex(P)) == 0)
if upper_bound < Inf
@ -57,9 +58,11 @@ function SOS_problem(X::GroupRingElem, orderunit::GroupRingElem; upper_bound::Fl
end
cnstrs = constraints(parent(X).pm)
for (constraint_indices, x, u) in zip(cnstrs, X.coeffs, orderunit.coeffs)
JuMP.@constraint(m, x - λ*u == sum(P[constraint_indices]))
end
@assert length(cnstrs) == length(X.coeffs) == length(orderunit.coeffs)
x, u = X.coeffs, orderunit.coeffs
JuMP.@constraint(m, lincnstr[i=1:length(cnstrs)],
x[i] - λ*u[i] == sum(P[cnstrs[i]]))
JuMP.@objective(m, Max, λ)