-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTestSBM.m
106 lines (92 loc) · 3.19 KB
/
TestSBM.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
%First experiment: small-scale problem.
%Goal: Show that the primal formulation is better when Z^* is 'low' rank
%Instance: rank(X^*) = 97 or rank(Z^*) = 3
% The penalty parameter is chosen by the fact that we already know the optimal solution
% Penal term is chosen as tr(X^*)*2+2 and tr(Z^*)*2+2
%Authors: Feng-Yi Liao & Yang Zheng
% SOC Lab @UC San Diego
clc;clear;
addpath('packages\SBM-Primal');
addpath('packages\SBM-Dual');
addpath('packages\General');
filename = "n100m100dr3";
load("examples\randomSDPs\"+filename+".mat");
opts.n = K_sdp.s;
opts.m = height(At_sdp);
opts.epislon = 10^-20;
opts.beta = 0.25;
opts.mu = 0.5;
opts.alpha = 50; %does not matter for adaptive case
%%%%%%%%%% [Primal] %%%%%%%%%%
%We do not count the first iteration for SBMP
opts.Maxiter = 201;
opts.rho = Optimal.TrZ*2+2;
opts.MaxCols = 2;
opts.EvecPast = 1;
opts.EvecCurrent = 1;
opts.solver = "primal";
Out_Primal_1_1 = SBM(At_sdp,b_sdp,c_sdp,K_sdp,opts);
opts.Maxiter = 201;
opts.rho = Optimal.TrZ*2+2;
opts.MaxCols = 3;
opts.EvecPast = 2;
opts.EvecCurrent = 1;
opts.solver = "primal";
Out_Primal_2_1 = SBM(At_sdp,b_sdp,c_sdp,K_sdp,opts);
opts.Maxiter = 201;
opts.rho = Optimal.TrZ*2+2;
opts.MaxCols = 4;
opts.EvecPast = 3;
opts.EvecCurrent = 1;
opts.solver = "primal";
Out_Primal_3_1 = SBM(At_sdp,b_sdp,c_sdp,K_sdp,opts);
opts.Maxiter = 201;
opts.rho = Optimal.TrZ*2+2;
opts.MaxCols = 2;
opts.EvecPast = 0;
opts.EvecCurrent = 2;
opts.solver = "primal";
Out_Primal_0_2 = SBM(At_sdp,b_sdp,c_sdp,K_sdp,opts);
opts.Maxiter = 201;
opts.rho = Optimal.TrZ*2+2;
opts.MaxCols = 3;
opts.EvecPast = 0;
opts.EvecCurrent = 3;
opts.solver = "primal";
Out_Primal_0_3 = SBM(At_sdp,b_sdp,c_sdp,K_sdp,opts);
opts.Maxiter = 201;
opts.rho = Optimal.TrZ*2+2;
opts.MaxCols = 4;
opts.EvecPast = 0;
opts.EvecCurrent = 4;
opts.solver = "primal";
Out_Primal_0_4 = SBM(At_sdp,b_sdp,c_sdp,K_sdp,opts);
%
%
% %%%%%%%%%% [Dual] %%%%%%%%%%
%
%
opts.Maxiter = 200;
opts.rho = Optimal.TrX*2+2;
opts.MaxCols = 2;
opts.EvecPast = 0;
opts.EvecCurrent = 2;
opts.solver = "dual";
Out_Dual_0_2 = SBM(At_sdp,b_sdp,c_sdp,K_sdp,opts);
opts.Maxiter = 200;
opts.rho = Optimal.TrX*2+2;
opts.MaxCols = 3;
opts.EvecPast = 0;
opts.EvecCurrent = 3;
opts.solver = "dual";
Out_Dual_0_3 = SBM(At_sdp,b_sdp,c_sdp,K_sdp,opts);
opts.Maxiter = 200;
opts.rho = Optimal.TrX*2+2;
opts.MaxCols = 4;
opts.EvecPast = 0;
opts.EvecCurrent = 4;
opts.solver = "dual";
Out_Dual_0_4 = SBM(At_sdp,b_sdp,c_sdp,K_sdp,opts);
%
% save("results_rdSDPs_new\"+filename+"_result.mat",'Out_Primal_1_1','Out_Primal_2_1','Out_Primal_3_1','Out_Primal_0_2','Out_Primal_0_3','Out_Primal_0_4',...
% 'Out_Dual_0_2','Out_Dual_0_3','Out_Dual_0_4');