1
votes

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.

1
Since Convex.jl does these transformations automatically, I usually just check it’s source code to see how it’s done: github.com/jump-dev/Convex.jl/blob/… - Eric
Thanks, will try that out! - Anton Xue

1 Answers

3
votes

MathOptInterface has a cone for the spectral norm:

https://jump.dev/MathOptInterface.jl/v0.9/apireference/#MathOptInterface.NormSpectralCone

@constraint(model, [maxnorm; vec(A)] in MOI.NormSpectralCone(4, 5))