# Maximize correlation subject to nonconvex correlation constraints

Let $$r, z$$ and each of $$u_i$$ be a length $$n$$ vector. I’d like to maximize the correlation between $$z$$ and $$r$$ (when that correlation is positive) while keeping $$z$$ “away” from $$u_i$$’s. Formally,

\begin{align} \max_z &\quad \text{corr}^+(z,r) \\ \text{s.t.} &\quad \text{corr}(z,u_i)\leq a_i,\ i = 1, \dots, k \end{align}

where $$\text{corr}(z,r) \stackrel{\text{def}}{=} \frac{z^T r}{\sqrt{z^Tz}\sqrt{r^Tr}}$$, and $$\text{corr}^+(z,r) \stackrel{\text{def}}{=} \max(0, \text{corr}(z,r))$$, and $$0 \leq a_i \leq 1$$ for all $$i$$

The trouble is that the constraints are non-convex. Any leads? Thanks!

You could add the non-convex constraint $$z^Tz = 1$$. That would make the objective function and other constraints linear. So this would be a Linear Programming problem, but for a single non-convex equality constraint. Use either a global non-convex optimization solver (if the problem can be solved fast enough) or local non-convex optimization solver to solve it.