Cvx model inside a loop

Hi, I’m using cvx as a part of an iterative optimization algorithm which does something like this:

while ~cond

cvx_begin
	variable x(n,n);
	% some more vars
	
	minimize x' * C * x
	
	A * x == b;
	% some more constraints
cvx_end

% more calculations

[Am, bm, Cm]update(A, b, C, x);
A = Am;
b = bm;
C = Cm;

cond = check(A, b, C, x);

end

The thing is that A, b and C remains mostly unchanged from one iteration to the other, so I was wondering if there is some way to tell cvx to start from the previous solution instead of starting from scratch.
I worked previously with CPLEX and there are some objects that keep the state of the problem and solution and it saves a lot of time.
Besides from my experience (with this particular problem) it takes more time to “translate” the cvx code to the solver than to actually solve the problem once the solver gets to it.
Does someone has come to the same issue? What can I do?

Thanks,
Sebastian

There’s nothing you can do using CVX. You may be better off calling CPLEX in another fashion if execution speed for your scenario is important.

This should be easy to do using cplexqp .That eliminates all CVX modeling time, and allows you to specify a starting point, x0 (not sure how good that will be if x0 is not feasible, though). The advantage of CVX vs. directly calling, for instance, cplexqp, is when your model is not already close to being in the standard form required by the solver.

I think all you need is
x = cplexqp(2*C,zeros(n,1),[],[],A,b,[],[],x0)
in place of your CVX code.
If your other constraints are linear inequalities and bounds, just insert them in lieu of the [ ].

I presume you mean
variable x(n,1)
not
variable x(n,n)