I am trying to solve a portfolio optimisation problem with the constraint that weights can be either zero or at least min
(a Nx1
vector).
import cvxpy as cp
w = cp.Variable(len(mu))
mins = np.ones(len(mu)) * 0.03
risk = cp.quad_form(w, S)
prob = cp.Problem(cp.Minimize(risk),
[cp.sum(w) == 1,
w >= 0,
w >= min OR w == 0 # pseudocode for my desired constraint]
This is equivalent to a constraint that the weights are NOT 0 < w <= min
, but I cannot find a way to express this in CVXPY (I have googled things like "cvxpy OR constraint" to no avail).
It feels like I'm missing something obvious. Perhaps there is a solution involving some boolean vector?