-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExperiment_MaxCut_1.m
117 lines (95 loc) · 3.32 KB
/
Experiment_MaxCut_1.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
107
108
109
110
111
112
113
114
115
116
117
%Matrix Cut
%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 = "G1";
load("examples\MaxCut\"+filename+".mat");
opts.n = K.s;
opts.m = height(At);
opts.epislon = 10^-20;
opts.beta = 0.25;
opts.mu = 0.5;
opts.alphamin = 10^-5;
opts.alphamax = 100;
opts.alpha = 1; %does not matter for adaptive case
opts.adaptive = true;
%%%%%%%%% Mosek %%%%%%%%%%%%
% [res,time] = SolveMosek(At,b,c,K);
% save("results_MaxCut\"+filename+"_Mosek",'res','time');
% X = ones(opts.m);
% Xtril = tril(X,0);
% v = find(Xtril);
% Y = zeros(opts.n);
% Y(v) = Y(v) = res.sol.itr.barx;
%%%%%%%%%% [Dual] %%%%%%%%%%
opts.Maxiter = 300;
opts.rho = height(At)*2+2;
opts.MaxCols = 12;
opts.EvecPast = 11;
opts.EvecCurrent = 1;
opts.solver = "dual";
Out_Dual_11_1 = SBM(At,b,c,K,opts);
opts.Maxiter = 300;
opts.rho = height(At)*2+2;
opts.MaxCols = 13;
opts.EvecPast = 12;
opts.EvecCurrent = 1;
opts.solver = "dual";
Out_Dual_12_1 = SBM(At,b,c,K,opts);
opts.Maxiter = 300;
opts.rho = height(At)*2+2;
opts.MaxCols = 14;
opts.EvecPast = 13;
opts.EvecCurrent = 1;
opts.solver = "dual";
Out_Dual_13_1 = SBM(At,b,c,K,opts);
opts.Maxiter = 300;
opts.rho = height(At)*2+2;
opts.MaxCols = 12;
opts.EvecPast = 0;
opts.EvecCurrent = 12;
opts.solver = "dual";
Out_Dual_0_12 = SBM(At,b,c,K,opts);
opts.Maxiter = 300;
opts.rho = height(At)*2+2;
opts.MaxCols = 13;
opts.EvecPast = 0;
opts.EvecCurrent = 13;
opts.solver = "dual";
Out_Dual_0_13 = SBM(At,b,c,K,opts);
opts.Maxiter = 300;
opts.rho = height(At)*2+2;
opts.MaxCols = 14;
opts.EvecPast = 0;
opts.EvecCurrent = 14;
opts.solver = "dual";
Out_Dual_0_14 = SBM(At,b,c,K,opts);
%%%%%%%%%% [Primal] %%%%%%%%%%
%We do not count the first iteration for SBMP
rho_p = trace(mat(c))-height(At)*min(eig(mat(c)));
opts.Maxiter = 301;
opts.rho = 2*rho_p+2;
opts.MaxCols = 12;
opts.EvecPast = 0;
opts.EvecCurrent = 12;
opts.solver = "primal";
Out_Primal_0_12 = SBM(At,b,c,K,opts);
opts.Maxiter = 301;
opts.rho = 2*rho_p+2;
opts.MaxCols = 13;
opts.EvecPast = 0;
opts.EvecCurrent = 13;
opts.solver = "primal";
Out_Primal_0_13 = SBM(At,b,c,K,opts);
opts.Maxiter = 301;
opts.rho = 2*rho_p+2;
opts.MaxCols = 14;
opts.EvecPast = 0;
opts.EvecCurrent = 14;
opts.solver = "primal";
Out_Primal_0_14 = SBM(At,b,c,K,opts);
% save("results_MaxCut\"+filename+"_result.mat",'Out_Dual_11_1','Out_Dual_12_1','Out_Dual_13_1','Out_Dual_0_12','Out_Dual_0_13','Out_Dual_0_14',...
% 'Out_Primal_0_12','Out_Primal_0_13','Out_Primal_0_14');