Portfolio Optimization with Gurobi

Portfolio optimization is a tool for optimizing the expected return, risk, or other measure for a portfolio of investments. Quantitative analysts and portfolio managers use portfolio optimization to support their investment making decisions. With Gurobi’s mixed-integer programming (MIP) technology, it is possible to incorporate discrete decisions in the portfolio selection. Common examples are cardinality constraints on the number of allocations, or the consideration of transaction costs.

As a simple demonstration, we compute the efficient frontier for a set of 463 S&P 500 stocks (1) without constraints on the number of transactions, (2) with the restriction of trading at most 10 assets, and (3) trading only five assets.

Efficient frontier and asset universe

Using only five assets, that is, effectively forbidding diversification, the estimated risk increases substantially, whereas restricting the investment to comprise at most ten assets, we see that the efficient frontier moves only slightly away from the unconstrained frontier. Hence, there is limited benefit of using more than ten assets from an efficiency point of view. Finally, we compare the minimum variance portfolios for the three scenarios above:

Minimum-variance portfolios with different cardinalities

Obtaining such insights is a technical advantage of MIP technology and would be difficult to obtain through classical portfolio optimization methods alone. We will give many more examples of MIP-based modeling capabilities in the next section.