# Markowitz portfolio with factor/position constraints

General Markowitz-style optimization (problem objective of $$w^T \mu - \lambda w^T \Sigma w$$) yields simple optimal weights policy $$w \propto \Sigma^{-1} \mu$$.

However, I would like to add a series of factor exposure constraints (i.e. $$| w^T \beta_i | < k_i$$ for factors indexed by $$i$$, instrument exposure vector to $$i^{th}$$ factor by $$\beta_i$$). I may wish to extend to maximum position values as well, which is basically just another constraint with a different beta vector.

Is there a standard way do this quickly, closed form or similar, with the addition of these types of constraints? Or some common, clever transformations/relaxations that would help facilitate practical solutions under time constraints?

I've got to imagine this is a pretty solved problem, since many portfolios have these types of constraints. I'm just not sure if folks throw into an optimizer and don't care about very fast solutions/closed form solution explicitly. Or do something altogether different. Is there some industry standard or set of resources available to follow? Thanks!

\begin{align} \min&\quad w^Tq+\frac{1}{2}w^TQw\\ \mathrm{s.t.}&\quad Aw=a\\ \mathrm{s.t.}&\quad Bw\leq b\\ \end{align}
In your case, $$|w^T\beta_i|\leq k_i$$ translates to two additional entries in $$B$$, i.e. $$w^T\beta_i\leq k_i$$ and $$-w^T\beta_i\leq k_i$$:
$$\begin{pmatrix} \ldots & \ldots & \ldots & \ldots \\ \beta_{1i}&\beta_{2i}&\ldots&\beta_{ni}\\ -\beta_{1i}&-\beta_{2i}&\ldots&-\beta_{ni}\\ \ldots & \ldots & \ldots & \ldots \end{pmatrix}w \leq \begin{pmatrix}\ldots\\k_i\\k_i\\\ldots \end{pmatrix}$$