HANOI PEDAGOGICAL UNIVERSITY 2 DEPARTMENT OF MATHEMATICS——————–o0o——————— Nguyen Thanh Nga Scheduling a single machine with precedence constraints BACHELOR THESIS Major: Applied Mathemat
Trang 1HANOI PEDAGOGICAL UNIVERSITY 2 DEPARTMENT OF MATHEMATICS
——————–o0o———————
Nguyen Thanh Nga
Scheduling a single machine with precedence constraints
BACHELOR THESIS
Major: Applied Mathematics
Trang 2HANOI PEDAGOGICAL UNIVERSITY 2 DEPARTMENT OF MATHEMATICS
——————–o0o———————
Nguyen Thanh Nga
Scheduling a single machine with precedence constraints
BACHELOR THESIS Major: Applied Mathematics
Advisor:
Dr Le Xuan Thanh
Trang 3I hereby confirm that this thesis is my original work completedunder the guidance of Dr Le Xuan Thanh The presented results areaccurate and correctly cited
Author
Trang 4In particular, I would like to express my deep respect and gratitude
to Dr Le Xuan Thanh (Institute of Mathematics, Vietnam Academy
of Science and Technology) who has direct guidance and helps me
to complete this thesis Professionalism, seriousness and his rightorientations are important prerequisites for me to get the results inthis thesis
Due to limited time, capacity, and conditions, my thesis cannotavoid errors I look forward to receiving valuable comments fromreaders
Author
Trang 51.1 Thesis topic 6
1.2 Research methods 8
1.3 Results of the thesis 8
1.4 Structure of the thesis 8
2 Preliminaries 10 2.1 Some basic scheduling concepts 10
2.2 Mixed integer linear programming 12
3 Problem description and MIP formulations 14 3.1 Problem description 14
3.2 First formulation 16
3.3 Second formulation 18
3.4 Third formulation 20
3.5 Fourth formulation 21
4 Experiments 25 4.1 ZIMPL codes 25
4.2 Numerical results 30
Trang 6Chapter 1
Introduction
1.1 Thesis topic
According to wikipedia, a schedule or a timetable, as a basic time
management tool, consists of a list of times at which possible tasks,events, or actions are intended to take place, or of a sequence of events
in chronological order in which such things are intended to take place.The process of creating a schedule - deciding how to order these tasksand how to commit resources between the variety of possible tasks -
is called scheduling.
Having good schedules makes our life more comfortable and organized In social services, industrial manufacturing, transporta-tion, etc., a good schedule results in higher productive and more com-petitive outcomes How to construct good schedules for real-life as well
well-as industrial activities is the main goal of scheduling problems Thus,one can say that scheduling problems arise naturally from practice andplay a vital role in operating systems In the past few decades, thepractical importance and complexity of the general scheduling prob-lems have motivated a significant volume of research in a wide variety
of scheduling environments
In (project) scheduling problems, a set of jobs (so-called activities,tasks) has to be processed on a set of machines in a given time hori-zon using limited resources (machines, processors, or staffs) Some
Trang 7between the jobs) might be imposed in the problems Often there are
a finite (but usually very huge) set of possibilities for a feasible ule However, usually one has to optimize certain objective function.This means that we have to look for a best solution among a tremen-dous number of feasible solutions Furthermore, practical instances
sched-of scheduling problems might have very large size (up to hundreds
or even millions jobs and machines) That is the motivation for demic researchers to develop algorithms capable of solving large-sizescheduling problems in acceptable time
aca-The performance of the algorithms depends very much on the sign of the algorithms themselves and data structures For the sameproblems, there might be many solution approaches with differentlevels of efficiency Such a common approach is to use mixed integerprogramming (MIP) in modeling the problems This approach has
de-a two-fold de-advde-antde-age On one hde-and, it mde-akes use of de-avde-ailde-able MIPsolvers, since in the recent years the solvers became much more effi-cient On the other hand, it is easy to implement the models and thensolve the problems on computers
In this thesis, we would like to highlight the fact that there mighthave different MIP formulations for representing a scheduling prob-lem, and having a good formulation is crucial in solving numericalinstances of such problem For that we focus on studying the schedul-ing problem on a single machine with precedence constraints betweenthe jobs and minimizing the total flow time More precisely, we con-sider the situation in which one has to schedule a set of jobs on a singlemachine Each job has its processing time and is processed withoutpreemption Between the jobs there may be arbitrary precedence con-straints that impose which jobs have to be completed before startinganother job The objective is to find a schedule that minimizes thetotal flow time, i.e the total value of completion times of all jobs.The scheduling problem studied in this thesis is one of the mostbasic scheduling problems For a comprehensive study on schedulingproblems, we refer to [2] It is also shown in [2] that the problemunder our consideration is NP-hard, therefore MIP-based approaches
Trang 8like to highlight “In integer programming, formulating a good model
is of crucial importance to solving the model” has already quoted in[4]
1.2 Research methods
We use MIP-based approaches for solving our studied schedulingproblem due to the mentioned advantages of the methods That is, weformulate the problem as different mixed integer programming formu-lations We will also test the obtained models on different instancesthat are randomly generated, with the help of some modeling languageand integer programming solver
1.3 Results of the thesis
We describe the scheduling problem on a single machine withprecedence constraints between the jobs, no job preemption, and mini-mizing the total flow time We present four different MIP formulationsfor the problem Based on experimental results on some tested in-stances, we find out the best performance formulation for numericallysolving the scheduling problem
1.4 Structure of the thesis
Apart from this chapter, the thesis consists of four more chapters
• Chapter 2: Preliminaries In this chapter we present some
pre-liminaries on the scheduling problem of our consideration and ashort introduction to mixed integer programming
• Chapter 3: Problem description and MIP formulations This
chapter first describes the scheduling problem studied in thisthesis, and then presents several MIP formulations for the prob-
Trang 9• Chapter 4: Experiments This chapter describes how do we
generate tested instances for numerical experimenting the mulations mentioned in Chapter 3 Then we present how toimplement the formulations on computers After that, we ana-lyze the performance of the formulations based on our obtainednumerical results
for-• Chapter 5: Conclusions We close the thesis by some
conclu-sions
Trang 10Chapter 2
Preliminaries
In this chapter, we introduce some basic concepts related to ourconsidered scheduling problem Then we present a short introduction
to mixed integer programs
2.1 Some basic scheduling concepts
Resources for a scheduling problem include jobs and machines
Here jobs mean any activities, tasks, or works that should be done and completed for some specific purposes Machines can be persons
who are responsible for doing the jobs, tools for processing the jobs,
or spaces in which the jobs are done For example, a student needs
to review some subjects before the final exam of a semester In thiscontext, the student can be considered as a machine, and reviewingeach subject can be thought as a job
In general scheduling problems, we are given n jobs j = 1, , n which have to be processed on m machines M k (k = 1, , m) Often
we assume that each machine can process at most one job at any time,and each job cannot be processed on more than one machine simul-taneously In some models a job can be interrupted when processing
on a machine and resumed later either on the same machine or onanother one In such contexts we say that the jobs can be preempted,
or equivalently, job preemption is allowed However, in this thesis we
Trang 11consider a scheduling problem on a single machine (i.e m = 1) with
no job preemption (i.e., once a job is started, it must continue until
its completion on the machine)
Associated data for a job j may include:
• processing time p j which is the amount of time units needed tocomplete the job,
• release date r j which is the point of time before that the jobcannot start,
• deadline ˜d j which is the point of time before that the job must
be finished,
• due date d j which is the point of time before that the job should
be completed
Between jobs there may be precedence constraints imposing which
jobs must be finished before doing certain jobs The notation i → j
means that the job i must be completed before the job j can be started.
To visualize precedence constraints one often use an acyclic directedgraph in which the nodes represent the jobs and the arcs represent theprecedence relations
Example 1 The graph in Figure 2.1 visualize an instance of
job 1 must be completed before the starting time of job 3, and similar
Trang 12A schedule on single machine without job preemption can be
com-pletely described by the starting times S j of all jobs j, or equivalently their completion times C j = S j + p j Such schedules are often visual-ized by Gantt charts
Example 2 Figure 2.2 shows a feasible schedule for a problem
processing order of the jobs is 1, 3, 2, 4, the completion times of the
C4 = p1 + p3 + p2 + p4 = 11.
Figure 2.2: Gantt chart of a schedule
Usually a schedule is made in order to achieve some optimality
criterion The most common objective is to minimize the makespan
C max = max{C j , j = 1, , n } The makespan let us know the latest
point of time that all jobs are finished Another common objective is
to minimize the total flow time∑n
i=1 (C j −r j), or equivalently, ∑n
i=1 C j,
since the values of parameters r j are given constants The flow time of
a job j is the total time it spends in the system and equals C j −r j, i.e.the difference between its completion time and release time Thereforethe total flow time let us know how long all the jobs spent in thesystem In this thesis, we focus on studying the objective of minimizethe total flow time
2.2 Mixed integer linear programming
Many scheduling problems can be formulated as integer linear grams A linear program (abbreviated by LP) is a system of the form
Trang 13where a ij , c j , b i ∈ R are parameters with given values, and x j are
de-cision variables whose values are needed to be decided Here, n is the number of variables and m is the number of constraints An LP
of the form (2.1) − (2.3) with the additional restriction x j ∈ Z (i.e.,
all variables are required to have integer values) is called an integer
linear program (abbreviated by ILP or shortly IP) A mixed teger linear program (abbreviated by MIP) contains both integer
in-and continuous variables
The sum in (2.1) is called objective function whose value is needed
to be optimized, while the system (2.2) and (2.3) are called constraints Any value of decision vector x which satisfies the constraints is called
a feasible solution A feasible solution x ∗ which attains the minimum
value of objective function (2.1) is called an optimal solution.
Having an instance of MIPs, we can implement it on computers byusing some mathematical modeling language Our choice of modelingtool is ZIMPL [3] To numerically solve the instance, one can usevarious available MIP solvers Our choice of solvers is SCIP [1] which
is known as the best non-commercial solver for solving MIPs
Trang 14Chapter 3
Problem description
and MIP formulations
In this chapter, we first formally describe the problem of our sideration, then present four different (M-)IP formulations for thisproblem
con-3.1 Problem description
We consider the scheduling problem with the following features
• We are given n jobs j = 1, , n that have to be processed on a
single machine
• For each job j its processing time p j ∈ Z+is known exactly (that
means, job j needs p j > 0 time units to process on the machine).
• Every job j has realease date r j = 0, i.e., all the jobs can start
from beginning of the time horizon t = 0.
• No due date or deadline is given for the jobs, i.e., each job can
be completed whenever we want
• Job preemption is not allowed, i.e., once each job starts, it must
Trang 15• Between the jobs there may be arbitrary precedence constraintsthat define which job must be completed before the start ofanother job.
• The objective is to minimize the total flow time of all jobs.Following the 3-field notation proposed in [2], this problem can beshortly denoted by
Here the number 1 in the first field means that there is a single
ma-chine The second field consists of the keyword prec which means that
there are precedence constraints between jobs The last field consists
of the objective function of total flow time which needs to be mized
mini-Example 3 Consider an instance of the scheduling problem with n =
5 jobs of processing times p1 = 5, p2 = 3, p3 = 7, p4 = 4, p5 = 5 and
schedules (a) and (b) are shown in the left part of Figure 3.1 We can process job 3 before job 2 or vice versa without violating the given precedence constraints However, the schedule (c) in the right part of Figure 3.1 is not feasible since it violates the precedence constraint
schedules For schedule (a) its total flow time is 5+8+15+19+24 = 71 For schedule (b) its total flow time is 5 + 12 + 15 + 19 + 24 = 75.
Trang 161 3 2 4 5
5 15 19 24
t
3 7 12 17 0
Since a schedule on a single machine without job preemption can
be completely described by the completion times C j of all jobs j, in this formulation we use C j with j = 1, , n as variables Using these
variables, it is easy to see that the total flow time is ∑n
j=1 C j, andtherefore the objective function is
Since all jobs start after the time origin 0 and each job j processes in
p j time units, we must have
For each job precedence relation i → j, since job j starts after the
completion time C i of job i and processes in p j time units, we musthave the following constraint on its completion time:
C j − C i ≥ p j ∀i, j = 1, , n, i → j.
Since the jobs are processed in a single machine, for the other pairs
Trang 17before job j, or vice versa To determine which job is scheduled before another in the schedule, we use binary variables y ij with i, j = 1, , n and i ̸= j, in which
j must be scheduled before job i This adapts to the latter constraint,
which now becomes
Trang 18To summarize, we obtain the following IP formulation for problem
the scheduling problem (P ).
Since there is a single machine and job preemption is not allowed,
it is obvious that an optimal schedule must have no gap (free time)between jobs Thus the total time for processing all the jobs is fixedand computed by
For the second formulation, we need the time horizon T and introduce
nT binary variables x jt ∈ {0, 1} with j = 1, , n and t = 1, , T , in