SuperSCS  1.3.2
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Logging

Logging in C

In SuperSCS, we may activate the logging of progress information using the property do_record_progress in ScsSettings.

In that case, the Info object that is updated using scs contains the following information:

Note that the above arrays have length equal to the number of iterations.

Example:

const scs_int column_size = 10;
printf(" i P Cost D Cost Gap FPR PRes DRes\n");
printf("----------------------------------------------------------------\n");
for (i = 0; i < info->iter; ++i) {
printf("%*i ", 3, info->progress_iter[i]);
printf("%*.2e", column_size, info->progress_pcost[i]);
printf("%*.2e", column_size, info->progress_dcost[i]);
printf("%*.2e", column_size, info->progress_relgap[i]);
printf("%*.2e", column_size, info->progress_norm_fpr[i]);
printf("%*.2e", column_size, info->progress_respri[i]);
printf("%*.2e", column_size, info->progress_resdual[i]);
printf("\n");
}

Logging in MATLAB

Similarly, we may record progress information in MATLAB when we call scs_direct.m, scs_indirect.m or scs.m.

All we have to do is to set do_record_progress to 1.

params.do_record_progress = 1;
[x, y, s, info] = scs_direct(data, K, params);

This is the info structure we get when we run tests/matlab/cone_test.m:

info =
iter: 32
status: 'Solved'
pobj: -16.3754
dobj: -16.3754
resPri: 6.7545e-12
resDual: 2.2441e-11
resInfeas: NaN
resUnbdd: 0.3220
relGap: 2.6977e-12
setupTime: 0.0507
solveTime: 1.2677
progress_iter: [32x1 double]
progress_relgap: [32x1 double]
progress_respri: [32x1 double]
progress_resdual: [32x1 double]
progress_pcost: [32x1 double]
progress_dcost: [32x1 double]
progress_time: [32x1 double]
progress_mode: [32x1 double]
progress_ls: [32x1 double]
allocated_memory_bytes: 14528

Logging via CVX

Likewise, when calling SuperSCS via CVX, set do_record_progress to 1 and dumpfile to a destination MAT file where the output is to be stored.

CVX cannot return info as an argument, but it can dump all details in a MAT file.

This contains:

Here is a complete example:

rng('default');
rng(1);
d = 200;
p = 5;
A = sprandn(p,d,0.3,0.0001);
S = full(A'*A);
lam = 2;
cvx_begin sdp
cvx_solver scs
cvx_solver_settings('eps', 1e-3,...
'verbose', 1,...
'do_super_scs', 1, ...
'direction', 100, ...
'memory', 100,...
'do_record_progress',1,...
'dumpfile','pca.mat');
variable X(d,d) symmetric
minimize(-trace(S*X) + lam*norm(X,1))
trace(X)==1
X>=0
cvx_end

We may then load the file pca.mat and plot the results

load('pca.mat')
semilogy(info.progress_time, info.progress_respri,'linewidth',2); hold on
semilogy(info.progress_time, info.progress_resdual,'linewidth',2);
legend('Primal Residual', 'Dual Residual');
xlabel('time [ms]'); ylabel('residual');
grid on
progress
See Also
SuperSCS tutorial
Saving and loading problems
Useful cones and how to use them