# Can't access moment_matrix() function in SumOfSquares

Hi, I’m trying to use the moment_matrix function in SumOfSquares package.

``````using MultivariateMoments
ν3 = moment_matrix(constr)
``````

However, I got the following error:

``````ArgumentError: ModelLike of type MosekModel does not support accessing the attribute SumOfSquares.MomentMatrixAttribute(1)

Stacktrace:
``````

Does anyone know why it is the case? Everything was fine when I tried the example provided in the documentation.

Could you provide a more complete example that reproduces the error? My guess is that `constr` is not a Sum-of-Squares constraint.

Thanks for your quick reply! The polynomial opt problem that I was trying to optimize is

``````model = SOSModel(Mosek.Optimizer)
@polyvar B[1:2,1:3]
@variable(model, t1)
@variable(model, t2)
@variable(model, var)
@polyvar c0
@polyvar x[1:3]
@polyvar p[1:2]
kernel = (transpose(p)*vec(B*x) + c0).^2
expr = subs(kernel, c0=> 1.0 , p =>[0.2, 0.6], x=>[0.4, 0.2, 1.0]);
@constraints(model, begin
t1 >= 0
t2 >= 0
end)
S = @set vec(B*[1,1,1])[1]>=0 && vec(B*[1,1,1])[2]>=0 && vec(B*[1,1,1])[1] + vec(B*[1,1,1])[2]==1
@constraint(model, t1 >= 48.0 - expr, domain=S)
@constraint(model, t2 >= expr - 48.0, domain=S)
@constraint(model, constr, var >= t1+2*t2)
@objective(model, Min, var)
optimize!(model)
``````

And I’m trying to extract the value of optimal B in this problem.

The Sum-of-Squares constraints here are

``````c1 = @constraint(model, t1 >= 48.0 - expr, domain=S)
c2 = @constraint(model, t2 >= expr - 48.0, domain=S)
``````

You should do `moment_matrix(c1)` and/or `moment_matrix(c2)` and try extracting atoms from these.

1 Like