Lecture 21

Here is a formulation for the long/short portfolio optimization problem with long and short positions which has some "problems". After the "END" you will see a longhand description of some of the inequalities. And here is the same formulation, with some of the problems fixed by using binary variables to describe logical statements.

Here is a Markowitz mean-variance problem where every asset appears in the optimal solution. Here is the same formulation, but with a limit on at most 3 names in the optimal portfolio. This is the code calling Gurobi that produces this formulation.

This is a simple computationally intensive function. This is the "main" that calls it. And this is another "main", but with more structure that we will use to make the program multithreaded.