Minimizing (Frobenious norm of Matrix)^2

I am solving a problem which minimizes the Frobenious norm of a matrix to the power of 2. I am using below code:
square_pos(norm(A,“fro”))
But after solving the problem, norm is minimized to 1 not zero. When I remove the ^2, after solving the problem, norm is minimized to a very low value.
I appreciate if you support letting me know how I can write the norm^2 for a correct minimization.

Best Regards,
Afsoon

square_pos(norm(A,“fro”)) is correct code, if that is what you want. From a numerical stability standpoint,. norm(A,“fro”) may be better, and is preferred if that is the only term in the objective.

As far as your discrepancy, if you show your code and all solver and CVX output, perhaps that will help someone diagnose the matter. It is preferred if you are able to include all input data.

Hi,

Thanks a lot for your reply. As the norm is not the only term, I cannot remove the power.
Unfortunately, this optimization problem is a piece of multiple problems and sharing all is not possible but I am adding the function with a sample input, as well as the output below (due to limitation of the length in message, the last iteration is added). after the Successive solving of the problem, I and I_n are not equal (or close considering the Z). Please let me know if this is useful or any other information is needed.

I_n=[0.0430 0.0887 0.0004 0.0614 0.0599 0.0634 0.0201 0.0016 0.0010 0.0225 0.0001 0.0778 0.0730 0.0894 0.0005 0.0043
0.0050 0.0288 0.0397 0.0398 0.0001 0.0775 0.0750 0.0013 0.0009 0.0256 0.0025 0.0079 0.0009 0.0673 0.0027 0.0119
0.0624 0.0252 0.0050 0.0082 0.0057 0.0669 0.0687 0.0443 0.0013 0.0421 0.0680 0.0390 0.0011 0.0457 0.0135 0.0815
0.0064 0.0011 0.0011 0.0087 0.0106 0.0340 0.0002 0.0002 0.0023 0.0118 0.0001 0.0220 0.0083 0.0139 0.0010 0.0002];
S_n=[0.0000 0.0839 0.0000 0.1829 0.1886 0.0320 0.0000 0.0000 0.0000 0.0000 0.0000 0.0680 0.1782 0.0622 0.0000 0.0000
0.0000 0.1992 0.0000 0.1943 0.0000 0.0910 0.1031 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.1998
0.1302 0.0000 0.0000 0.0000 0.0000 0.0001 0.0695 0.0000 0.0000 0.0000 0.0356 0.1966 0.0000 0.1943 0.0000 0.1518
0.0000 0.0000 0.0000 0.1966 0.1937 0.0002 0.0000 0.0000 0.0000 0.1995 0.0000 0.0000 0.1997 0.0000 0.0000 0.0000];
N_B=4;
N_u=16;
lambda_I=0.1ones(N_B,N_u);
lambda_S=0.1
ones(N_B,N_u);
Z_I=0.001ones(N_B,N_u);
Z_S=0.001
ones(N_B,N_u);
xi=ones(N_u,1);
Prev=-10000;
iter=1;
d=10;
P_N=1e-3;
ro=200;
while iter <=10 & d >=0.005
cvx_begin
variable I(N_B,N_u)
variable S(N_B,N_u)
variable alfa(N_u)
variable bet(N_u)
variable tu(N_u)
minimize(-sum(log(tu))+(ro/2)*(square_pos(norm(I_n-I+Z_I,‘fro’))+square_pos(norm(S_n-S+Z_S,‘fro’)))-sum(sum(lambda_I.*I+lambda_S.*S)))
subject to

        exp(tu)<=1+alfa;

        I>=0;
        alfa>=0;
        
        bet>=sum(I,1)'+P_N;
        (0.5./xi).*alfa.^2+(xi/2).*(bet.^2)<=sum(S,1)';

cvx_end
xi=alfa./bet;
d=abs((cvx_optval-Prev)/Prev);
Prev=cvx_optval;
iter=iter+1;
I_Final=I;
S_Final=S;

end

test

Calling Mosek 9.1.9: 444 variables, 212 equality constraints

