Could you kindly help me with the following issue: Is there a more efficient way to formulate the problem below?
It involves two for loops and takes about 6h to run in matlab.
lambda = 0.001:0.001:0.02; %pricing error
for j = 1:T-t %rolling window over time
for k = 1:length(lambda) %for each pricing error
minimize( sum_square_pos(data(j:t+j,: ) * weights) * 0.5 */T - sum(weights) + lambda(k)*norm(weights(3:end)) ;
weights_RW(j,k,: ) = weights;
dispersion_RW(j,k) = -cvx_optval;
So I am basically trying to minimize the variance of a return portfolio (data*weights) over rolling windows of size t+j, for each value of the pricing error lambda, while penalizing some of the weights using an L2 norm.
How big is N? What is the total number of times CVX is called inside the double for loop? How much time is spect by the solver vs. time spent by CVX (how long until solver output starts if you remove the quiet option vs. time before solver output starts?)?
Hi Mark, thank you for your reply. N = 12. There are 170 rolling windows (for the first loop) and about 200 possible values for the pricing error (second loop). Without the loop, the CVX is solved in about a minute.