Handling optimization problems with Python
As you've probably already figured out, the large community that develops Python packages never stands still. Even in this case, it provided a module that helps us solve linear optimization problems. Its name is PuLP (https://github.com/coin-or/pulp) and it is an LP modeler written in Python. It interfaces with the most common free and not-free engines that solve LP, Mixed Integer Programming (MIP), and other related problems, such as GNU Linear Programming Kit (GLPK), Coin-or Branch and Cut (CBC), which is the default one, and IBM ILOG CPLEX. Its use is quite straightforward. Let's put it into practice right away with the problem from the previous section.
Solving the LP problem in Python
The code that will be explained to you in this section can be found in the 03-linear-optimizaiont-in-python.py
file in the Chapter10\Python
folder of the repository.
First, you have to install the PuLP
module in your environment:
-
...