This week's notebooks focus on the use of PuLP - a Python-based mathematical programming framework. As we will not be going into detail regarding the mechanics of the algorithms used to solve mathematical programs in this module, PuLP and Solver are the only means that we will have at our disposal to solve the problems that we encounter.
In this notebook we are going to introduce a Python package called
pulp (PuLP), which we can use to represent and solve optimization problems. We will be starting with the simple two-variable model that we discussed in Part 3 of this session
We are now going to demonstrate the use of PuLP with a slightly larger problem. For this notebook, we will be considering the explicit transportation model formulation that we discussed in Part 2 of our session.
By now we have established that explicit models are not at all practical, and always good to avoid as much as possible - whether we are formulating a model using pen and paper, or with a modeling framework. This notebook demonstrates how we can implement a symbolic model using PuLP.
We can now try to model a more complex problem - in this notebook we will be looking at the symbolic version of the Transhipment or Minimum Cost Flow Problem, building on top the formulation that we developed in the previous notebook.
This notebook introduces two further approaches that we could use to solve the MCF model - the first involves NetworkX (which we know how to use already), while the second uses Google’s OR Tools - which has an MCF-specific solver which allows us to model problem instances without having to also build a new formulation.
As we discussed in the lecture, we can repurpose our MCF formulation to obtain the shortest paths in a network. This notebook demonstrates how.
We have now covered all the PuLP modeling features that we are going to need for this module. This notebook presents an implementation of our knapsack model.
And the final notebook for this series focuses on the covering problem. We also show how to obtain the values of specific decision variables.
Running the notebooks
You can download a zip file containing all the notebooks that we covered in this session from the link below: