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

Logistics Report

Uploaded by

leanhtuanln199
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)
16 views7 pages

Logistics Report

Uploaded by

leanhtuanln199
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

Università di Pisa

Department of INFORMATICA
Master of Data Science and Business Informatics

Submitted by:
Elisa Pashku (628389)
Gloria Segurini (567352)
Luca Palla (533605)
Matteo Garro (620025)

Academic Year 2020/2021


Exercise (part one)
A manager needs to assign a set of 6 tasks to 3 workers. Each task has a duration, and the
manager wants to assign the tasks to the workers in such a way that the workload is as
balanced as possible among the workers, i.e. by minimizing the maximum workload of
the 3 workers.
The tasks have the following estimated durations in hours:
p​1​ = 5, p​2​ = 6, p​3​ = 9, p​4​ = 7, p​5​ = 3, p​6​ = 2.

● 1.​ Formulate the problem in terms of ILP.


● 2. Implement the proposed ILP model by means of the modeling language
AMPL, and solve it using the optimization solver CPLEX.

We first defined the following variables:


​ {1,2,3,4,5,6};
• I = set of tasks, indexed by ​i, i=
• J= set of workers, indexed by ​j, j​={1,2,3};

• Duration ​i​: duration of the task ​ ​i​ ​∈ I ;


•​ ​MaxWork ≥ 0, which indicates the maximum total duration assigned to each worker;
​We defined the decision variable as follows:

Using these variables, the problem can be stated as:

min M axW ork


x 11 ​+ x12 ​ ​+ x13​ =1​
​ ​+ x​23​=1
x 21 ​+ x22
​ ​+ x​33​=1
x 31 ​+ x32 allocation constraints​: every task must be
x 41 ​+ x42 ​ ​+ x43​ =1 ​ assigned exactly​ ​to one worker
x 51 ​+ x52​ ​+ x​53​=1
x 61 ​+ x62 ​ ​+ x63​ =1 ​
​ ​+ x​31​+ x​41+
x 11 ​+ x21 ​ ​+ x​61 ≥
​ x51 ​ 1 linking constraints:​ at least one task must be
​ x​22+
x 12+ ​ +
​ x32 ​ +
​ x42 ​ x​52+ ​ x​62 ≥ ​ 1 assigned to every worker
​ ​+ x33
x 13 ​+ x23 ​ +​ x​43+ ​ ​+ x​63 ≥
​ x53 ​ 1

5x 11 ​+ 6 x​21​+ 9 x31
​ ​+ 7 x41
​ + ​ 3x​51​+ 2x​61​ ≤ MaxWork
​ 6 x​22+
5x 12+ ​ 9x32​ ​+ 7x​42 ​+ 3x52​ ​+ 2x62
​ ​≤ MaxWork
5x 13 ​+ 6 x​23​+ 9x​33 ​+ 7x43
​ +​ 3x ​
53​+ 2x ​63 ​≤ MaxWork

x​11​, x​12​, x13


​ ,​ … , x​63​ ∀ i ∈ I , j ∈ J

Our objective was to minimize the maximum workload (sum of durations) for every
worker.
The result we obtained with CPLEX was the following:
CPLEX 12.10.0.0: optimal integer solution; objective 11
7 MIP simplex iterations
0 branch-and-bound nodes
ampl: display assignedTasks;
assignedTasks :=
11 1
12 0
13 0
21 1
22 0
23 0
31 0
32 0
33 1
41 0
42 1
43 0
51 0
52 1
53 0
61 0
62 0
63 1;
The ​table 1 s​ ummarizes the results given by the model.

Worker Task assigned Workload

1 1, 2 11

2 4, 5 10

3 3, 6 11
Objective Function:​ 11
Table 1. Results of the optimization problem.

Exercise (part two)

