The infinity norm of a vector is the maximum absolute value among its entries. For portfolio weights, it limits the magnitude of the largest position. section 10.2.2 section 10.3.2
Capping every portfolio position
The constraint cp.norm_inf(w) <= 0.5 ensures that every weight has magnitude at most 0.5. A 25% cap similarly prevents any asset from exceeding 0.25, helping reduce concentration. section 10.2.2 section 10.3.2
Listing 10.10 Maximum position size constraint
class GlobalMaxWeightConstraint(Constraint):
def __init__(self, upper_bound: float):
""" Constraint to enforce an upper bound on the magnitude of every
asset in the portfolio
:param upper_bound: Magnitude of every position will be constrained
to be at most this value
"""
self.upper_bound = upper_bound
def generate_constraint(self, variables: Dict):
return cp.norm_inf(variables['w']) <= self.upper_bound
Inspect the reusable GlobalMaxWeightConstraint implementation, which generates an infinity-norm bound for portfolio weights. section 10.3.2
Applying an infinity-norm position cap involves practical trade-offs:
- Adding a 25% cap shifts weight from emerging-market equities into other equity classes and can move bond weights to zero. section 10.3.2
- Combining the cap with a 5% volatility bound can make the feasible set empty, causing cvxpy to return NaN. section 10.3.2
