0% found this document useful (0 votes)
4 views7 pages

CompAss1 - 2023

Uploaded by

Maarten Overeem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views7 pages

CompAss1 - 2023

Uploaded by

Maarten Overeem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Combinatorial Optimisation

Computer Assignment 1

Important information: read carefully!


Requirements
• An understanding of branch and bound, relaxations, linear programming, and Aimms.

• This assignment requires programming in Aimms. Before you start, check whether Cplex
is the default solver for Aimms. If not, go to “Settings” → “Solver configuration” →
“Add”. Press the wizard button and select libcpx*.dll. Click on “Open” and next
“OK”. Then double click on the crosses in the row of the newest Cplex version under the
columns LP and MIP.

Hand-in information
• The hand-in deadline is Friday, September 29 at 23:59.

• The assignment can be made in groups of up to two students, but needs to be handed
in by one of the group members. When doing so, make sure to register as a group in
Codegrade.

• We use a web page for filling in the answers and Codegrade to grade your assignments.

Assignment web page


On the assignment web page (https://econometricinstitute.github.io/comb-opt-website/
instructionsAssignment1.html), you will find the instructions and 4 separate exercises.
These are ‘Instructions’ and ‘Exercise *’, where ‘*’ corresponds to the exercise number
in this assignment (1 to 4). The purpose is as follows.

• Instructions: here, you find the instructions.

• Exercise *: here, you have to enter your answers to the corresponding exercise and
download a file that contains these answers.

Codegrade
On Codegrade, integrated into the Canvas assignment, you have to hand-in:

• The four answer files generated on the web page mentioned above

• A zip-file containing your code

Additional instructions for your code


• Your code should be valid Aimms 4.95 code.

• Make sure to save each of your data cases and to use a separate project for each exercise.

• When uploading your Aimms code files, upload a zip-file containing 4 project folders.

1 c 2023 Erasmus University Rotterdam


Combinatorial Optimisation Computer Assignment 1

Codegrade scores
• Grading will only start after the deadline has finished.

• The obtained grades will become available in Canvas after grading has been finished.

Plagiarism and cheating


• You are not allowed to share code or solutions except with your group member, but are
allowed to discuss the assignment and related theory with fellow students.

• Any attempt to mislead or alter the automated submission and grading system or to
prevent correct grading will be considered as cheating.

• Cheating/plagiarism is not tolerated and will be reported to the Examination Board.

Contact in case of issues


• For issues regarding the webpage that is used for this assignment, Codegrade or errors in
the assignment contact [email protected] as soon as possible. This includes issues
with the hand-in, missing the deadline, and (suspected) incorrect grading.

• If you have questions about the received grade contact our PhD student Pedro (correiad-
[email protected]) before Thursday, October 8 at 23:59.

• Other questions should be asked to the lecturer or your teaching assistant, as usual.

2 c 2023 Erasmus University Rotterdam


Combinatorial Optimisation Computer Assignment 1

Exercise 1 Set covering problem


Consider the set covering problem (for more details we refer to pages 17–19 of the slides on
Formulations). The problem can be formulated as
n
X
min cj xj
j=1
Xn
s.t. aij xj ≥ 1 ∀ i ∈ {1, . . . , m},
j=1

xj ∈ B ∀ j ∈ {1, . . . , n}.

In the file CO2023qst1.xls you will find two set covering instances: ‘small’ and ‘large’.
a. Implement the model in Aimms.
b. Solve the small set covering instance. For the IP, report (i) the optimal objective value
and (ii) the optimal solution (in the corresponding fields of the web form).
c. Solve the large set covering instance. For the IP, report (i) the optimal objective value,
(ii) the optimal solution, (iii) the total running time, and (iv) the number of nodes needed
to solve the IP problem.
d. Solve the LP relaxation of the large problem instance. (Hint: Defining the Type as RMIP
in an Aimms Mathematical Program solves the LP relaxation of a MIP.) Report (i) the
optimal objective value, (ii) the optimal solution, and (iii) the total running time.
e. What is the value/use of solving the LP relaxation of the set covering problem? How
can the difference between the running time of solving the IP and LP relaxation be
explained?

