Sie sind auf Seite 1von 4

IE507, Modeling and Computation Lab

Lab 05 28-August-2019

Instructions:

We will continue modeling optimization problems with integer variables in this lab. Recall that
integer optimization problems are those where some or all variables can take only integer values in
the solution. In this lab, we will consider two popular applications of MILP, namely the assignment
problem and the max-cut problem.

There are only 3 exercises in this lab. Try to solve all problems on your own. If you have difficulties,
ask the instructor or TAs. Clarifications will be provided to all Exercises.

Name your .mod files for Exercise 1 as ex1.mod (or ex1a.mod, ex1b.mod etc.), and ex2.mod (or
ex2a.mod, ex2b.mod etc.) for Exercise 2. Similarly name your .dat files as ex1.dat (or ex1a.dat,
ex1b.dat) for Exercise 1, and ex1.dat (or ex1a.dat, ex1b.dat) for Exercise 2. Follow a similar
procedure for Exercise 3 as well.

Upload a single zip file (with name YOURROLLNO Lab5.zip) to moodle, containing the report in pdf
format (with name YOURROLLNO Lab5 report.pdf), and all your AMPL code/model/data files.
Show all your work to TA/instructor before leaving.

The deadline for today’s lab submission is today, 11 55 PM IST.

1
IE507, Modeling and Computation Lab
Lab 05 28-August-2019

Exercise 1: Facility Assignment Problem [15 marks]


Sangam constructions Inc. has to build n ∈ N different types of facilities, one at each of the n
locations. The cost of constructing the ith facility at the j th location provided in the table below.
The constructions company wants to minimize the sum of the costs of assigning all the facilities to
the locations.
1. [R] Write a mathematical model of the above assignment problem. Define all the variables
and constraints clearly.
2. Write an AMPL model for this problem for a general n. You can assume that the cost matrix
is given as data file.
3. Use the table below to make a data file for your model.
4. [R] Solve the problem and report which facility must be opened at each location.
5. [R] Now change the integer variables in your model to continuous variables, and re-solve the
problem. Report the solution.
6. [R] Are the optimal costs for both problems same? If yes, explain why.
7. Will the solution to the continuous problem become fractional (non-integer) if the costs are
changed to non-integer values? Try changing the costs and whether the solution to the LP
becomes fractional.
8. [R] Now suppose that, due to some reason, facility 1 cannot be assigned to location 4, facility
8 cannot be assigned to location 11 and facility 4 cannot be assigned to location 7. What
changes in .mod or in .dat file will you make? Solve the integer problem and report the
solution.

Location
Facility
1 2 3 4 5 6 7 8 9 10 11 12
1 50 73 62 41 55 60 39 48 67 71 44 59
2 90 57 82 77 91 66 65 78 84 95 59 67
3 63 66 75 54 68 75 81 56 71 120 49 65
4 87 120 81 67 71 82 120 63 70 90 54 62
5 95 91 74 81 63 59 93 65 84 93 46 56
6 110 86 80 59 57 55 78 61 130 84 55 79
7 61 71 91 55 81 73 91 72 85 76 58 63
8 56 69 66 64 72 67 83 69 88 100 71 68
9 78 80 87 98 96 104 99 97 68 90 81 73
10 92 72 82 74 82 83 89 98 93 94 125 120
11 91 84 62 70 73 79 78 76 72 74 71 84
12 82 83 84 72 82 80 82 89 97 99 102 122

2
IE507, Modeling and Computation Lab
Lab 05 28-August-2019

Exercise 2: Max-Cut of a Graph [15 marks]


Let G = (V, E) be an undirected graph, where V and E are, respectively, the set of vertices and
edges. Let wij ≥ 0 be the weight of the edge (i, j) ∈ E.
A cut in a weighted undirected graph is defined as a partition of the vertices into two sets S and
V \ S (say), and the weight WS of the cut (S, V \ S) is the summation of the weights of the edges
who have one end point in S and the other in V \ S, i.e.,
X
WS = wij
(i,j)∈E:i∈S,j∈V \S

The max-cut problem is defined as the problem to find a cut in the graph G with maximum weight,
i.e.,
max WS
S(V

1. [R] Write an integer programming formulation to find the max cut of a given graph. Define
all the variables and constraints clearly.
2. [R] Consider the first graph given below. Use your intuition to find the max-cut for the
graph (a). Explain why your intuition is correct.

3. Write a proper model and data file for the graph (b) and solve the integer problem using
Gurobi.
4. [R] Write down the solution and the value of max-cut for graph (b).

Figure 2: Graph (b).

Figure 1: Graph (a).

3
IE507, Modeling and Computation Lab
Lab 05 28-August-2019

Exercise 3: Revisiting course allocation [15 marks]


Recall the course allocation problem you solved in the last lab. As a student in IITB, you are
involved in selecting courses for completing your course requirements. You also want to make sure
that the courses you select are interesting to you. Suppose that there are ten courses C1, C2, . . .,
C10 being offered this semester. By completing each course you get the following credits:
Course Credit
C1 1
C2 6
C3 4
C4 6
C5 8
C6 8
C7 8
C8 6
C9 4
C10 6
You must gather at least 25 credits this semester. However your course selection depends on the
following constraints:
• You must register for at least 4 courses and can register for up to a maximum of 8 courses
this semester.
• Courses C5 and C6 run during the same slots.
• Courses C3 and C9 run during the same slots.
• If you register for course C7 you cannot register for course C2.
• If you register for course C10 you must register for course C1.
• Among the courses C2, C4, C8, C10, you must register for at least three courses.
• Among the courses C7, C5, C9, you can only register for at most two courses.

1. [R] Write a mathematical model so that you can maximize your credits to be accumulated
this semester. Explain how to design the model variables and indicate which variables are
integers.
2. [R] Solver your MILP and report the optimal value and the solution.
3. [R] Let us now compare it to a linear program. Suppose we remove the restrictions that
the variables in the above problem are integers. Solve this modified problem and report the
solution and the objective value.
4. [R] Can the solution of the MILP be obtained by merely rounding the solution of the LP?
Why or why not?
5. [R] Suppose a new course C11 with 10 credits is introduced, but the course timing for C11
overlaps with the course timings of C6, C7, C8, how will you change your model to include
this new constraint?
6. [R] Solve the modified MILP and report the optimal value and solution.
7. [R] Solve the modified MILP by removing the integer constraints on the variables and check
if the solution of the modified MILP can be obtained by merely rounding the solution of the
corresponding modified LP? Explain.

Das könnte Ihnen auch gefallen