v2007.09.13 - Convex Optimization

v2007.09.13 - Convex Optimization v2007.09.13 - Convex Optimization

convexoptimization.com
from convexoptimization.com More from this publisher
10.07.2015 Views

664 APPENDIX F. MATLAB PROGRAMSbreakendendif ~violy(:,k) = v(:,1);elseif isempty(j)disp(’Sturm procedure taking default j’), j = 2; returnend % debugalpha = (-2*(v(:,1)’*A*v(:,j)) + sqrt((2*v(:,1)’*A*v(:,j)).^2 ...-4*(v(:,j)’*A*v(:,j))*(v(:,1)’*A*v(:,1))))/(2*(v(:,j)’*A*v(:,j)));y(:,k) = (v(:,1) + alpha*v(:,j))/sqrt(1+alpha^2);if chop(y(:,k)’*A*y(:,k),tol) ~= 0alpha = (-2*(v(:,1)’*A*v(:,j)) - sqrt((2*v(:,1)’*A*v(:,j)).^2 ...-4*(v(:,j)’*A*v(:,j))*(v(:,1)’*A*v(:,1))))/(2*(v(:,j)’*A*v(:,j)));y(:,k) = (v(:,1) + alpha*v(:,j))/sqrt(1+alpha^2);if chop(y(:,k)’*A*y(:,k),tol) ~= 0disp(’Zero problem in Sturm!’), returnend % debugendendY = Y - y(:,k)*y(:,k)’;rho = rho - 1;endz = zeros(size(y));e = zeros(N,N);for i=1:rz(:,i) = y(:,i)/norm(y(:,i));e(i,i) = norm(y(:,i))^2;endlam = diag(e);[junk id] = sort(real(lam));id = id(length(id):-1:1);z = [z(:,id(1:r)) null(z’)] % Sturme = diag(lam(id))[v,d] = signeig(X) % eigenvalue decompositionX-z*e*z’traceAX = trace(A*X)

F.6. CONVEX ITERATION DEMONSTRATION 665F.6 Convex iteration demonstrationWe demonstrate implementation of a rank constraint in a semidefiniteBoolean feasibility problem from4.4.3.0.5. It requires CVX, [116] an intuitiveMatlab interface for interior-point method solvers.There are a finite number 2 N=50 ≈1E15 of binary vectors x . The feasibleset of semidefinite program (668) is the intersection of an elliptope withM =10 halfspaces in vectorized variable G . Size of the optimal rank-1solution set is proportional to the positive factor scaling vector b . Thesmaller that optimal Boolean solution set, the harder this problem is to solve.That scale factor and initial states of random number generators, makingmatrix A and vector b , are selected to demonstrate Boolean solution to oneinstance in about 7 iterations (about 6 seconds), whereas a sequential binarysearch tests 25.7 million vectors (in one hour) before finding one Booleansolution feasible to nonconvex problem (665). (Other parameters can beselected to reverse these timings.)% Discrete optimization problem demo.% -Jon Dattorro, June 4, 2007% Find x\in{-1,1}^N such that Ax

664 APPENDIX F. MATLAB PROGRAMSbreakendendif ~violy(:,k) = v(:,1);elseif isempty(j)disp(’Sturm procedure taking default j’), j = 2; returnend % debugalpha = (-2*(v(:,1)’*A*v(:,j)) + sqrt((2*v(:,1)’*A*v(:,j)).^2 ...-4*(v(:,j)’*A*v(:,j))*(v(:,1)’*A*v(:,1))))/(2*(v(:,j)’*A*v(:,j)));y(:,k) = (v(:,1) + alpha*v(:,j))/sqrt(1+alpha^2);if chop(y(:,k)’*A*y(:,k),tol) ~= 0alpha = (-2*(v(:,1)’*A*v(:,j)) - sqrt((2*v(:,1)’*A*v(:,j)).^2 ...-4*(v(:,j)’*A*v(:,j))*(v(:,1)’*A*v(:,1))))/(2*(v(:,j)’*A*v(:,j)));y(:,k) = (v(:,1) + alpha*v(:,j))/sqrt(1+alpha^2);if chop(y(:,k)’*A*y(:,k),tol) ~= 0disp(’Zero problem in Sturm!’), returnend % debugendendY = Y - y(:,k)*y(:,k)’;rho = rho - 1;endz = zeros(size(y));e = zeros(N,N);for i=1:rz(:,i) = y(:,i)/norm(y(:,i));e(i,i) = norm(y(:,i))^2;endlam = diag(e);[junk id] = sort(real(lam));id = id(length(id):-1:1);z = [z(:,id(1:r)) null(z’)] % Sturme = diag(lam(id))[v,d] = signeig(X) % eigenvalue decompositionX-z*e*z’traceAX = trace(A*X)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!