minimize

\begin{equation}

\frac{1}{2}\sum_{t=2}^{T}\sum_{i=1}^{N}\sum_{j=1}^{m(i)}\sum_{k=1,k \neq j}^{m(i)} [(\Delta y_{t}-\Delta\mu_{k,j}^{(i)})^{T}\Sigma ^{-1}(\Delta y_{t}-\Delta \mu_{k,j}^{(i)})]Q(x_{t-1}^{(i)},x_{t}^{(i)})_{j,k}

\end{equation}

with respect to Q(x_{t-1}^{(i)},x_{t}^{(i)}) \forall i.

This is not the full objective function I’m trying to minimize. For brevity, I have only shown this term, which I have trouble expressing in CVX.

Q(x_{t-1}^{i},x_{t}^{(i)}) is a square matrix with dimensions m(i) by m(i). I have N such matrices, each being indexed by i. And, in each matrix i, the subscript {j,k} in Q(x_{t-1}^{(i)},x_{t}^{(i)})_{j,k} merely refers to the element of the $j$th row and $k$th column.

As follows is what I thought the problem, when expressed in CVX, should look like:

```
cvx_begin
variable Q1 (m(1),m(1),T);
variable Q2 (m(2),m(2),T);
...
variable QN (m(N),m(N),T);
expression e;
for t=2:T
for i=1:N
for j=1:m(i)
for k=1:m(i)
if(k~=j)
e = e + [(delta_y(t) - delta_mu{i}(j,k))'*sigma_inv*(delta_y(t) - delta_mu{i}(j,k))]*Q (I got stuck here. How do i reference Q1 to QN?)
end
end
end
end
minimize(e);
cvx_end
```

As you can see, it’s very inelegant. I’m aware that if a given problem could be expressed using norm(), it should be done so. However, due to the k\neq j criterion for the innermost summation and the multiple layers of summation, I thought the only way of expressing this problem in CVX is to incrementally add terms using the “expression” key word and multiple FOR loops.

Also, I have encountered a problem, in that I do not know how to reference all the Q variables (e.g Q1 to QN) unless i manually type them. This means I would need to unroll the loop and it gets really messy. Does CVX support cell variables (e.g “variable Q{1} (m(1),m(1),T)”)? I have browsed through the documentation and it doesn’t seem to support that. Hence, I’m really lost as to what to do.

I apologize for this awfully long post as I would like to make things as clear as possible. Any suggestions on how to approach this problem will be greatly appreciated.