In this model we will directly attack the quadratic form sum((i,j),x(i)*Q(i,j)*x(j)) to gain further performance improvements. By observing that

sum((i,j),x(i)*Q(i,j)*x(j)) = sum(j,sum(i,x(i)*Q(i,j))*x(j))

we can substitute the inner sum out by inserting extra auxiliary variables into the model:


It is clear the model size in terms of number of rows, columns and nonzero elements will increase. But this is more than compensated by the much simpler non-linear structure of the model.

The model QP3A implements this trick with a full variance-covariance matrix while QP3B adds the symmetry exploiting trick of model QP2.

Note: to prevent model QP3B to use the advanced basis resulting from solving QP3A, we used the statement: option bratio=1;. This will prevent the next solves to use existing basis information.