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!


1 Answer 1


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.

  • $\begingroup$ I clarified the problem to force the objective to be positive.. wonder if that’s easier? $\endgroup$
    – boombeach
    Commented Apr 29, 2022 at 14:22
  • $\begingroup$ Really no different. If you solved the original problem and the optimal objective value was negative, you'd "promote" it to zero, otherwise, leave it be.. Doing this would provide the solution to your revised problem. $\endgroup$ Commented Apr 29, 2022 at 14:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.