mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-11-23 00:10:28 +01:00
modernize naive sdp formulation
This commit is contained in:
parent
e3a58fdef0
commit
a5a3d9d069
@ -47,7 +47,8 @@ function SOS_problem(X::GroupRingElem, orderunit::GroupRingElem; upper_bound::Fl
|
|||||||
m = JuMP.Model();
|
m = JuMP.Model();
|
||||||
|
|
||||||
JuMP.@variable(m, P[1:N, 1:N])
|
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)
|
JuMP.@constraint(m, sum(P[i] for i in eachindex(P)) == 0)
|
||||||
|
|
||||||
if upper_bound < Inf
|
if upper_bound < Inf
|
||||||
@ -57,9 +58,11 @@ function SOS_problem(X::GroupRingElem, orderunit::GroupRingElem; upper_bound::Fl
|
|||||||
end
|
end
|
||||||
|
|
||||||
cnstrs = constraints(parent(X).pm)
|
cnstrs = constraints(parent(X).pm)
|
||||||
for (constraint_indices, x, u) in zip(cnstrs, X.coeffs, orderunit.coeffs)
|
@assert length(cnstrs) == length(X.coeffs) == length(orderunit.coeffs)
|
||||||
JuMP.@constraint(m, x - λ*u == sum(P[constraint_indices]))
|
|
||||||
end
|
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, λ)
|
JuMP.@objective(m, Max, λ)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user