I’m trying to add a constraint of type (x'Ax <= b) in JuMP to be interpreted as SOC by the solver.
A is Positive definite.
Seems to be the same error as presented in this issue, but A+A' has positive eigenvalues:
using Random
using JuMP
using ECOS
n = 2
rng = MersenneTwister(1)
means = randn(rng, n)
sqrt_cov = rand(rng, n, n) ./ 2.0
Σ = sqrt_cov' * sqrt_cov
model = Model(ECOS.Optimizer)
@variable(model, x[i=1:n] >= 0);
@variable(model, y[i=1:n] <= 0);
v = x + y
@objective(model, Min, 0);
@constraint(model, v'Σ*v / 321.0^2 <= 2);
optimize!(model)
yeah I did that, I was just curious why this didn’t work. However, Joaquim just showed me that indeed when v is not a variable, the constraint uses a matrix that is Positive-Semidefinite instead of Positive-Definite.