# L1 Norm Constraint in Maximum-Sharpe-Ratio Portfolio

Dear Gurobi Community,

I successfully implemented a Minimum-Variance Portfolio with L1 Norm Constraint in order to control the short selling budget (e.g. to create a 130/30 long short strategy). Doing so, I chose to linearize the L1 Norm Constraint for subsequent representation purposes.

However, I am struggling now to transfer the linearized L1 Norm Constraint to a Maximum-Sharpe-Ratio Portfolio, because of the conversion which is necessary to optimize the portfolio in Gurobi, see:

https://support.gurobi.com/hc/en-us/community/posts/360074491212-Divisor-must-be-a-constant

I was able to model the Maximum-Sharpe-Ratio Portfolio with Short Selling Constraint due to Eli's awesome explanation, but does anyone know how to do the conversion in case of a linearized L1 Norm Constraint in Gurobi? All of my attempts failed so far.

The following displays the optimization problem and its corresponding conversion on paper:

The following displays a code snippet of my current approach to a Maximum-Sharpe-Ratio Portfolio with Short Selling Constraint in Python/Gurobi and serves as my starting point I'd like to augment for the linearized L1 Norm Constraint:

N = returns.shape[1] # number of assets

S = returns.cov().to_numpy() # covariance matrix

mu = returns.mean().to_numpy() # expected returns

A = mu

b = np.array([1])

C = np.identity(N)

d = np.repeat(0,N)

model = gp.Model("MaxSharpeSSC")

y = model.addMVar((N,), lb=-gp.GRB.INFINITY)

model.setObjective(y @ S @ y, gp.GRB.MINIMIZE)

model.addConstr(A @ y == b)

model.addConstr(C @ y >= d)

model.update()

model.optimize()

print(y.X)

Any ideas would be much appreciated.

Best Regards,

Dominik

Please sign in to leave a comment.

## Comments

0 comments