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 SDPT3 4.0: 50 variables, 25 equality constraints
------------------------------------------------------------
num. of constraints = 25
dim. of socp var = 40, num. of socp blk = 20
dim. of free var = 10 *** convert ublk to lblk
*******************************************************************
SDPT3: Infeasible path-following algorithms
*******************************************************************
version predcorr gam expon scale_data
NT 1 0.000 1 0
it pstep dstep pinfeas dinfeas gap prim-obj dual-obj cputime
-------------------------------------------------------------------
0|0.000|0.000|8.1e-01|2.8e+01|1.4e+04| 5.143640e+01 0.000000e+00| 0:0:00| chol 1 1
1|1.000|0.856|5.1e-06|4.1e+00|9.7e+02| 3.170797e+02 1.559244e+01| 0:0:00| chol 1 1
2|1.000|0.987|1.1e-06|6.3e-02|5.5e+01| 6.323422e+01 1.038030e+01| 0:0:00| chol 1 1
3|0.884|0.971|2.8e-06|2.7e-03|6.0e+00| 2.028692e+01 1.435501e+01| 0:0:00| chol 1 1
4|0.890|0.116|9.8e-06|3.3e-03|3.1e+00| 1.757201e+01 1.464034e+01| 0:0:00| chol 1 1
5|1.000|0.601|1.4e-06|1.3e-03|1.1e+00| 1.696414e+01 1.591961e+01| 0:0:00| chol 1 1
6|0.960|0.782|3.5e-07|2.9e-04|2.0e-01| 1.673312e+01 1.653658e+01| 0:0:00| chol 1 1
7|0.955|0.835|5.6e-08|4.8e-05|3.1e-02| 1.671466e+01 1.668403e+01| 0:0:00| chol 1 1
8|0.983|0.979|1.5e-08|1.0e-06|6.6e-04| 1.671341e+01 1.671276e+01| 0:0:00| chol 1 1
9|0.989|0.989|3.1e-09|4.5e-06|1.8e-05| 1.671339e+01 1.671338e+01| 0:0:00| chol 1 1
10|1.000|0.989|1.8e-11|1.2e-07|4.3e-07| 1.671339e+01 1.671339e+01| 0:0:00| chol 1 1
11|0.541|0.945|8.2e-12|2.9e-09|3.7e-08| 1.671339e+01 1.671339e+01| 0:0:00|
stop: max(relative gap, infeasibilities) < 1.49e-08
-------------------------------------------------------------------
number of iterations = 11
primal objective value = 1.67133912e+01
dual objective value = 1.67133911e+01
gap := trace(XZ) = 3.74e-08
relative gap = 1.09e-09
actual relative gap = 8.80e-10
rel. primal infeas (scaled problem) = 8.21e-12
rel. dual " " " = 2.91e-09
rel. primal infeas (unscaled problem) = 0.00e+00
rel. dual " " " = 0.00e+00
norm(X), norm(y), norm(Z) = 7.0e+00, 1.0e+01, 6.0e+00
norm(A), norm(b), norm(C) = 2.3e+01, 5.2e+00, 5.5e+00
Total CPU time (secs) = 0.28
CPU time per iteration = 0.03
termination code = 0
DIMACS: 1.5e-11 0.0e+00 8.0e-09 0.0e+00 8.8e-10 1.1e-09
-------------------------------------------------------------------
------------------------------------------------------------
Status: Solved
Optimal value (cvx_optval): +16.7134
norm(A*x-b,1):
ans = 16.7134
Optimal vector:
x = [ 0.0026 -0.1810 -0.4690 -0.1179 -0.0525 0.0758 0.0980 0.1892 -0.1700 0.4621 ]
Residual vector:
A*x-b = [ 0.0000 -2.0940 0.6100 -0.8864 -1.8009 0.0000 -0.9764 -0.7311 1.5586 1.1282 -1.4916 -0.0069 -0.0000 -0.0000 -1.5960 0.0629 0.5158 0.0000 -1.8174 1.4373 ]
Equality constraints:
C*x = [ 0.1555 0.8186 -0.2926 -0.5408 -0.3086 ]
d = [ 0.1555 0.8186 -0.2926 -0.5408 -0.3086 ]
Lagrange multiplier for C*x==d:
y = [ -6.7354 1.6456 -2.1811 -6.2263 0.4799 ]