# Optimal portfolio construction for tactical asset allocation

This is the first time I post question here so if there is anything that does not follow the rule, please bear with me and let me know.

I am trying to solve this optimization question but I don't know yet how to do it in R.

What I try to do here is to find the way to optimally overweight/underweight a pair trade (i.e: stock-bond) compared to the benchmark.

x: vector of bet size/ tilt (%)

Score: vector of signal score (i.e -1,0,1,...)

Q: co-variance matrix of each pair trade.

I also intend to add constraints on values of x (nonnegative, etc).

Looking forward to learning from you and have a good day!

maximise over $x_i$ $$x_i'S_i - 0.01^2\lambda_i$$ s.t. $$x_i'Qx_i=0.01^2$$
You may have some success if you investigate techniques for solving the constraint in the first place and then the resultant linear objective function may be easier after that, particularly if you further restrict $x_i$ with additional constraints.