`cvx_setspath` and speeding up CVX with iterative calls

I have an application where I make iterative CVX calls, changing some parameters of the objective function each iteration. Running the matlab profiler, I found that my code spends almost half it’s total time in cvx_setspath; the other half is spent actually solving the optimization problem.

Is there some way I should be invoking cvx so that such iterative calls run more efficiently? I’ve tried to set the solver to SeDuMi, but that doesn’t help.

Very interesting observation! I am going to make a guess that your models are relatively small. I will be honest, CVX is not designed for speed of execution; it is designed for the convenience of the modeler. As a result it imposes a non-zero modeling overhead, even for the smallest models.

That said, I am always interested to hear when people encounter such clear bottlenecks as this.

The only thing I would suggest you try is to insert cvx_setspath before the loop where you call the model. This may eliminate at least some of the path manipulation overhead.