# How can I set portfolio weights inverse to volatility, with constraints and target volatility, using nonlinear optimization?

There are multiple sources that describe using a nonlinear optimization to risk budget a portfolio, with a portfolio target volatility. For example, see pages 16 and 17 of https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2673124

Given assets 1, ... , n, risk budgets $s_1,...,s_n$ and weights $w_i,...,w_n$, maximising: $$\sum_{i=1}^{n} s_i . log(w_i)$$ subject to $$\sqrt{w \Sigma w} \leq \sigma_{tgt}$$ will give weights such that each assets 'risk contribution', will be proportional to its risk budget: $$w_i . MCR_i \propto s_i$$

I'm trying to adapt this to set $w_i$ $\propto$ $s_i / v_i$, rather than $w_i . MRC(w_i)$ $\propto$ $s_i$, where $v_i$ is asset i's volatility.

Is this possible using nonlinear programming, and if so what should my objective function be?

(I could do this by just setting the weights and then scaling them to target vol, but I have various constraints that prevent this)

For the specification $w_i = s_i/v_i$ the objective is $$argmin \sum_i \left(w_i - \frac{s_i}{v_i}\right)^2.$$ Add to this any constraints you might have.