You are on page 1of 3

Linear optimization

In the CAPM and APT pricing theories, we assumed linearity in the models and solved for
expected security prices using regressions in Python.

As the number of securities in our portfolio increases, certain limitations are introduced as
well. Portfolio managers would find themselves constrained by these rules in pursuing
certain objectives mandated by investors.

Linear optimization helps overcome the problem of portfolio allocation. Optimization


focuses on minimizing or maximizing the value of objective functions. Some examples
include maximizing returns and minimizing volatility. These objectives are usually
governed by certain regulations, such as a no short-selling rule, or limits on the number of
securities to be invested.

Unfortunately, in Python, there is no single official package that supports this solution.
However, there are third-party packages available with an implementation of the simplex
algorithm for linear programming. For the purpose of this demonstration, we will use Pulp,
an open source linear programming modeler, to assist us in this particular linear
programming problem.

A maximization example with linear


programming
Suppose that we are interested in investing in two securities, X and Y. We would like to find
out the actual number of units to invest for every three units of the security X and two units
of the security Y, such that the total number of units invested is maximized, where possible.
However, there are certain constraints on our investment strategy:

• For every 2 units of the security X invested and 1 unit of the security Y invested, the
total volume must not exceed 100
• For every unit of the securities X and Y invested, the total volume must not exceed 80
• The total volume allowed to invest in the security X must not exceed 40
• Short-selling is not allowed for securities

The maximization problem can be mathematically represented as follows:


subject to:
By plotting the constraints on an x by y graph, a set of feasible solutions can be seen, given
by the shaded area:

You might also like