12.07.2015 Views

v2007.11.26 - Convex Optimization

v2007.11.26 - Convex Optimization

v2007.11.26 - Convex Optimization

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

684 APPENDIX F. MATLAB PROGRAMSF.7 fast max cutWe use the graph generator (C program) rudy written by Giovanni Rinaldi[226] which can be found at http://convexoptimization.com/TOOLS/RUDYtogether with graph data. (4.6.0.0.6)% fast max cut, Jon Dattorro, July 2007, http://convexoptimization.comclear all;format short g; ticfid = fopen(’graphs12’,’r’);average = 0;NN = 0;s = fgets(fid);cvx_precision([1e-12, 1e-4]);cvx_quiet(true);w = 1000;while s ~= -1s = str2num(s);N = s(1);A = zeros(N);for i=1:s(2)s = str2num(fgets(fid));A(s(1),s(2)) = s(3);A(s(2),s(1)) = s(3);endQ = (diag(A*ones(N,1)) - A)/4;W = zeros(N);traceXW = 1e15;while 1cvx_begin% CVX Boydvariable X(N,N) symmetric;maximize(trace(Q*X) - w*trace(W*X));X == semidefinite(N);diag(X) == 1;cvx_end[v,d,q] = svd(X);W = v(:,2:N)*v(:,2:N)’;rankX = sum(diag(d) > max(diag(d))*1e-8)

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

Saved successfully!

Ooh no, something went wrong!