3 c 2023 Erasmus University Rotterdam


Combinatorial Optimisation Computer Assignment 1

Exercise 2 Fixed charge transportation problem


Consider the following fixed charge transportation problem. There is a set M = {1, . . . , m} of
depots and a set N = {1, . . . , n} of clients. EachPdepot i ∈ M
P has a supply si ∈ R≥0 and each
client j ∈ N has a demand dj ∈ R≥0 such that i∈M si = j∈N dj . If client j is supplied by
depot i, then there is a fixed transportation cost fij ∈ R≥0 . The aim is to find a transportation
schedule such that the total cost is minimised.
If we use the variables xij ∈ R≥0 to represent the amount transported from depot i to
client j and
(
1 if demand of client j is (partly) satisfied by depot i
yij = ,
0 otherwise

then the problem can be formulated as the mixed integer programming (MIP) problem
XX
min fij yij
i∈M j∈N
X
s.t. xij ≤ si ∀ i ∈ M,
j∈N
X
xij ≥ dj ∀j ∈ N,
i∈M
xij ≤ min{si , dj }yij ∀ i ∈ M, j ∈ N ,
xij ≥ 0 ∀ i ∈ M, j ∈ N ,
yij ∈ B ∀ i ∈ M, j ∈ N .

In the file CO2023qst2.xls, you can find three problem instances. We let fij = 1 for all i ∈ M
and j ∈ N in each instance.
a. Implement the model in Aimms.
b. Solve the MIP and the LP relaxation of the first problem instance with m = n = 6.
For the MIP, report (i) the optimal objective value, (ii) the optimal solution, (iii) the
total running time, and (iv) the number of nodes needed to solve the MIP. For the LP
relaxation, report (i) the optimal objective value, (ii) the optimal solution, and (iii) the
running time needed to solve the LP relaxation.
c. Solve the MIP and LP relaxation of the second problem instance with m = n = 7. For
the MIP, report (i) the optimal objective value and (ii) the optimal solution. For the LP
relaxation, report (i) the optimal objective value and (ii) the optimal solution. What
happens to the running time and the number of nodes needed to solve the MIP and LP
relaxation compared to the first problem instance, which only had 1 depot and 1 client
less? Explain the differences in running times.
d. Solve the MIP and LP relaxation of the third problem instance with m = n = 8. If
needed, interrupt the Aimms program after 5 minutes solving time. This can be achieved
by using the command
solve <YOUR MATHEMATICAL PROGRAM NAME> where time_limit := 300;
in the MainExecution, i.e., add ‘where time_limit := 300’. For the MIP, report (i)
the best found lower bound and (ii) the best found upper bound. For the LP relaxation,
report (i) the optimal objective value and (ii) the optimal solution. What happens to
the running time and the number of nodes needed to solve the MIP and LP relaxation
compared to the first two instances?

4 c 2023 Erasmus University Rotterdam


Combinatorial Optimisation Computer Assignment 1

Exercise 3 Uncapacitated facility location problem


Consider an instance of the uncapacitated facility location (UFL) problem with m = 200 mar-
kets, n = 200 facilities, fixed cost equal to fj = 10 for j ∈ {1, . . . , n} and transportation cost as
in the file CO2023qst3.xls.
a. Implement the model and solve the problem instance in Aimms by using the following
formulation:
m X
X n n
X
min cij xij + fj yj
i=1 j=1 j=1
n
X
s.t. xij = 1 ∀ i ∈ {1, . . . , m},
j=1
Xm
xij ≤ myj ∀ j ∈ {1, . . . , n},
i=1
xij ≥ 0 ∀ i ∈ {1, . . . , m}, j ∈ {1, . . . , n},
yj ∈ B ∀ j ∈ {1, . . . , n}.

For the MIP, report (i) the optimal objective value, (ii) the optimal solution, (iii) the
total running time, and (iv) the number of nodes needed to solve the MIP. For the LP
relaxation, report (i) the optimal objective value, (ii) the optimal solution, and (iii) the
running time needed to solve the LP relaxation.
b. Implement the model and solve the problem instance in Aimms by using the following
formulation:
m X
X n n
X
min cij xij + fj yj
i=1 j=1 j=1
Xn
s.t. xij = 1 ∀ i ∈ {1, . . . , m},
j=1

xij ≤ yj ∀ i ∈ {1, . . . , m}, j ∈ {1, . . . , n},


xij ≥ 0 ∀ i ∈ {1, . . . , m}, j ∈ {1, . . . , n},
yj ∈ B ∀ j ∈ {1, . . . , n}.

For the MIP, report (i) the optimal objective value, (ii) the optimal solution, (iii) the
total running time, and (iv) the number of nodes needed to solve the MIP. For the LP
relaxation, report (i) the optimal objective value, (ii) the optimal solution, and (iii) the
running time needed to solve the LP relaxation.
Hint: In Aimms, you can define a collection of constraints, say MyConstraints, as
follows:
• create a new Set with the name MyConstraints,
• in the Subset of field select AllConstraints,
• in the Definition field, you can write data{MyConstraint1,MyConstraint2}.
If you define the field Constraints in an Aimms Mathematical Program as MyConstraints,
it will only use the subset of constraints in your set MyConstraints.
c. Compare the results of parts a and b and explain the observed difference.

5 c 2023 Erasmus University Rotterdam


Combinatorial Optimisation Computer Assignment 1

Exercise 4 Linear assignment problem


Consider the linear assignment problem (LAP) where we need to assign n tasks to n people. A
formulation of the LAP is as follows:
n X
X n
min cij xij
i=1 j=1
n
X
s.t. xij = 1 ∀ i ∈ {1, . . . , n},
j=1
Xn
xij = 1 ∀ j ∈ {1, . . . , n},
i=1
xij ∈ B ∀ i, j ∈ {1, . . . , n}.

Solve a LAP with 6 people and 6 jobs where the cost of performing job j by person i is given
by the matrix
 
n1 8 14 4 13 10
 7 n2 8 8 4 10 
 
 5 7 n3 6 6 10 
[cij ] = 
 6 12
,
 14 n4 7 10 
 4 13 13 12 n5 10 
3 8 6 4 5 n6

where ni (i = 1, . . . , 6) is the ith digit of your student number (in case of 2 students, use the
smallest number). The cost parameters can also be found in the file CO2023qst4.xls (N.B. do
not forget to insert your student number!). For the IP, report (i) the optimal objective value,
(ii) the optimal solution, and (iii) the number of nodes needed to solve the IP. Explain why you
observe this particular number of nodes.

6 c 2023 Erasmus University Rotterdam


Combinatorial Optimisation Computer Assignment 1

Optional (do not hand in!): Solving some puzzles as an IP problem

Exercise 5 Corona seat selection


Again consider Exercise 8 from Set 1, where we need to select as many locations such that any
two locations are not within Euclidian distance D from each other. Determine the number of
seats satisfying this property for

• room CB-3 with 8 rows, 15 seats per row, a seat width of 0.60m and a distance 0.98m
between rows,

• room Sanders 0.04 with 15 rows, 15 seats per row, a seat width of 0.60m and a distance
0.9m between rows,

when the distance D is chosen as 1.5m or 1.75m.

Exercise 6 Sudoku puzzle


a. Formulate a Sudoku puzzle as an IP problem, implement it in Aimms, and solve the
Sudoku puzzle below.
1
4
2
5 4 7
8 3
1 9
3 4 2
5 1
8 6

b. Suppose you have found a solution. Which constraint can you add to check whether the
solution is unique?

Exercise 7 Eight queens problem


Can we place 8 queens on an 8 × 8 chessboard such that no two queens attack each other?
Formulate this problem as an IP and solve it.
(Note: two queens attack each other if they are in the same row or column, or on the same
diagonal.)

7 c 2023 Erasmus University Rotterdam

You might also like