MOSEK Version 9.1.9 (Build date: 2019-11-21 11:34:40)
Copyright (c) MOSEK ApS, Denmark. WWW: mosek.com
Platform: Windows/64-X86

Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 212
Cones : 68
Scalar variables : 444
Matrix variables : 0
Integer variables : 0

Optimizer started.
Presolve started.
Linear dependency checker started.
Linear dependency checker terminated.
Eliminator started.
Freed constraints in eliminator : 0
Eliminator terminated.
Eliminator - tries : 1 time : 0.00
Lin. dep. - tries : 1 time : 0.00
Lin. dep. - number : 0
Presolve terminated. Time: 0.00
Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 212
Cones : 68
Scalar variables : 444
Matrix variables : 0
Integer variables : 0

Optimizer - threads : 4
Optimizer - solved problem : the primal
Optimizer - Constraints : 66
Optimizer - Cones : 68
Optimizer - Scalar variables : 315 conic : 281
Optimizer - Semi-definite variables: 0 scalarized : 0
Factor - setup time : 0.00 dense det. time : 0.00
Factor - ML order time : 0.00 GP order time : 0.00
Factor - nonzeros before factor : 386 after factor : 551
Factor - dense dim. : 0 flops : 1.03e+04
ITE PFEAS DFEAS GFEAS PRSTATUS POBJ DOBJ MU TIME
0 2.1e+00 1.4e+02 2.6e+02 0.00e+00 2.132454144e+02 -4.276326405e+01 1.0e+00 0.00
1 8.0e-01 5.3e+01 1.6e+02 -9.86e-01 8.504700375e+01 -1.639339796e+02 3.8e-01 0.00
2 6.2e-01 4.1e+01 1.0e+02 -6.80e-01 7.788094326e+01 -1.130425930e+02 2.9e-01 0.02
3 2.3e-01 1.5e+01 1.8e+01 1.72e-01 4.916216330e+01 -2.360578274e+01 1.1e-01 0.02
4 4.7e-02 3.1e+00 1.8e+00 6.76e-01 9.185996047e+00 -7.685565133e+00 2.2e-02 0.02
5 1.6e-02 1.0e+00 4.7e-01 7.96e-01 -1.993730454e+00 -8.511403568e+00 7.3e-03 0.02
6 6.2e-03 4.1e-01 1.6e-01 6.49e-01 -5.895791740e+00 -9.160217316e+00 2.9e-03 0.02
7 2.2e-03 1.5e-01 4.6e-02 5.52e-01 -7.895582956e+00 -9.451406975e+00 1.1e-03 0.02
8 9.4e-04 6.2e-02 1.7e-02 4.65e-01 -8.852193004e+00 -9.726112838e+00 4.4e-04 0.02
9 5.2e-04 3.4e-02 8.9e-03 3.48e-01 -9.131017951e+00 -9.759845094e+00 2.4e-04 0.02
10 1.7e-04 1.1e-02 2.5e-03 3.65e-01 -9.533015371e+00 -9.826394361e+00 8.0e-05 0.02
11 8.6e-05 5.7e-03 1.2e-03 3.51e-01 -9.529440696e+00 -9.723780130e+00 4.0e-05 0.02
12 3.7e-05 2.4e-03 4.2e-04 4.16e-01 -9.591903195e+00 -9.698486482e+00 1.7e-05 0.02
13 2.4e-05 1.6e-03 2.6e-04 4.08e-01 -9.581909133e+00 -9.664053325e+00 1.1e-05 0.02
14 8.1e-06 5.4e-04 7.1e-05 4.09e-01 -9.661269358e+00 -9.697637216e+00 3.8e-06 0.02
15 4.8e-06 3.2e-04 4.0e-05 4.33e-01 -9.714139249e+00 -9.740061726e+00 2.3e-06 0.02
16 1.5e-06 9.9e-05 1.0e-05 4.13e-01 -9.881115448e+00 -9.891423656e+00 7.0e-07 0.02
17 6.0e-07 4.0e-05 3.6e-06 4.68e-01 -1.000460190e+01 -1.000960688e+01 2.8e-07 0.02
18 2.4e-07 1.6e-05 1.4e-06 2.76e-01 -1.021110864e+01 -1.021342324e+01 1.1e-07 0.02
19 1.6e-07 1.0e-05 7.9e-07 4.40e-01 -1.025406034e+01 -1.025566272e+01 7.4e-08 0.02
20 6.0e-08 4.0e-06 3.0e-07 2.01e-01 -1.042443462e+01 -1.042477107e+01 2.8e-08 0.02
21 3.1e-08 2.0e-06 1.6e-07 1.84e-01 -1.049379724e+01 -1.049357460e+01 1.5e-08 0.02
22 1.8e-08 1.2e-06 9.0e-08 1.31e-01 -1.045825028e+01 -1.045768716e+01 8.4e-09 0.02
23 9.5e-09 6.3e-07 5.1e-08 1.24e-02 -1.031684144e+01 -1.031584184e+01 4.5e-09 0.02
24 4.1e-09 2.7e-07 2.2e-08 5.87e-03 -1.013826359e+01 -1.013689705e+01 1.9e-09 0.02
25 1.5e-09 1.0e-07 7.9e-09 5.63e-02 -9.946786842e+00 -9.945344805e+00 7.3e-10 0.02
26 7.6e-10 5.1e-08 3.7e-09 1.98e-01 -9.807351195e+00 -9.805990478e+00 3.6e-10 0.02
27 3.2e-10 2.2e-08 1.3e-09 3.99e-01 -9.670823490e+00 -9.669875144e+00 1.5e-10 0.02
28 2.2e-10 1.4e-08 7.2e-10 6.36e-01 -9.618937856e+00 -9.618254611e+00 1.0e-10 0.02
29 8.2e-11 1.0e-08 2.1e-10 5.74e-01 -9.532731984e+00 -9.532314258e+00 3.9e-11 0.02
30 3.2e-11 1.2e-08 5.2e-11 8.22e-01 -9.487566261e+00 -9.487385679e+00 1.4e-11 0.02
31 7.6e-12 2.1e-08 2.8e-12 8.89e-01 -9.460079478e+00 -9.460050312e+00 2.0e-12 0.02
32 3.8e-11 8.3e-08 9.4e-14 9.82e-01 -9.455804589e+00 -9.455801541e+00 2.0e-13 0.02
Optimizer terminated. Time: 0.02

