CompAss1 - 2023
CompAss1 - 2023
Computer Assignment 1
• 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.
• 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
• 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.
Codegrade scores
• Grading will only start after the deadline has finished.
• The obtained grades will become available in Canvas after grading has been finished.
• Any attempt to mislead or alter the automated submission and grading system or to
prevent correct grading will be considered as cheating.
• 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.
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?
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?
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
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.
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.
• 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,
b. Suppose you have found a solution. Which constraint can you add to check whether the
solution is unique?