Question: INDR 2 2 0 : Introduction to Computing for Operations Research Homework 3 : The Set Covering Problem Deadline: April 2 9 , 2 0

INDR 220: Introduction to Computing for Operations Research Homework 3: The Set Covering Problem Deadline: April 29,2024,11:59 PM
In this homework, you will implement a Python script that solves the set covering problem using CPLEX. As a specific example, consider the scheduling of airline flight personnel. The airline has M legs to be flown. The airline must schedule its K crews on N routes to cover these flights. One crew, for example, might be scheduled to fly a route containing two legs just mentioned. The decision variables, then, specify the scheduling of the crews to routes:
Let
1 xj =0
1 aij =0
if a crew is assigned to route j, otherwise.
if leg i is included on route j, otherwise,
and cj is the cost for assigning a crew to route j.
The coefficients aij define the acceptable combinations of legs and routes, taking into ac-
count such characteristics as sequencing of legs for making connections between flights and for including in the routes ground time for maintenance. The model becomes:
Legs 1231.SFtoLA 1
2.SF to Denver 13.SF to Seattle
451
11
11
111
67
6
11
15
9101112
10.Seattle to SF 11.Seattle to LA Cost (in $1000s)
1234
11119989
minimize subject to:
N
z = cj xj j=1
N
aijxj >=1
j=1 N
xj =K j=1
i =1,2,...,M
xj in {0,1}
An example of a set covering problem with eleven legs, twelve flights, and three crews is
given as
1
11
111
78
11
11
111
1
1
j =1,2,...,N.
Routes
78
11
4.LA to Chicago 5.LAtoSF 16.Chicago to Denver 7.Chicago to Seattle 8.Denver to SF
9.Denver to Chicago
1
1
11
11111
1
minimize subject to:
z =+2000x1+3000x2+4000x3+6000x4+7000x5+5000x6
+7000x7+8000x8+9000x9+9000x10+8000x11+9000x12
+ x1+x4
+x2+x5
+x3+x6+x4
+x1+x6+x4+x5
+x7
+x8
+x7
+x7+x8+x8
+x7+x8+x7+x8
+ x10
+x9
+x9+ x10
+ x11
+ x11
+ x11
+ x11
+ x11+x11
>=1
>=1+ x12>=1+ x12>=1>=1>=1+ x12>=1>=1>=1+ x12>=1+ x12>=1+x12=3
+x2+x4+x5+x5
+x3
+x1+x2+x3+x4+x5 x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12 in {0,1}.
+x6
+x9+ x10
+x6
+x9+x10
This problem will be represented using two .txt files, namely, flights.txt, costs.txt and the crew count parameter K, which is equal to 3 for the example problem. The first file contains the leg-route matchings (i.e., where aijs are nonzero), and it is composed of the following lines for the example problem:
flights.txt -----------11
14
1711022252821133363931244474941041251565105116465
2
+x9+x9
+ x10+ x10
697778
710711712828485899598
9111031071081012116119111011111112
The second file contains the route costs (i.e., cj), and it is composed of the following lines for the example problem:
costs.txt
---------
12000
23000
34000
46000
57000
65000
77000
88000
99000
109000
118000
129000
One optimum solution of the example problem is as follows:
x 1=0 x 2=0 x 3=1 x 4=1 x7=0 x8=0 x9=0 x10=0 z=18000.
Another optimum solution of the example problem is as follows:
x 5=0 x11=1
x 5=1 x11=0
x 6=0 x12=0
x 6=0 x12=1
x 1=1 x 2=0 x 3=0 x7=0 x8=0 x9=0 z=18000.
x 4=0 x10=0
3
Implement your algorithm to solve the set covering problem in a single interactive Python notebook using Azure Lab Services. Your notebook should include at least the following function definition that takes the file paths of two input files and the crew count as parameters and returns the solution found.
def set_covering_problem(flights_file, costs_file, K):
# your implementation starts below
# your implementation ends above
return(x_star, obj_star)
What to submit: You are provided with a template file named as 0099999 hw03.ipynb, where 99999 should be replaced with your 5-digit student number. You are allowed to change the template file between the following lines.
# your implementation starts below
# your implementation ends above
You need to submit your source code in a single file (0099999 hw03.py file that you will download from Azure Lab Services by following File/Save and Export Notebook As.../Executable Script menu items).
How to submit: Submit the file you edited to Blackboard by following the exact style mentioned. Submissions that do not follow these guidelines will not be graded.
Late submission policy: Late submissions will not be graded. Cheating policy: Very similar submissions will not be graded.
4

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!