Linear programming problems are a special class of optimization problem where the objective function and constraints are linear functions of the variables. We explore one such problem and its solution using the scipy.optimize module.
Computing With Text
Project Gutenberg provides an online database of more than 49,000 free ebooks. We use Python's file handling functions to load and display the text of a classic play.
Week 14 Notebook
Python
- String formatting using format.
- Reading and writing files using open, close and read.
NumPy
- Indexing using integer arrays
scipy.optimize
Quiz
There will be no quiz this week.
Assignment 10: Linear Programming
Activity:
- Model the Alaska pipelines problem in Python.
- Use scipy.optimize.linprog to find the maximum possible flow from the oil fields to the refinery using the "simplex" algorithm.
- Give full details of your solution, clearly identifying the flow through each pipeline.
- Suggest a way to increase the maximum flow by at least 3 units for as little cost as possible.
- Confirm that the suggested change is successful.