Hi everyone. I am trying to solve a financial mixed-integer programming optimization problem using the ‘SCIP’ solver.
The problem I am trying to solve is set in the following manner:
w = cp.Variable(5) # asset weights of the portfolio (5 assets in this example). This is the solution of our optimization.
k = cp.Variable() # Relaxation variable (not sure yet why cvx problem is infeasable with this variable, but it works when we use it)
mu is an the expected_return vector
sigma is the covariance matrix
objective = cp.Minimize(cp.quad_form(w, sigma))
constraints = [
(mu - 0.02).T @ w == 1,
cp.sum(w) == k,
k >= 0,
]
cp.Problem(objective, constraints).solve()
The problem shown above works. but when we do this:
v = cp.Variable(5, boolean=True) # Binary variable vector indicating if we are going to invest or not in the asset
For each asset “i” we add the contraints:
w[i] >= 0.3 * v[i], # Vector switching variables
w[i] <= v[i]
Then cvx says the it can’t solve because the problem does not follow DCP rules…
I agree that it’s not convex, but how can I rearrange the constraints and/or objective so that I have the same problem in a DCP format?