Using Julia's JuMP library, I have a matrix-valued variable A on which I would like to impose a 2-norm constraint (equivalently: the spectral / operator norm). However I am not sure how to do this. Below is a minimal-running code of something I would like to write
using LinearAlgebra
using JuMP
using MathOptInterface
using MosekTools
using Mosek
model = Model(optimizer_with_attributes(
Mosek.Optimizer,
"QUIET" => false,
"INTPNT_CO_TOL_DFEAS" => 1e-9
))
maxnorm = 3.0
# We want opnorm(A) <= maxnorm
@variable(model, A[1:4, 1:5])
# @SDconstraint(model, A' * A <= maxnorm^2) # Mathematically valid, but not accepted!
# Make dummy variable and constraint to satisfy
@variable(model, x)
@constraint(model, x >= 10)
@objective(model, Min, x)
optimize!(model)
A very overkill way to do this is via
@constraint(model, [maxnorm; vec(A)] in SecondOrderCone())
as this bounds the Frobenius norm instead --- but this is not preferable. I would greatly appreciate any insights into how this can be done.