CE 367R - Optimization Techniques for Transportation EngineeringSpring 2021Homework 3: Shortest paths and maximum flowDue on Canvas at 11:59 PM, Friday, February 10. Submit a ZIP file containing your code for the Python problems. More details below on how to submit the Python code. The questions on this assignment involve basic network algorithms. Download and unzip these files to a convenient directory, or fork this repl.it. The only file you will be editing in this assignment isnetwork.py,
but you are free to look at the other files too for reference.
You will continue working with the Network class used in the
previous homework assignment. The main Python problem involves implementing a
shortest path algorithm -- you can implement any of the algorithms learned in
class. There is an optional, extra-credit second Python problem implementing
one of the maximum flow algorithms from class. You are not required to solve
this second problem for full credit.
There are also two problems which can be solved either by hand or by using
Python code you have written. The solutions to these problems can be neatly
handwritten or typed, and submitted on Canvas as a separate PDF file from the
.zip containing your Python code.
You may work with (one) partner from the class to complete these questions.
Make sure your README.TXT file contains the name of your partner.
Only one partner needs to submit on Canvas.
Important note: Python starts counting lists at zero, not one.
So if there are 5 nodes in the network ( Question 1: Shortest pathThe main coding question on this assignment has you implement one of the
one-to-all shortest path algorithms from class (your choice). In
The You can view the test instances and networks by browsing in the
Question 2: Maximum flow (optional extra credit)An optional coding question has you implement one of the maximum flow algorithms taught in class. You can receive full credit on this assignment without attempting this question, but there are some extra credit points available if you can successfully complete it. Look at the To access the capacity of the link between nodes i and j, use
Fair warning: this problem is significantly harder than the other programming questions you've done so far. You may find it helpful to re-use your basic search code from the previous assignment, perhaps with some minor modifications. Question 3: Shortest path applicationThe last of the test instances for Question 1 uses a network which is
(loosely) based on the city of Sioux Falls, SD. This is a schematic of the
network showing the links and nodes; the costs are given in the file
What is the shortest path from node 1 to node 23, and what is its cost? If you got full credit for Question 1, your code already has the answer to this. Can you display it in a way that lets you identify what the actual path is? Question 4: Maximum flow applicationYou are manufacturing goods in one location, and must ship them by rail to another location for sale. The following network represents the options available to you, where the source and sink nodes correspond to the production and retail locations, and the other nodes represent cities with transfer points. All links represent rail lines, and the capacities represent the rate at which you can move your product along those rail lines, in tons per day. (This capacity largely reflects the frequency of trains along the route.)
What is the maximum rate at which you can deliver product from the manufacturing plant to the retailer (in tons per day), and how much product will be shipped on each rail link in order to do so? (For this problem, you don't have to worry about how long it actually takes to ship the product. The flow values above will give the "steady-state" flow rates over the long term.) Submission instructionsYour answers to Questions 3 and 4 should be placed in a single PDF file and uploaded to Canvas. Please verify that your file uploaded correctly, that the pages are in the right order, etc. For the Python questions, submit a single ZIP file and upload to Canvas. Please follow these instructions:
unzip hw2.zip diff -bur master/ hw2/ # master is the original; this shows me your changes cd hw2 cat README.txt python3 grader.py cd .. rm -r hw2 hw2.zip Return to CE 367R. |