Running CVX in a for loop


I have an SDP problem in a for-loop. The size of the loop is 300, i.e., I’m solving 300 (independent) SDP problems with 300 (independent) input values. I have noticed that when I run the for-loop from 1 to 300 in one go, CVX (with both sedumi and sdpt3) returns a failed status and nan as optimal value for some of the iterations between 200 to 300. However, when I run the same for-loop from 200 to 300 (as opposed to from 1 to 300), then for all iterations CVX returns solved with a feasible solution. Why is that?

PS. I call a function in the for-loop from which I call CVX.

Is the solution from one problem feeding into the input for the next problem? In which case which iteration you start it at might affect what the subsequent problems are?

No. The problems are completely independent.

Then you will need to provide more information. Maybe the problems aren’t independent even though you think they are. We, the forum readers, have no idea what your code or the mystery function are.

Are “you”, or any function you are calling, generating or using random numbers for anything? If so, perhaps the problem instantiations depend (indirectly) on previous iterations.