disp('Sept 29/09 ') Sept 29/09 startupcvx % personal startup command to add correct paths addpath c:\software.d\cvx\builtins addpath c:\software.d\cvx\commands addpath c:\software.d\cvx\functions addpath c:\software.d\cvx\lib addpath c:\software.d\cvx\structures addpath c:\software.d\cvx\examples addpath c:\software.d\cvx %More involved example A = randn(5); A = A'*A A = Columns 1 through 4 2.374791125997622 -1.261506979703491 1.199822624319685 -1.244322036356210 -1.261506979703491 2.941377925419477 -2.456796665967557 0.364608040358330 1.199822624319685 -2.456796665967557 2.811459885871691 -0.188344633127809 -1.244322036356210 0.364608040358330 -0.188344633127809 1.073515279235954 -0.599007839626273 1.326417206570953 -2.289815591498254 -0.321197779649739 Column 5 -0.599007839626273 1.326417206570953 -2.289815591498254 -0.321197779649739 2.582039539640861 cvx_begin variable X(5, 5) symmetric; variable y; minimize(norm(X) - 10*sqrt(y)) subject to X - A == semidefinite(5); X(2,5) == 2*y; X(3,1) >= 0.8; y <= 4; cvx_end Calling SDPT3: 75 variables, 17 equality constraints For improved efficiency, SDPT3 is solving the dual problem. ------------------------------------------------------------ num. of constraints = 17 dim. of sdp var = 17, num. of sdp blk = 3 dim. of linear var = 2 ******************************************************************* SDPT3: Infeasible path-following algorithms ******************************************************************* version predcorr gam expon scale_data HKM 1 0.000 1 0 it pstep dstep pinfeas dinfeas gap mean(obj) cputime ------------------------------------------------------------------- 0|0.000|0.000|1.0e+002|3.0e+000|7.3e+003|-2.945910e+002| 0:0:00| chol 1 1 1|0.604|0.726|4.0e+001|8.4e-001|2.7e+003|-4.925034e+002| 0:0:00| chol 1 1 2|0.708|1.000|1.2e+001|4.3e-003|1.4e+003|-9.571220e+001| 0:0:00| chol 1 1 3|0.887|1.000|1.3e+000|4.3e-004|1.6e+002|-1.468771e+001| 0:0:00| chol 1 1 4|0.540|0.711|6.0e-001|1.5e-004|1.1e+002| 3.125571e+000| 0:0:00| chol 1 1 5|0.864|1.000|8.2e-002|4.3e-006|1.9e+001| 4.741185e+000| 0:0:00| chol 1 1 6|0.935|1.000|5.3e-003|1.6e-002|5.7e+000| 5.149158e+000| 0:0:00| chol 1 1 7|0.988|1.000|6.3e-005|1.1e-003|1.1e+000| 4.967965e+000| 0:0:00| chol 1 1 8|1.000|1.000|1.1e-009|1.3e-005|2.9e-001| 4.893424e+000| 0:0:00| chol 1 1 9|0.925|0.972|5.9e-010|3.6e-007|3.3e-002| 4.822408e+000| 0:0:00| chol 1 1 10|1.000|1.000|1.4e-012|1.6e-010|1.2e-002| 4.815123e+000| 0:0:00| chol 1 1 11|0.953|0.938|4.5e-013|1.5e-011|1.1e-003| 4.811825e+000| 0:0:00| chol 1 1 12|1.000|1.000|4.0e-012|1.4e-012|1.2e-004| 4.811476e+000| 0:0:00| chol 1 1 13|0.988|0.988|7.1e-011|1.0e-012|1.5e-006| 4.811435e+000| 0:0:00| chol 1 2 14|0.998|1.000|1.0e-010|1.5e-012|2.4e-008| 4.811434e+000| 0:0:00| stop: max(relative gap, infeasibilities) < 1.49e-008 ------------------------------------------------------------------- number of iterations = 14 primal objective value = 4.81143413e+000 dual objective value = 4.81143411e+000 gap := trace(XZ) = 2.37e-008 relative gap = 2.24e-009 actual relative gap = 1.71e-009 rel. primal infeas = 1.01e-010 rel. dual infeas = 1.50e-012 norm(X), norm(y), norm(Z) = 1.0e+001, 1.4e+001, 3.1e+001 norm(A), norm(b), norm(C) = 1.0e+001, 1.1e+001, 1.0e+001 Total CPU time (secs) = 0.4 CPU time per iteration = 0.0 termination code = 0 DIMACS: 1.0e-010 0.0e+000 3.1e-012 0.0e+000 1.7e-009 2.2e-009 ------------------------------------------------------------------- ------------------------------------------------------------ Status: Solved Optimal value (cvx_optval): -4.81143 %Disciplined Convex Programming and CVX 18 format long disp('optima') optima y y = 1.564563042126623 X X = Columns 1 through 4 4.373981408050321 -0.341962160803890 1.781099702030079 -0.576355228810058 -0.341962160803890 4.679609107567827 -0.124440298095597 0.337158717138440 1.781099702030079 -0.124440298095597 6.476908180158437 -0.036266842147615 -0.576355228810058 0.337158717138440 -0.036266842147615 4.792935673023767 0.354646545813196 3.129126084253246 0.129056956622673 -0.349665336837799 Column 5 0.354646545813196 3.129126084253246 0.129056956622673 -0.349665336837799 4.451617841486734 disp('constraints') constraints eig(X-A) ans = 0.000000001125806 0.071975534203023 1.684941304075837 3.880296748532569 7.354654866184248 X(2,5)-2*y ans = 0 X(3,1)-0.8 ans = 0.981099702030079 echo off