I am successfully using CVX so far. However I am currently trying to solve a combinatorial problem where every substep is convex. This requires me to solve the exact same CVX problem in a loop many times.
I see that the computer is spending a lot of time to setup the CVX problem rather than solving it. What I need is to tell the CVX that the problem definition is exactly the same but it needs to be solved with different values. For this mentioned reason my entire optimization is running too slow.
Is there a way to solve this issue, some sort of program cache?
No, there is no such facility. This is frankly a frequently asked question! The fact is that the overhead of CVX is simply the cost you pay for making it easy to build and specify models.
If you believe that removing the overhead of CVX will give you the speedup you need, you’ll have to do it manually. That is, you’ll need to call the solvers directly.
The latter would require a complete redesign of CVX. Not going to happen. You can, of course, embed CVX models inside functions (though not nested ones), but you will be taking the overhead with you. CVX is not for speed; it is for convenience.
It’s not that I don’t want CVX to have low overhead. It’s just that there is no separation between the definition of a CVX model and its processing. They are done at the same time, as a tightly integrated unit. So there’s no way to separate them even for just small changes in the model.