Interior-point solution summary
Problem status : PRIMAL_AND_DUAL_FEASIBLE
Solution status : OPTIMAL
Primal. obj: -9.4558045890e+00 nrm: 4e+03 Viol. con: 3e-05 var: 6e-05 cones: 0e+00
Dual. obj: -9.4558015414e+00 nrm: 2e+05 Viol. con: 0e+00 var: 6e-11 cones: 0e+00
Optimizer summary
Optimizer - time: 0.02
Interior-point - iterations : 32 time: 0.02
Basis identification - time: 0.00
Primal - iterations : 0 time: 0.00
Dual - iterations : 0 time: 0.00
Clean primal - iterations : 0 time: 0.00
Clean dual - iterations : 0 time: 0.00
Simplex - time: 0.00
Primal simplex - iterations : 0 time: 0.00
Dual simplex - iterations : 0 time: 0.00
Mixed integer - relaxations: 0 time: 0.00


Status: Solved
Optimal value (cvx_optval): -9.95315

You didn’t say anything previously about having other terms in the objective or running an SCA (or whatever) in an iterative process. Given that, SCA could converge to anything, or nothing. The most minor change in anything could lead to a different iterative trajectory, including what, if anything, it converges to.

If you think you needs the square_pos to model what you want, then include it. But almost anything can happen in the SCA, regardless of use of square_pos or not.

Even if the SCA always reliably converged to the global optimum, which it doesn’t, incorporation or not of square_pos changes the problem, and therefore can change its argmin and optimal objective value.

You can search on this forum for SCA and see many posts by me poiting out its perils.

Many thanks for the reply! I will consider this and check other posts, too!