You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in particular when the matrix $M$ is highly symmetric.
Here is the way I'm coding it at the moment, but this leads to a lot of unstability in the symmetry reduction, see the attached image.
Am I missing something simple?
import COSMO
import Dualization
import DynamicPolynomials as DP
import JuMP
import LinearAlgebra as LA
import PermutationGroups as PG # v0.4.3import Polymake
import SemialgebraicSets
import SumOfSquares as SOS # v0.7.3# import SymbolicWedderburn # v0.3.7functiontest(
M::Matrix,
gens::Vector{Vector{Int}}= Vector{Int}[];
solver = COSMO.Optimizer,
level =1
)
m1, m2 =size(M)
DP.@polyvar x[1:m1+m2]
a = x[1:m1]
b = x[m1+1:m1+m2]
f = LA.dot(a, M, b)
S = SemialgebraicSets.intersect([SemialgebraicSets.@set x[i]^2==1for i in1:m1+m2]...)
model = SOS.SOSModel(Dualization.dual_optimizer(solver))
JuMP.@variable(model, t)
JuMP.@objective(model, Min, t)
ifisempty(gens)
pattern =nothingelse@assert m1 == m2
m = m1
generators =vcat([PG.Perm{UInt16}([g; g .+ m]) for g in gens], [PG.Perm{UInt16}([m+1:2m; 1:m])])
G = PG.PermGroup(generators)
pattern = SOS.Symmetry.Pattern(G, SOS.Symmetry.VariablePermutation())
end
JuMP.@constraint(model, c, f ≤ t; domain = S, symmetry = pattern, maxdegree =2level)
JuMP.set_silent(model)
JuMP.optimize!(model)
return JuMP.objective_value(model)
end# 24-cell as a simple example
pol = Polymake.polytope.wythoff("D4", 1)
# vertices
v =Matrix{Int}(pol.VERTICES)[:, 2:end]
# Gram matrix
p = v * v'# generators of the action on the vertices, i.e., on the lines/columns of p
gens = Polymake.to_one_based_indexing(pol.GROUP.VERTICES_ACTION.GENERATORS)
# @profview of the following line gives the image belowtest(p, gens; level =1)
Also, I'm just starting working with SOS.jl so any comments on my syntax is welcome.
Thanks in advance!
The text was updated successfully, but these errors were encountered:
G, S =let m1
m1 =3
M =ones(Int, m1, m1)
DP.@polyvar x[1:m1]
a = x[1:m1]
f = LA.dot(a, M, a)
S = [SemialgebraicSets.@set x[i]^2==1for i in1:m1]
generators = [PG.perm"(1,2,3)", PG.perm"(1,2)"]
let p = PG.gens(G, 1), v = MP.variables(S[1])
subs = v => SOS.Symmetry._map_idx(i -> v[i^p], v)
@code_warntype MP.pair_zip(MP._monomial_vector_to_variable_tuple(subs))
end
G, S
end
Given an$m\times m$ matrix $M$ , I'm interested in solving relaxations of the problem
in particular when the matrix$M$ is highly symmetric.
Here is the way I'm coding it at the moment, but this leads to a lot of unstability in the symmetry reduction, see the attached image.
Am I missing something simple?
Also, I'm just starting working with SOS.jl so any comments on my syntax is welcome.
Thanks in advance!
The text was updated successfully, but these errors were encountered: