Friday October 29 9:30 AM – Friday October 29 11:00 AM in Workshop/Tutorial I

Building linear programs with ORTools

Ross Hart

Prior knowledge:
No previous knowledge expected


Linear programming (LP) and mixed integer linear programming (MILP) are important tools for solving large scale optimisation problems. In this tutorial, the key concepts LP/MILP will be described, and I will walk through an example showing how one might identify and formulate a solution to such a problem. I will then demonstrate how to find an optimal solution using the open source ORTools suite.


The ability to solve mathematical optimisation programs is an important tool for implementing end-to-end Data Science solutions. There are a number of techniques one can use to solve such problems, and one of the most well-known is linear programming, or LP. By formulating an optimisation problem as a set of linear constraints with an objective function to minimise or maximise, one can find an optimal solution to optimisation problems very quickly using LP. This tutorial is aimed at beginners to optimisation/operations research type problems and will introduce participants to LP, and also mixed integer programming (MILP). I will describe the key components of LP/MILP problems, discussing how one might identify such a problem in a Data Science project and how one might try to solve it. I will then walk through a full example solving an LP problem by first formulating the problem on paper before converting the program to machine-solvable code. I will show how one can use the open source ORTools package in Python to interface with a number of free open source MILP/LP solvers to find optimal solutions to operations research problems quickly. At the end of the session, newcomers to optimisation problems should have a firm understanding of how to formulate and solve real world LP/MILP problems, and have hands on experience writing out and solving an example of an LP.