Solving linear programming problems (LPPs) using Pyomo
In this tutorial, we learn how to solve linear programming problems (LPPs) using Pyomo. Pyomo stands for Python Optimization Modeling Objects. This is an algebraic modeling language.
Pyomo is a Python-based, open-source optimization modeling language with a diverse set of optimization capabilities. — http://www.pyomo.org/
In this tutorial, we consider an optimization problem and then we formulate it as a linear programming problem (LPP). After that, we learn how to write a Pyomo-based model using Python to solve the problem.
Example problem
Consider a chocolate manufacturing company that produces only two types of chocolate — A and B. Both the chocolates require Milk and Choco only. To manufacture each unit of A and B, the following quantities are required:
- Each unit of A requires 1 unit of Milk and 3 units of Choco,
- Each unit of B requires 1 unit of Milk and 2 units of Choco.
The company kitchen has a total of 5 units of Milk and 12 units of Choco. On each sale, the company makes a profit of
- Rs. 6 per unit A sold,
- Rs. 5 per unit B sold.