Can CVX Objective Functions and Constraints be Reused Across CVX Blocks?

Hello everyone,

I am currently working on solving a sequence of optimization problems using CVX. The objective function and constraints are almost the same across multiple CVX blocks and constructing them is computationally expensive. Therefore, I am interested in defining them once and reusing them across the multiple CVX blocks. I’d like to know if it is possible to define them using expression in one CVX block and then reuse them in another CVX block? Any guidance or insight would be greatly appreciated.

Thank you in advance!

Not possible in CVX. Is possible in YALMIP.

@Mark_L_Stone Many thanks for sharing your idea. Yes, Yalmip do the job, but I have to say that constructing and solving my required model via CVX is much faster than using Yalmip. Unfortunate, CVX doesn’t support the feature I need. Hoping to see an upgraded version will include this functionality in the future. I believe that this feature would be very useful in solving a sequence of similar optimization problems with minor changes. Again, thanks for your reply. Now, I have to manually convert my complex model into the format of the solver for speed …

I doubt there will ever be such an upgrade in CVX. CVX development has been de minimis for the last 3 years, and likely going forward.