● 3. Consider the case in which the assignment of each task costs 10 dollars,
independently of the worker, but the manager needs to pay 150 dollars in
case worker 1 works more than 9 hours. Formulate in terms of ILP the
problem of assigning the 6 tasks to the 3 workers in such a way to minimize
the total cost.
● 4. Implement the ILP model proposed in point 3 by means of the modeling
language AMPL, and solve it using the optimization solver CPLEX.
Compare the optimal solution found with the one determined at point 2.

In the second part we added a binary variable ​Exceed​ in order to construct the following
constraints:

5x​11​+ 6x​21​+ 9x​31​+7x​41​+ 3x51


​ +
​ 2x​61 ​≤ 9 + 100*Exceed

This means that, by setting Exceed equal to 1 or 0, the solver decides whether to assign to
worker 1 a total workload ≥ 9​: the variable Exceed turns equal to 1 if a total workload
greater than 9 is assigned to Worker1.
The number 100 represents the Big M.
This is related to the new objective function:
Min 10(x​11​+x​21​+x​31​+x​41​+x​51​+x​61​+x​12​+x​22​+x​32​+x​42​+x​52​+x​62+x
​ ​13+x
​ ​ ​+x33
23 ​ +x
​ ​ +x
43​ ​53+x
​ ​63​)
+150*Exceed

By setting this new objective function, we impose that the manager must pay 10 for every
assignment task-worker and an added value of 150 if the total workload for Worker 1 is
greater than 9.

In the end, the second model is described as follows:


Min​ 10(x​11​+x​21​+x​31​+x​41​+x​51​+x​61​+x​12​+x​22​+x​32​+x​42​+x​52​+x​62​+x​13+x
​ ​23​+x33
​ ​+x43
​ +x
​ ​53+x
​ ​63)​
+150*Exceed

x 11 ​+ x12​ ​+ x​13=1 ​
​ ​+ x​23=1
x 21 ​+ x22 ​
x 31 ​+ x32 ​ ​+ x​33=1 ​ allocation constraints​: every task must be
x 41 ​+ x42 ​ ​+ x​43=1 ​ assigned exactly​ ​to one worker
​ ​+ x​53=1
x 51 ​+ x52 ​
x 61 ​+ x62 ​ ​+ x​63=1 ​

​ ​+ x​31+
x 11 ​+ x21 ​ x​41​+ x51 ​ ​+ x​61 ≥ ​ 1 linking constraints:​ at least one task must be
​ x​22+
x 12+ ​ x​32​+ x​42​+ x​52+ ​ x​62 ≥ ​ 1 assigned to every worker
​ ​+ x​33+
x 13 ​+ x23 ​ x ​ 43​+ x ​
53​ + x​ 63 ​ 1

x​11​, x​12​, x​13​, … , x63


​ ​ ∀ i ∈ I, j ∈ J

5x​11​+ 6x​21​+ 9x​31​+7x​41​+ 3x51


​ +
​ 2x​61 ​≤ 9 + 100*Exceed

The result we obtained with CPLEX was the following:

CPLEX 20.1.0.0: Version identifier: 20.1.0.0 | 2020-11-11 | 9bedb6d68


Version identifier: 20.1.0.0 | 2020-11-11 | 9bedb6d68
optimal integer solution; objective 60
1 MIP simplex iterations
0 branch-and-bound nodes
ampl: display assignedTasks;
assignedTasks :=
11 0
12 1
13 0
21 0
22 0
23 1
31 0
32 0
33 1
41 0
42 0
43 1
51 1
52 0
53 0
61 0
62 0
6 3 1;

The ​table 2 s​ ummarizes the results given by the model.

Worker Task assigned Workload

1 5 3

2 1 5

3 2, 3, 4, 6 24

Objective Function:​ 60
Table 2. Results of the optimization problem.
Comparing the two models, it is possible to see that in the first model the objective
function aims to equally distribute the total workload of 32 hours between the 3 workers
whereas, in the second part of the problem, the new objective function disregards the
workload shared among the workers in order to minimize the total cost of the operation.
As a matter of fact the optimal value returned by this function is equal to 60 as shown
above.

You might also like