I have model written using SumOfSquares.jl, it contains “F in S” pairs such as Vector{AffExpr}`-in-`SumOfSquares.SOSPolynomialSet{BasicSemialgebraicSet{Float64, Polynomial{true, Float64}, FullSpace}, Monomial{true}, MonomialVector{true}, SumOfSquares.Certificate.Putinar{SumOfSquares.Certificate.Newton{SOSCone, MonomialBasis, Tuple{}}, SOSCone, MonomialBasis}}

I’m guessing that before calling the solver (when calling optimize!() ?), the constraints get transformed into some regular PSD constraints like MOI.PositiveSemidefiniteConeTriangle

How can I do/force the transformation manually?

The reason I’m asking is that I want to work with something closer to the PSD representation of the model, to be able to use packages like https://github.com/matbesancon/MathOptSetDistances.jl (which work only with the basic constraint types defined by MOI)

Thanks for your reply,
your code works on my problem, but I am struggling with solving the model now.

Normally I would create a model by calling model = SOSModel(Mosek.Optimizer),
add some constraints, and call optimize!(model).
If I understand correctly from MOI API reference, MyNewModel now acts instead of the Mosek.Optimizer, but doesn’t implement the optimize!() method, obviously.

I’d like to get primal/dual variables for the problem specified by moi_model,
for which I need to solve it in that particular form (unless there is some other way).
How can I do that?

using MosekTools
m = Model(Mosek.Optimizer)
MOI.copy_to(m.moi_backend, moi_model)
optimize!(m)
# get the value of γ by using its `MOI.VariableIndex`
x = MOI.get(m.moi_backend, MOI.VariablePrimal(), index(γ))