# Reducing Computation time for a SDP

Hello,

I am trying to solve a SDP relaxation of a non-convex problem, the relaxation looks as follows :

tic
cvx_begin sdp
variable z(n);
variable X(n,n) symmetric;
minimize ( trace(HX)-f’z+f’f)
subject to
Aeq
z == beq ;
LB <= z <= UB;
for i=1:n/7
trace(X
Vmatrix(:,:,i))==0;
trace(X
P(:,:,i))+q(:,1,i)’*z+f’*f<=0;
end
[X z; z’ 1] == semidefinite(n+1);
cvx_end
toc

This solution is the control input and states in order to avoid collision of two vehicles this is done at each sampling time so the program is run at each iteration. Therefore to be scalable and for experimental purposes the computation time should be lower than the sampling time. However, the solution is as follows:

Calling SDPT3 4.0: 741 variables, 101 equality constraints

num. of constraints = 101
dim. of sdp var = 36, num. of sdp blk = 1
dim. of linear var = 75

SDPT3: Infeasible path-following algorithms

## number of iterations = 12 primal objective value = 5.08060025e+05 dual objective value = 5.08060019e+05 gap := trace(XZ) = 6.45e-03 relative gap = 6.34e-09 actual relative gap = 5.65e-09 rel. primal infeas (scaled problem) = 1.08e-12 rel. dual " " " = 1.48e-09 rel. primal infeas (unscaled problem) = 0.00e+00 rel. dual " " " = 0.00e+00 norm(X), norm(y), norm(Z) = 4.8e+03, 1.5e+03, 1.6e+03 norm(A), norm(b), norm© = 2.5e+01, 5.6e+03, 3.6e+02 Total CPU time (secs) = 0.63 CPU time per iteration = 0.05 termination code = 0 DIMACS: 2.4e-12 0.0e+00 3.5e-09 0.0e+00 5.7e-09 6.3e-09

Status: Solved
Optimal value (cvx_optval): +510846

Elapsed time is 1.698546 seconds.

the elapsed time is too high for the required purposes , however i have observed that the most time is taken up launching the solver at each iteration and possibly printing the results. Could that be suppressed in order to increase computation time? Moreover is there a way in order to avoid launching the solver at each iteration.

Printing can be suppressed using `cvx_begin quiet`. That might help a little, but not much for such a long running problem. Perhaps improving scaling (5e5 is a rather large optimal objective) will help some, as well as a faster solver, such as Mosek. But there is no way to avoid the CVX modeling time on every problem instance when using CVX.

To save on modeling time, you could use YALMIP’s optimizer object capability https://yalmip.github.io/optimizerupdates/, which eliminates much of the modeling time when used repeatedly on different input.data. I think the fastest way would be to use something like Parameterized Fusion for Mosek 9.2 (now in beta). https://themosekblog.blogspot.com/2020/03/parametrized-fusion-benchmarks.html - this will require more effort on your part compared to CVX,.

1 Like

You can have cvx output the code for input directly INTO sdpt3 and that would skip the cvx compile time. Or you can look at the sdpt3 manual and enter the problem directly there.

1 Like

hello,
Thank you for your reply, would you be able to tell me how it would be possible for cvx to input directly into sdpt3?

regards

I just Googled SDPT3 and quickly ended at

https://blog.nus.edu.sg/mattohkc/softwares/sdpt3/

I think there is a good chance that the user guide present at that page will provide the information you need.

1 Like