p = 1;
n = 10; m = 2*n; q=0.5*n;
A = randn(m,n);
b = randn(m,1);
C = randn(q,n);
d = randn(q,1);
cvx_begin
variable x(n)
dual variable y
minimize( norm( A * x - b, p ) )
subject to
y : C * x == d;
cvx_end
disp( sprintf( 'norm(A*x-b,%g):', p ) );
disp( [ ' ans = ', sprintf( '%7.4f', norm(A*x-b,p) ) ] );
disp( 'Optimal vector:' );
disp( [ ' x = [ ', sprintf( '%7.4f ', x ), ']' ] );
disp( 'Residual vector:' );
disp( [ ' A*x-b = [ ', sprintf( '%7.4f ', A*x-b ), ']' ] );
disp( 'Equality constraints:' );
disp( [ ' C*x = [ ', sprintf( '%7.4f ', C*x ), ']' ] );
disp( [ ' d = [ ', sprintf( '%7.4f ', d ), ']' ] );
disp( 'Lagrange multiplier for C*x==d:' );
disp( [ ' y = [ ', sprintf( '%7.4f ', y ), ']' ] );
Calling Mosek 9.1.9: 50 variables, 25 equality constraints
------------------------------------------------------------
MOSEK Version 9.1.9 (Build date: 2019-11-21 11:32:15)
Copyright (c) MOSEK ApS, Denmark. WWW: mosek.com
Platform: MACOSX/64-X86
Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 25
Cones : 20
Scalar variables : 50
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 : 25
Cones : 20
Scalar variables : 50
Matrix variables : 0
Integer variables : 0
Optimizer - threads : 8
Optimizer - solved problem : the dual
Optimizer - Constraints : 10
Optimizer - Cones : 1
Optimizer - Scalar variables : 26 conic : 6
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 : 55 after factor : 55
Factor - dense dim. : 0 flops : 3.24e+03
ITE PFEAS DFEAS GFEAS PRSTATUS POBJ DOBJ MU TIME
0 4.7e+00 5.0e-01 1.0e+00 0.00e+00 0.000000000e+00 0.000000000e+00 1.0e+00 0.00
1 2.1e+00 2.2e-01 3.7e-01 5.23e-01 8.995908369e+00 9.101440402e+00 4.5e-01 0.01
2 7.3e-01 7.9e-02 8.5e-02 5.56e-01 1.513297553e+01 1.519314926e+01 1.6e-01 0.01
3 2.0e-01 2.2e-02 1.3e-02 8.32e-01 1.857830332e+01 1.859836215e+01 4.3e-02 0.01
4 5.0e-02 5.3e-03 1.6e-03 9.67e-01 1.931299152e+01 1.931828674e+01 1.1e-02 0.01
5 8.9e-03 9.5e-04 1.2e-04 9.90e-01 1.958240321e+01 1.958345811e+01 1.9e-03 0.01
6 1.2e-04 1.3e-05 2.0e-07 9.98e-01 1.963656797e+01 1.963658262e+01 2.6e-05 0.01
7 1.6e-10 1.8e-11 3.0e-16 1.00e+00 1.963729329e+01 1.963729329e+01 3.5e-11 0.01
Optimizer terminated. Time: 0.01
Interior-point solution summary
Problem status : PRIMAL_AND_DUAL_FEASIBLE
Solution status : OPTIMAL
Primal. obj: 1.9637293285e+01 nrm: 3e+00 Viol. con: 8e-11 var: 0e+00 cones: 9e-11
Dual. obj: 1.9637293285e+01 nrm: 4e+00 Viol. con: 0e+00 var: 4e-15 cones: 0e+00
Optimizer summary
Optimizer - time: 0.01
Interior-point - iterations : 7 time: 0.01
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): +19.6373
norm(A*x-b,1):
ans = 19.6373
Optimal vector:
x = [ 0.0454 0.7771 -0.4288 -0.2071 -0.6081 0.0065 -0.0013 0.0645 -0.3340 -0.6522 ]
Residual vector:
A*x-b = [ -0.0000 -1.0527 -0.7833 1.6843 0.1257 2.5993 1.2661 -0.0000 0.2758 -1.6365 -0.9791 2.6851 0.8774 -0.8686 0.0000 1.6512 -0.0000 1.5824 0.0000 1.5699 ]
Equality constraints:
C*x = [ -1.0290 0.2431 -1.2566 -0.3472 -0.9414 ]
d = [ -1.0290 0.2431 -1.2566 -0.3472 -0.9414 ]
Lagrange multiplier for C*x==d:
y = [ -3.6360 3.0466 -2.1301 -1.2477 0.1630 ]