Question: INDR 2 2 0 : Introduction to Computing for Operations Research Homework 3 : The Set Covering Problem Deadline: April 2 9 , 2 0
INDR : Introduction to Computing for Operations Research Homework : The Set Covering Problem Deadline: April : 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
xj
aij
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 SFtoLA
SF to Denver SF to Seattle
Seattle to SF Seattle to LA Cost in $s
minimize subject to:
N
z cj xj j
N
aijxj
j N
xj K j
i M
xj in
An example of a set covering problem with eleven legs, twelve flights, and three crews is
given as
j N
Routes
LA to Chicago LAtoSF Chicago to Denver Chicago to Seattle Denver to SF
Denver to Chicago
minimize subject to:
z xxxxxx
xxxxxx
xx
xx
xxx
xxxx
x
x
x
xxx
xxxx
x
x
x x
x
x
x
x
xx
x x x x xx
xxxx
x
xxxxx xxxxxxxxxxxx in
x
x x
x
xx
This problem will be represented using two txt files, namely, flights.txt costs.txt and the crew count parameter K which is equal to for the example problem. The first file contains the legroute matchings ie where aijs are nonzero and it is composed of the following lines for the example problem:
flights.txt
xx
x x
The second file contains the route costs ie cj and it is composed of the following lines for the example problem:
costs.txt
One optimum solution of the example problem is as follows:
x x x x x x x x z
Another optimum solution of the example problem is as follows:
x x
x x
x x
x x
x x x x x x z
x x
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 setcoveringproblemflightsfile, costsfile, K:
# your implementation starts below
# your implementation ends above
returnxstar, objstar
What to submit: You are provided with a template file named as hwipynb, where should be replaced with your 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 hwpy file that you will download from Azure Lab Services by following FileSave and Export Notebook AsExecutable 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.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
