VM2C Final Round
VM2C Final Round
OPTIMIZING THE
WORKING SCHEDULE FOR
FACTORY WORKERS
Based on the data from the statement and from the In-
ternet, we constructed a mathematical model for the staff
scheduling problem for a dairy factory.
We first made some assumptions about the working
condition. Then, we constructed the decision variables,
the constraints, and the objective function of the model.
From that, we created an implementation, and use it to
construct various working schedules for each dataset and
other factors.
Next, we analyzed the outputted plans along with the
model itself. Finally, we decided on the most effective
strategy for each dataset.
Team 45208, Page 2/17
Contents
1 Introduction 3
2 Assumptions 4
3 Mathematical model 5
3.1 Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.2 Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.3 Dissatisfaction . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.4 Fairness . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.5 Objective function . . . . . . . . . . . . . . . . . . . . . . . . 7
3.5.1 Subtask A . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.5.2 Subtask B . . . . . . . . . . . . . . . . . . . . . . . . . 7
6 Conclusion 16
Team 45208, Page 3/17
1 Introduction
The staff scheduling problem is one encountered by many, if not all manufac-
turing companies. To function properly, factories must plan each employee’s
schedule in such a way that satisfies various constraints while minimizing
resources and risks. With current technologies, this type of problem can be
modeled mathematically and automated.
The number of constraints in a staff scheduling problem, in some cases,
can become very complicated, and even seemingly contradictory. Local laws
and regulations, for example, introduce constraints on the maximum number
of working hours per month, the minimum salary and wage, etc. Other
constraints include each worker’s skillset, which limits positions that they can
work on, or their previous shifts, since contracts may prohibit schedules that
assign multiple shifts in a short amount of time. Without a mathematical
model, these schedules must be constructed manually, and most of the time,
simplified with methods such as grouping employees, introducing unnecessary
redundancy.
The optimization target is also a matter of major concern. While it may
seem trivial that generated profit is the sole target, sacrificing other factors
may produce detrimental effects. For example, generating an unfair schedule
(which still satisfies all hard constraints but assigns work unevenly) can result
in a strike, introducing further profit loss. A mathematical model can take
into consideration these risk factors to optimize expected profit.
Furthermore, modeling a factory’s work schedule also gives various in-
sights into the factory’s overall structure. With these insights, it is possible
to generate lay-off plans while still guaranteeing all constraints.
In this paper, we discuss methods to mathematically model the staff
scheduling problem for a dairy factory.
Team 45208, Page 4/17
2 Assumptions
In reality, there are various uncontrollable factors, including both technical
issues and human resources issues. To avoid overcomplication, we make the
following assumptions:
3 Mathematical model
We redefine the schedule to have 28 × 3 = 84 shifts, numbered from 0 → 83.
The shifts with index ≡ 2 mod 3 are night shifts.
3.1 Variables
We have the following variables:
X = {xijkl }: let xijkl be a binary variable denoting that worker i work in
shift j in pipeline k and performing job l or not.
A = {aikl }: let aikl be a binary variable denoting that worker i is capable
of doing job l in pipeline k or not.
R = {rkl }: let rkl be the number of workers that are needed for job l in
pipeline k to perform normally.
T = {tjk }: let tjk be the number of demanded hours in shift j for pipeline
k.
(We decomposed the demand periods into smaller ones so that each small
period lies completely inside a shift [1] )
3.2 Constraints
1. Every person only does the jobs they are capable of:
xijkl ≤ aikl
2. After performing the night shift, workers are not allowed to work the
morning shift of the next day:
X
(xijkl + xi(j+1)kl ) ≤ 1
j≡2 mod 3,k,l
3.3 Dissatisfaction
We have a formula for calculating the value of dissatisfaction:
Uj is the dissatisfaction coefficient for the worker working in shift j in an
hour.
We have the following table for the coefficients:
3.4 Fairness
We have a formula for calculating the fairness for workers [2] :
Let Si be the sum of dissatisfaction for worker i.
X
Si = Uj ∗ tjk ∗ xijkl
j,k,l
F = max S − min S
∆ = max |Si − S|
Team 45208, Page 7/17
Since optimizing the number of workers in each shift is the top priority,
we give a very large weight to it in the objective function. Furthermore, the
objective function also has to take into account the fairness between workers.
Thus, we suggest the following objective function:
OP = cn ∗ N + cf ∗ F
In which:
• OP is the objective value of the model. The smaller OP is, the more
optimized the solution is.
• F is the fairness of the model. The smaller F is, the more balanced
the model is.
3.5.2 Subtask B
Subtask B requires us to minimize the total cost. We believe the formula for
total cost should contain a constant salary for each worker, along with an
hourly wage for every working hour:
XX X
OP = Cs ∗ [ xijkl ≥ 1] + Ch ∗ xijkl
i
In which:
• OP is the objective value of the model. The smaller OP is, the more
optimized the solution is.
Team 45208, Page 8/17
4.1 Subtask A
We discuss 2 different algorithms in order to minimize the objective function.
As the two different optimization targets in subtask A are not directly related,
our algorithms try to impose additional constraints and introduce additional
variables, in order to transform a non-linear model into a linear model so
that it can be solved efficiently.
Inside Paper PartA, results with maindelta is for algorithm 1, and main
is for algorithm 2.
4.1.1 Algorithm 1
P
S = 3595.75, and the total cost is 48, 400, 000 VND.
Overall, it can be seen that max S −min S decreases as the horizon length
is increased. We believe that this is because the more time slots the model
gets to schedule, the easier it is to balance employees’ dissatisfaction.
However, quite unintuitively, the value of ∆ does not correlate with the
horizon length. As the running time of the model increases dramatically as
the horizon length increases, we were not able to perform more tests. We
believe that these two variables will correlate negatively with a larger sample
size. Note that in this model, we only use ∆ as a means of approximating
max S − min S.
For the second dataset, due to limitations in our computing power, we
only ran this model once.
P
Similarly, for the second dataset, the constants are S = 111.869, S =
6152.8, and the total cost is 114, 400, 000 VND.
4.1.2 Algorithm 2
For this model, we were able to run 2 times on the second dataset. Below
is the data:
P
Once again, constants for the second dataset are S = 111.869, S =
6152.8 and the total cost is 114, 400, 000 VND.
Regarding the running time, let ∆′ be the target value for ∆, we perform
O(log ∆∆′ ) iterations to optimize ∆. In reality, this translates to approxi-
mately 3 − 10 model optimization calls. However, due to the structure of
this model, the running time is significantly better.
In conclusion, compared to the first algorithm, this second algorithm
yields better result, since ∆ is optimized using heuristics, rather than using
Team 45208, Page 12/17
integer programming directly. Overall, this model performs better than the
first model in both results and running time.
4.2 Subtask B
We create a single integer programming (IP) algorithm, which takes X as
decision variables and minimizes the objective function.
4.2.1 Dataset 1
First, we run the program with the default horizon (1 day ahead), and we
have our result in result data 1 part b 1 days . txt.
We can see that in each shift, there are 1 + 2 + 2 = 5 people that are
needed for the factory to function properly. Moreover, there are 3 shifts each
day (for instance, day 1 demands all 3 shifts), and each person can only work
in 1 shift every day. Thus, we need at least 15 different people.
The program has given a plan which utilizes exactly 15 people, and each
shift has reached the minimal number of workers allowed. For that reason,
the program has found an optimal solution, while only knowing the schedule
for the next day.
In order to verify that, we ran the program where we know the entire
schedule beforehand (setting the horizon to 28 days), and the result is stored
in result data 1 part b 28 days . txt. As expected, although the program
output a different plan, the total cost remained the same, which is 45, 200, 000
VND.
4.2.2 Dataset 2
Similarly, we ran the program with different horizon factors (1 and 28 days
respectively), and the results are stored in result data 2 part b 1 days . txt
and result data 2 part b 28 days . txt.
The program did output a valid solution if it knows the entire schedule,
but it fails to do so when only the schedule for 1 day is given. Only when
we run the model for a 3-day horizon did the model give a valid plan in
result data 2 part b 3 days . txt.
Team 45208, Page 13/17
We also come to the same conclusion as for the first dataset: The plan for
3-day horizon and 28-day horizon have the same optimal total cost, which is
108, 000, 000 VND.
Team 45208, Page 14/17
5.2 Subtask B
While we were running the program for dataset 2, we recognize the following
problem:
If the constant salary is greater than 0, the program will try to reuse the
workers that have been hired before. However, each worker can only work
for 24 days, which means that after this, they cannot accept any more shifts.
Then, the program will have to hire new workers. However, the remaining
workers are not enough, since every worker can only work only 1 shift every
day.
So, there are 2 possible solutions to this issue:
• Reducing the constant salary to 0: This will help the program
avoid reusing those workers, avoiding the above problem.
5.3 Overall
The given model utilized hard constraints, such as ”every person can only
work in 24 days”, or ”a shift has to be performed even if only a single hour
Team 45208, Page 15/17
6 Conclusion
For subtask A, our model has successfully created a plan to minimize the
fairness with horizon 1. With the larger horizon, our model spent a lot of
time calculating the result.
For subtask B, dataset 1, our model has successfully created a plan to
minimize the total cost with any planning horizon. However, for dataset 2,
our model was unable to find a way to calculate the cost with horizon 1
because of the characteristics of the model.
Team 45208, Page 17/17
References
[1] B. Jaumard, F. Semet, and T. Vovor, “A generalized linear programming
model for nurse scheduling,” European Journal of Operational Research,
pp. 1–18, 1998.