Hi there and thank you for providing this forum for CVX problems. I have a convex SDP which can be easily solved with CVX. However, I need to know the middle iterates in addition to the final optimum solution. I want to plot performance as a function of iteration number. I am using sedumi as the selected solver. Is there any way we can make cvx return the middle iterates as well as the final optimum solution? Thanks in advance for your help.

I’m afraid this cannot be done.

Brute force approach:

Run CVX in the normal fashion, and observe the number of solver iterations performed.

Then re-run CVX, with maximum number of iterations allowed for the solver set to 1.

Re-run CVX, increasing maximum number of iterations allowed for the solver by 1 each time, until CVX has been run for each number of iterations up to 1 less than the original run.

Not pretty. Not fast. But I think it should work.

I appreciate the effort on this, Mark, but your approach assumes that the solver is deterministic, and uses an identical starting iterate each time. I’m not entirely sure that assumption will always hold, though it might hold for SeDuMi.

Yes, it assumes the solver is deterministic, and that the path it pursues is independent of the specified maximum number of iterations.

This seems to be the case with SeDuMi, at least on the problems I tried, based on use of

`cvx_solver_settings('maxiter',x)`

for various values of x

It also appears to be the case for SDPT3, based on use of

`cvx_solver_settings('maxit',x)`

for various values of x

I am not sure that approach will work in practice. For instance if you have presolve in front, then postsolve typically only works on optimal solution. I also assume CVX does some conversion on the reported solution which of course works if an optimal solution is given but if the solution is only near feasible.

In other words stopping the solve prematurely may lead to solution with no meaning. Therefore be very careful.