Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1 As we learned in class, NetworkX is a Python package that facilitates working with networks. The package provides us with some pro-designed networks.

image text in transcribed
Question 1 As we learned in class, NetworkX is a Python package that facilitates working with networks. The package provides us with some pro-designed networks. We would like to model and solve the minimum cost ow problem on one of these graphs called Karate club which has 34 nodes. We can load this graph as a directed graph and draw it using the below code. No worries if the graph is not shown properly. We do not need to do any visualization on it. import network}: as nx DG = nx.DiGraph(nx.karate_club_graph()) nx.draw(DG, with_1abels = True) The cost of shipment between 1' andj can be randomly generated in (1,100). The capacity of each arc is random in (100, 1000). Since there are supply nodes (with positive hi) and demand nodes (with negative in) in the minimum cost flow problem, you need to divide the nodes of this network into two categories: supply and demand. You may choose any method you want for this purpose, but here are some ideas: 0 First 17 nodes are supply nodes, and the next 17 are demand nodes. 0 Nodes with odd indices are supply nodes, and the ones with even indices are demand nodes. After splitting the nodes, generate random numbers in (1, 100) for b,- of supply nodes and in (-100, -1) for bi of the demand nodes. After that, you need to make sure that the sum of all supplies is exactly equal to the sum of all demands. For example, if the sum of supplies is 1,234, the sum of demand must be 4,234. Make sure to comment on your code and use a function to print your results. Write the model to a '.lp' file and submit it along with your code

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Quantitative Analysis For Management

Authors: Barry Render, Ralph M. Stair, Michael E. Hanna

11th Edition

9780132997621, 132149117, 132997622, 978-0132149112

Students also viewed these Mathematics questions

Question

List two disadvantages of global economic integration.

Answered: 1 week ago