1
0
mirror of https://github.com/kalmarek/PropertyT.jl.git synced 2024-11-23 00:10:28 +01:00

small fixes

This commit is contained in:
kalmarek 2018-09-05 14:34:57 +02:00
parent 3dbdd0ed7f
commit a1eccf8b73

View File

@ -15,7 +15,7 @@ end
function orbit_constraint!(result::SparseMatrixCSC, cnstrs, orbit; val=1.0/length(orbit)) function orbit_constraint!(result::SparseMatrixCSC, cnstrs, orbit; val=1.0/length(orbit))
result .= zero(eltype(result)) result .= zero(eltype(result))
dropzeros!(result) dropzeros!(result)
for constraint in cnstr_orbit for constraint in cnstrs[orbit]
for idx in constraint for idx in constraint
result[idx] = val result[idx] = val
end end
@ -62,7 +62,7 @@ function SOS_problem(X::GroupRingElem, orderunit::GroupRingElem, data::OrbitData
Ns = size.(data.Uπs, 2) Ns = size.(data.Uπs, 2)
m = JuMP.Model(); m = JuMP.Model();
P = Vector{Matrix{JuMP.Variable}}(length(sizes)) P = Vector{Matrix{JuMP.Variable}}(length(Ns))
for (k,s) in enumerate(Ns) for (k,s) in enumerate(Ns)
P[k] = JuMP.@variable(m, [i=1:s, j=1:s]) P[k] = JuMP.@variable(m, [i=1:s, j=1:s])
@ -76,7 +76,7 @@ function SOS_problem(X::GroupRingElem, orderunit::GroupRingElem, data::OrbitData
info("Adding $(length(data.orbits)) constraints... ") info("Adding $(length(data.orbits)) constraints... ")
addconstraints!(m,P,λ,X,orderunit, data) @time addconstraints!(m,P,λ,X,orderunit, data)
JuMP.@objective(m, Max, λ) JuMP.@objective(m, Max, λ)
return m, λ, P return m, λ, P