FDLA and FMMC solutions for a 50-node, 200-edge graph
n = 50; threshold = 0.2529;
rand('state',209);
xy = rand(n,2);
angle = 10*pi/180;
Rotate = [ cos(angle) sin(angle); -sin(angle) cos(angle) ];
xy = (Rotate*xy')';
Dist = zeros(n,n);
for i=1:(n-1);
for j=i+1:n;
Dist(i,j) = norm( xy(i,:) - xy(j,:) );
end;
end;
Dist = Dist + Dist';
Ad = Dist < threshold;
Ad = Ad - eye(n);
m = sum(sum(Ad))/2;
A = zeros(n,m);
l = 0;
for i=1:(n-1);
for j=i+1:n;
if Ad(i,j)>0.5
l = l + 1;
A(i,l) = 1;
A(j,l) = -1;
end;
end;
end;
A = sparse(A);
[n,m] = size(A);
[ w_fdla, rho_fdla ] = fdla(A);
[ w_fmmc, rho_fmmc ] = fmmc(A);
[ w_md, rho_md ] = max_deg(A);
[ w_bc, rho_bc ] = best_const(A);
[ w_mh, rho_mh ] = mh(A);
tau_fdla = 1/log(1/rho_fdla);
tau_fmmc = 1/log(1/rho_fmmc);
tau_md = 1/log(1/rho_md);
tau_bc = 1/log(1/rho_bc);
tau_mh = 1/log(1/rho_mh);
eig_opt = sort(eig(eye(n) - A * diag(w_fdla) * A'));
eig_fmmc = sort(eig(eye(n) - A * diag(w_fmmc) * A'));
eig_mh = sort(eig(eye(n) - A * diag(w_mh) * A'));
eig_md = sort(eig(eye(n) - A * diag(w_md) * A'));
eig_bc = sort(eig(eye(n) - A * diag(w_bc) * A'));
fprintf(1,'\nResults:\n');
fprintf(1,'FDLA weights:\t\t rho = %5.4f \t tau = %5.4f\n',rho_fdla,tau_fdla);
fprintf(1,'FMMC weights:\t\t rho = %5.4f \t tau = %5.4f\n',rho_fmmc,tau_fmmc);
fprintf(1,'M-H weights:\t\t rho = %5.4f \t tau = %5.4f\n',rho_mh,tau_mh);
fprintf(1,'MAX_DEG weights:\t rho = %5.4f \t tau = %5.4f\n',rho_md,tau_md);
fprintf(1,'BEST_CONST weights:\t rho = %5.4f \t tau = %5.4f\n',rho_bc,tau_bc);
figure(1), clf
gplot(Ad,xy);
hold on;
plot(xy(:,1), xy(:,2), 'ko','LineWidth',4, 'MarkerSize',4);
axis([0.05 1.1 -0.1 0.95]);
title('Graph')
hold off;
figure(2), clf
v_fdla = [w_fdla; diag(eye(n) - A*diag(w_fdla)*A')];
[ifdla, jfdla, neg_fdla] = find( v_fdla.*(v_fdla < -0.001 ) );
v_fdla(ifdla) = [];
wbins = [-0.6:0.012:0.6];
hist(neg_fdla,wbins); hold on,
h = findobj(gca,'Type','patch');
set(h,'FaceColor','r')
hist(v_fdla,wbins); hold off,
axis([-0.6 0.6 0 12]);
xlabel('optimal FDLA weights');
ylabel('histogram');
figure(3), clf
xbins = (-1:0.015:1)';
ymax = 6;
subplot(3,1,1)
hist(eig_md, xbins); hold on;
max_md = max(abs(eig_md(1:n-1)));
plot([-max_md -max_md],[0 ymax], 'b--');
plot([ max_md max_md],[0 ymax], 'b--');
axis([-1 1 0 ymax]);
text(0,5,'MAX DEG');
title('Eigenvalue distributions')
subplot(3,1,2)
hist(eig_bc, xbins); hold on;
max_opt = max(abs(eig_bc(1:n-1)));
plot([-max_opt -max_opt],[0 ymax], 'b--');
plot([ max_opt max_opt],[0 ymax], 'b--');
axis([-1 1 0 ymax]);
text(0,5,'BEST CONST');
subplot(3,1,3)
hist(eig_opt, xbins); hold on;
max_opt = max(abs(eig_opt(1:n-1)));
plot([-max_opt -max_opt],[0 ymax], 'b--');
plot([ max_opt max_opt],[0 ymax], 'b--');
axis([-1 1 0 ymax]);
text(0,5,'FDLA');
figure(4), clf
xbins = (-1:0.015:1)';
ymax = 6;
subplot(3,1,1)
hist(eig_md, xbins); hold on;
max_md = max(abs(eig_md(1:n-1)));
plot([-max_md -max_md],[0 ymax], 'b--');
plot([ max_md max_md],[0 ymax], 'b--');
axis([-1 1 0 ymax]);
text(0,5,'MAX DEG');
title('Eigenvalue distributions')
subplot(3,1,2)
hist(eig_mh, xbins); hold on;
max_opt = max(abs(eig_mh(1:n-1)));
plot([-max_opt -max_opt],[0 ymax], 'b--');
plot([ max_opt max_opt],[0 ymax], 'b--');
axis([-1 1 0 ymax]);
text(0,5,'MH');
subplot(3,1,3)
hist(eig_fmmc, xbins); hold on;
max_opt = max(abs(eig_fmmc(1:n-1)));
plot([-max_opt -max_opt],[0 ymax], 'b--');
plot([ max_opt max_opt],[0 ymax], 'b--');
axis([-1 1 0 ymax]);
text(0,5,'FMMC');
figure(5), clf
v_fmmc = [w_fmmc; diag(eye(n) - A*diag(w_fmmc)*A')];
[ifmmc, jfmmc, nonzero_fmmc] = find( v_fmmc.*(v_fmmc > 0.001 ) );
hist(nonzero_fmmc,80);
axis([0 1 0 10]);
xlabel('optimal positive FMMC weights');
ylabel('histogram');
figure(6), clf
An = abs(A*diag(w_fmmc)*A');
An = (An - diag(diag(An))) > 0.0001;
gplot(An,xy,'b-'); hold on;
h = findobj(gca,'Type','line');
set(h,'LineWidth',2.5)
gplot(Ad,xy,'b:');
plot(xy(:,1), xy(:,2), 'ko','LineWidth',4, 'MarkerSize',4);
axis([0.05 1.1 -0.1 0.95]);
title('Subgraph with positive transition prob.')
hold off;
Calling SDPT3: 2598 variables, 249 equality constraints
For improved efficiency, SDPT3 is solving the dual problem.
------------------------------------------------------------
num. of constraints = 249
dim. of sdp var = 100, num. of sdp blk = 2
dim. of free var = 48 *** convert ublk to lblk
*******************************************************************
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.3e+03|1.1e+02|1.0e+06|-1.609293e+01| 0:0:00| chol 1 1
1|0.836|0.960|2.1e+02|4.6e+00|1.4e+04| 1.079159e+01| 0:0:00| chol 1 1
2|0.976|0.984|4.9e+00|9.8e-02|1.8e+02|-5.592981e+00| 0:0:00| chol 1 1
3|1.000|1.000|1.1e-04|3.0e-03|9.9e+00|-4.904896e+00| 0:0:01| chol 2 1
4|1.000|0.888|6.2e-04|6.2e-04|1.1e+00|-5.789325e-01| 0:0:01| chol 1 1
5|0.608|0.182|2.4e-04|6.6e-04|7.6e-01|-7.755511e-01| 0:0:01| chol 1 1
6|0.670|0.465|8.2e-05|4.0e-04|4.0e-01|-8.762356e-01| 0:0:01| chol 1 1
7|0.846|0.477|1.4e-05|2.3e-04|1.7e-01|-9.066939e-01| 0:0:01| chol 1 1
8|0.931|0.471|1.2e-06|1.2e-04|7.3e-02|-9.108990e-01| 0:0:02| chol 1 1
9|1.000|0.287|5.7e-08|8.8e-05|4.8e-02|-9.103336e-01| 0:0:02| chol 1 1
10|0.984|0.561|2.9e-08|3.8e-05|1.8e-02|-9.065205e-01| 0:0:02| chol 1 1
11|1.000|0.291|4.1e-09|5.3e-05|1.3e-02|-9.054127e-01| 0:0:02| chol 1 2
12|1.000|0.907|7.8e-10|3.6e-05|2.0e-03|-9.020868e-01| 0:0:02| chol 1 1
13|1.000|0.891|3.3e-11|5.4e-06|5.3e-04|-9.019486e-01| 0:0:03| chol 2 2
14|0.954|0.916|3.6e-11|1.4e-06|9.5e-05|-9.020498e-01| 0:0:03| chol 2 2
15|1.000|0.957|1.0e-09|2.5e-07|1.7e-05|-9.020727e-01| 0:0:03| chol 3 3
16|1.000|0.946|1.8e-09|4.6e-08|2.4e-06|-9.020779e-01| 0:0:03| chol 4 4
17|0.997|0.954|3.3e-09|6.4e-09|4.9e-07|-9.020785e-01| 0:0:03| chol 7 7
18|1.000|0.969|4.6e-09|1.3e-09|6.2e-08|-9.020786e-01| 0:0:03| chol 23 24
19|1.000|0.971|6.2e-09|1.9e-10|7.2e-09|-9.020787e-01| 0:0:04|
stop: max(relative gap, infeasibilities) < 1.49e-08
-------------------------------------------------------------------
number of iterations = 19
primal objective value = -9.02078656e-01
dual objective value = -9.02078660e-01
gap := trace(XZ) = 7.24e-09
relative gap = 2.58e-09
actual relative gap = 1.33e-09
rel. primal infeas = 6.17e-09
rel. dual infeas = 1.94e-10
norm(X), norm(y), norm(Z) = 9.6e-01, 7.0e+00, 1.1e+01
norm(A), norm(b), norm(C) = 4.7e+01, 2.0e+00, 9.4e+00
Total CPU time (secs) = 3.7
CPU time per iteration = 0.2
termination code = 0
DIMACS: 6.2e-09 0.0e+00 9.2e-10 0.0e+00 1.3e-09 2.6e-09
-------------------------------------------------------------------
------------------------------------------------------------
Status: Solved
Optimal value (cvx_optval): +0.902079
Calling SDPT3: 2849 variables, 250 equality constraints
For improved efficiency, SDPT3 is solving the dual problem.
------------------------------------------------------------
num. of constraints = 250
dim. of sdp var = 100, num. of sdp blk = 2
dim. of linear var = 250
dim. of free var = 49 *** convert ublk to lblk
*******************************************************************
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.3e+03|9.9e+01|2.2e+06| 1.581139e+01| 0:0:00| chol 1 1
1|0.713|0.927|3.7e+02|7.4e+00|6.0e+04| 3.821925e+02| 0:0:00| chol 1 1
2|0.906|0.970|3.4e+01|2.9e-01|3.0e+03| 4.508161e+02| 0:0:00| chol 1 1
3|0.926|0.845|2.6e+00|6.5e-02|4.7e+02| 1.376431e+02| 0:0:01| chol 1 1
4|0.996|0.607|1.1e-02|2.7e-02|6.1e+01| 1.226736e+01| 0:0:01| chol 1 1
5|1.000|0.872|9.9e-06|5.8e-03|6.4e+00| 2.038464e-01| 0:0:01| chol 1 1
6|0.943|0.734|1.3e-06|1.6e-03|1.5e+00|-3.083648e-01| 0:0:01| chol 1 1
7|0.401|0.234|7.3e-07|1.2e-03|1.1e+00|-6.328547e-01| 0:0:02| chol 1 1
8|0.970|0.319|3.6e-08|8.2e-04|4.2e-01|-8.895303e-01| 0:0:02| chol 1 1
9|0.900|0.375|1.2e-08|5.1e-04|2.5e-01|-9.094389e-01| 0:0:02| chol 1 1
10|0.721|0.407|5.4e-09|3.0e-04|1.5e-01|-9.101030e-01| 0:0:02| chol 1 1
11|0.783|0.268|1.8e-09|2.2e-04|1.0e-01|-9.172965e-01| 0:0:02| chol 1 1
12|0.721|0.325|7.6e-10|1.5e-04|7.2e-02|-9.171814e-01| 0:0:03| chol 1 1
13|0.808|0.265|2.4e-10|1.1e-04|5.0e-02|-9.187955e-01| 0:0:03| chol 1 1
14|0.861|0.332|1.0e-10|7.4e-05|3.3e-02|-9.188173e-01| 0:0:03| chol 1 1
15|0.995|0.325|6.0e-11|5.1e-05|2.1e-02|-9.188525e-01| 0:0:03| chol 1 1
16|1.000|0.934|3.4e-11|2.1e-05|5.2e-03|-9.144967e-01| 0:0:04| chol 1 1
17|1.000|0.942|2.0e-11|5.1e-06|1.6e-03|-9.148938e-01| 0:0:04| chol 2 2
18|0.999|0.928|4.5e-12|1.6e-06|4.4e-04|-9.150948e-01| 0:0:04| chol 2 2
19|1.000|0.939|4.4e-12|4.4e-07|2.0e-04|-9.151266e-01| 0:0:04| chol 2 2
20|1.000|0.960|2.0e-11|1.9e-07|4.8e-05|-9.151462e-01| 0:0:05| chol 2 2
21|1.000|0.970|3.0e-11|4.8e-08|8.8e-06|-9.151506e-01| 0:0:05| chol 2 2
22|1.000|0.975|3.0e-11|8.7e-09|1.2e-06|-9.151514e-01| 0:0:05| chol 3 3
23|1.000|0.985|1.9e-11|1.2e-09|6.3e-08|-9.151515e-01| 0:0:05| chol 8 10
24|1.000|0.988|4.1e-11|6.4e-11|1.2e-09|-9.151515e-01| 0:0:05|
stop: max(relative gap, infeasibilities) < 1.49e-08
-------------------------------------------------------------------
number of iterations = 24
primal objective value = -9.15151536e-01
dual objective value = -9.15151537e-01
gap := trace(XZ) = 1.16e-09
relative gap = 4.08e-10
actual relative gap = 3.74e-10
rel. primal infeas = 4.13e-11
rel. dual infeas = 6.44e-11
norm(X), norm(y), norm(Z) = 9.4e-01, 2.9e+00, 1.1e+01
norm(A), norm(b), norm(C) = 4.7e+01, 2.0e+00, 1.1e+01
Total CPU time (secs) = 5.4
CPU time per iteration = 0.2
termination code = 0
DIMACS: 4.1e-11 0.0e+00 3.6e-10 0.0e+00 3.7e-10 4.1e-10
-------------------------------------------------------------------
------------------------------------------------------------
Status: Solved
Optimal value (cvx_optval): +0.915152
Results:
FDLA weights: rho = 0.9021 tau = 9.7037
FMMC weights: rho = 0.9152 tau = 11.2783
M-H weights: rho = 0.9489 tau = 19.0839
MAX_DEG weights: rho = 0.9706 tau = 33.5236
BEST_CONST weights: rho = 0.9470 tau = 18.3549