1. Trang chủ
  2. » Luận Văn - Báo Cáo

Scheduling a single machine with precedence constraints

33 8 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Nội dung

HANOI PEDAGOGICAL UNIVERSITY DEPARTMENT OF MATHEMATICS ——————–o0o——————— Nguyen Thanh Nga Scheduling a single machine with precedence constraints BACHELOR THESIS Major: Applied Mathematics Hanoi, May 2019 HANOI PEDAGOGICAL UNIVERSITY DEPARTMENT OF MATHEMATICS ——————–o0o——————— Nguyen Thanh Nga Scheduling a single machine with precedence constraints BACHELOR THESIS Major: Applied Mathematics Advisor: Dr Le Xuan Thanh Hanoi, May 2019 Confirmation I hereby confirm that this thesis is my original work completed under the guidance of Dr Le Xuan Thanh The presented results are accurate and correctly cited Author Acknowledgements I would like to express my gratitudes to the teachers of Hanoi Pedagogical University 2, especially the teachers in the Department of Mathematics The lecturers have imparted valuable knowledge and facilitated for me to complete the course and the thesis In 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 right orientations are important prerequisites for me to get the results in this thesis Due to limited time, capacity, and conditions, my thesis cannot avoid errors I look forward to receiving valuable comments from readers Author Contents Introduction 1.1 Thesis topic 1.2 Research methods 1.3 Results of the thesis 1.4 Structure of the thesis 6 8 Preliminaries 10 2.1 Some basic scheduling concepts 10 2.2 Mixed integer linear programming 12 Problem description and 3.1 Problem description 3.2 First formulation 3.3 Second formulation 3.4 Third formulation 3.5 Fourth formulation MIP formulations 14 14 16 18 20 21 Experiments 25 4.1 ZIMPL codes 25 4.2 Numerical results 30 Conclusions 32 Chapter 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 tasks and how to commit resources between the variety of possible tasks is called scheduling Having good schedules makes our life more comfortable and wellorganized In social services, industrial manufacturing, transportation, etc., a good schedule results in higher productive and more competitive outcomes How to construct good schedules for real-life as well as industrial activities is the main goal of scheduling problems Thus, one can say that scheduling problems arise naturally from practice and play a vital role in operating systems In the past few decades, the practical importance and complexity of the general scheduling problems 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 horizon using limited resources (machines, processors, or staffs) Some constraints (on, for examples, release dates or precedence constraints between the jobs) might be imposed in the problems Often there are a finite (but usually very huge) set of possibilities for a feasible schedule However, usually one has to optimize certain objective function This means that we have to look for a best solution among a tremendous number of feasible solutions Furthermore, practical instances of scheduling problems might have very large size (up to hundreds or even millions jobs and machines) That is the motivation for academic researchers to develop algorithms capable of solving large-size scheduling problems in acceptable time The performance of the algorithms depends very much on the design of the algorithms themselves and data structures For the same problems, there might be many solution approaches with different levels of efficiency Such a common approach is to use mixed integer programming (MIP) in modeling the problems This approach has a two-fold advantage On one hand, it makes use of available MIP solvers, since in the recent years the solvers became much more efficient On the other hand, it is easy to implement the models and then solve the problems on computers In this thesis, we would like to highlight the fact that there might have different MIP formulations for representing a scheduling problem, and having a good formulation is crucial in solving numerical instances of such problem For that we focus on studying the scheduling problem on a single machine with precedence constraints between the jobs and minimizing the total flow time More precisely, we consider the situation in which one has to schedule a set of jobs on a single machine Each job has its processing time and is processed without preemption Between the jobs there may be arbitrary precedence constraints that impose which jobs have to be completed before starting another job The objective is to find a schedule that minimizes the total flow time, i.e the total value of completion times of all jobs The scheduling problem studied in this thesis is one of the most basic scheduling problems For a comprehensive study on scheduling problems, we refer to [2] It is also shown in [2] that the problem under our consideration is NP-hard, therefore MIP-based approaches are of the most common solution methods The fact that we would like 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 scheduling problem due to the mentioned advantages of the methods That is, we formulate the problem as different mixed integer programming formulations We will also test the obtained models on different instances that are randomly generated, with the help of some modeling language and integer programming solver 1.3 Results of the thesis We describe the scheduling problem on a single machine with precedence constraints between the jobs, no job preemption, and minimizing the total flow time We present four different MIP formulations for the problem Based on experimental results on some tested instances, we find out the best performance formulation for numerically solving 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 preliminaries on the scheduling problem of our consideration and a short introduction to mixed integer programming • Chapter 3: Problem description and MIP formulations This chapter first describes the scheduling problem studied in this thesis, and then presents several MIP formulations for the problem • Chapter 4: Experiments This chapter describes how we generate tested instances for numerical experimenting the formulations mentioned in Chapter Then we present how to implement the formulations on computers After that, we analyze the performance of the formulations based on our obtained numerical results • Chapter 5: Conclusions We close the thesis by some conclusions Chapter Preliminaries In this chapter, we introduce some basic concepts related to our considered 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 this context, the student can be considered as a machine, and reviewing each 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 Mk (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 simultaneously In some models a job can be interrupted when processing on a machine and resumed later either on the same machine or on another one In such contexts we say that the jobs can be preempted, or equivalently, job preemption is allowed However, in this thesis we 10 Furthermore, there is exactly one time at which job j is completed, so we must have T ∑ xjt = T ∑ xjt = ∀j = 1, , n t=pj t=1 That is, for each job j there is exactly one index t = pj , , T such that xjt = That index is also the completion time of job j Keeping this fact in mind and from the definition of variables xjt ’s, we deduce that T ∑ Cj = txjt ∀j = 1, , n t=1 Thus, the objective function of total flow time can be expressed by n ∑ Cj = T n ∑ ∑ txjt j=1 t=1 j=1 By the same arguments as in the first formulation given in Section 3.2, for each job precedence relation i → j we must have Cj − Ci ≥ pj Using the time-indexed variables, these constraints can be represented by T T ∑ ∑ txjt − txit ≥ pj ∀i, j = 1, , n, i → j t=1 t=1 Furthermore, in each time interval [t, t+1[ at most one job is processed, which is ensured by the following constraints n min{t+p ∑ ∑j ,T } j=1 xjτ ≤ ∀t = 0, , T − τ =t+1 To summarize, we obtain the following IP formulation for problem (P ) (T IM EIN DEX) n ∑ T ∑ j=1 t=1 19 txjt s.t T ∑ txjt − t=1 T ∑ txit ≥ pj t=1 T ∑ ∀i, j = 1, , n, i → j xjt = ∀j = 1, , n xjτ ≤ ∀t = 0, , T − xjt ∈ {0, 1} ∀j = 1, , n, t = 1, , T t=pj n min{t+p ∑ ∑j ,T } j=1 3.4 τ =t+1 Third formulation Since there is a single machine without job preemption, the final schedule can be determined when we know the order of processing the jobs Therefore, we introduce a new formulation in which we only use n2 − n binary variables yij ∈ {0, 1} (with i, j = 1, , n, i ̸= j), in which { if job i is scheduled before job j, yij = otherwise These variables are so-called order variables Using these variables, the completion time of a job j is computed by n ∑ pi yij (3.1) C j = pj + i=1 i̸=j Indeed, any job i scheduled before job j will lead to yij = and therefore its processing time will be taken into account in the sum on the right of (3.1) Conversely, any job i scheduled after job j will lead to yij = and therefore does not contribute to the sum on the right of (3.1) Consequently, the objective function can be expressed by   n n n ∑ ∑ ∑   pi yij  Cj = p j + j=1 j=1 i=1 i̸=j 20 For each job precedence relation i → j, we have yij = For each pair of jobs {i, j}, either i is scheduled before j, or j before i Therefore we must have ∀i, j = 1, , n, i ̸= j yij + yji = Furthermore, we must ensure that the resulting order of jobs is acyclic in the sense that if job i is scheduled before job j and job j is scheduled before job h, then the job h cannot be scheduled before job i It means that yij + yjh + yhi ≤ ∀i, j, h = 1, , n, i ̸= j, j ̸= h, h ̸= i To summarize, we obtain the following IP formulation for the problem (P ) (ORDERV AR) n n ∑ ∑ j=1 pi yij + n ∑ ∀i, j = 1, , n, i → j ∀i, j = 1, , n, i ̸= j ∀i, j, h = 1, , n, i ̸= j, i ̸= h, j ̸= h ∀i, j = 1, , n, i ̸= j s.t yij = yij + yji = yij + yjh + yhi ≤ yij ∈ {0, 1} 3.5 pj j=1 i=1 i̸=j Fourth formulation We note that, for a single machine without job preemption, a schedule is determined if we know the position of each job in the schedule This is the key idea to formulate the fourth formulation for problem (P ) More precisely, we use n2 binary variables zjk ∈ {0, 1} with j, k = 1, , n, in which { if job j is scheduled at position k in the schedule, zjk = otherwise 21 These variables are so-called position variables Lemma The total flow time is computed by n ∑ n ∑ (n − k + 1)pj zjk j=1 k=1 Proof A feasible schedule is completely described by an ordered set (j1 , j2 , , jn ) which is a permutation of n jobs {1, 2, , n} In this schedule, job j1 processes first, then job j2 processes right after job j1 , job j3 starts right after the completion of job j2 , and so on Thus, the completion time of job j1 is Cj1 = pj1 , the completion time of job j2 is Cj2 = pj1 + pj2 Generally, the completion time of job jk is Cjk = pj1 + pj2 + + pjk pj pj pj Cj1 = pj1 Cj2 = pj1 + pj2 Cj3 = pj1 + pj2 + pj3 pj n Cjn−1 Cjn Figure 3.2: Explain the formula for completion times of the jobs The total flow time therefore is Cj1 + Cj2 + + Cjn = pj1 + (pj1 + pj2 ) + + (pj1 + pj2 + + pjn ) = npj1 + (n − 1)pj2 + + (n − k + 1)pjk + + pjn n ∑ (n − k + 1)pjk = (3.2) k=1 22 Note that among jobs j = 1, , n there is exactly one job j scheduled at position k Therefore, by definition of variables zjk , we have pj k = n ∑ (3.3) pj zjk j=1 Replacing (3.3) into (3.2), we obtain the formula for the total flow time C1 + C2 + + Cn = Cj1 + Cj2 + + Cjn = n ∑ n ∑ (n − k + 1)pj zjk j=1 k=1 This completes the proof of the lemma Using position variables zjk ’s, the job precedence relation i → j can be represented by the following constraint n ∑ lzjl − l=1 n ∑ kzik ≥ k=1 Indeed, the former sum is the position of job j and the latter sum is the position of job i Since job i is scheduled before job j, its position must be strictly less than the position of job j Furthermore, each job must be scheduled at exactly one position, which can be represented by n ∑ zjk = ∀j = 1, , n k=1 Additionally, each position corresponds to exactly one job, which can be represented by n ∑ zjk = ∀k = 1, , n j=1 23 To summarize, the problem (P ) can be modeled as follows (P OSIT ION V AR) n ∑ n ∑ (n − k + 1)pj zjk j=1 k=1 n ∑ s.t j=1 n ∑ n ∑ l=1 lzjl − zjk = ∀k = 1, , n zjk = ∀j = 1, , n k=1 n ∑ kzik ≥ ∀i, j = 1, , n, i → j k=1 zjk ∈ {0, 1} 24 j, k = 1, , n Chapter Experiments In this chapter, we first present how we implement and test the (M)IP formulations introduced in Chapter Then we present numerical results obtained by testing the formulations on some tested instances 4.1 ZIMPL codes We use mathematical modeling language ZIMPL [3] to implement the introduced (M)IP formulations The data of each tested instance are saved in a separated file In Code we give an example of such the data file Code 1: An example of data file # number jobs 10 10 11 12 # processing times 1 3 4 10 7 25 13 14 10 15 16 17 18 19 20 21 # precedence constraints 3 10 10 The data file given in Code describes an instance of the scheduling problem with 10 jobs The comment lines start with notation # From line to line 14 of the file, each line starts with the index of a job, then the processing time of the corresponding job For instance, line of the file shows that the job of index processes in 10 time units From line 17 to line 21 of the file, each line consists of two index numbers, in which the job of the former index must process before the job of the latter index For example, line 20 shows that the job of index must be completed before the start of job 10 In the following we respectively give the ZIMPL codes for the formulations introduced in Chapter Code 2: ZIMPL code for MIP formulation (COM P L) # Get list of jobs param n := read file as "1n" skip use 1; s e t Jobs := {1 to n}; # Get data of job processing times param p[ Jobs ] := read file as " 2n" skip use n; # Get data of precedence constraints s e t Prec := {read file as " " skip n +4}; 10 11 12 # Define value of big M param M := sum in Jobs : p[i]; 13 14 15 16 17 ## VARIABLES # C[j] = completion time of job j var C[ in Jobs ] >= p[j]; # y[i,j] =1 if job i is scheduled before job j 26 18 var y[ in Jobs * Jobs with i != j] binary ; 19 20 21 22 ## OBJECTIVE minimize totalFlow : sum in Jobs : C[j]; 23 24 25 26 27 ## CONSTRAINTS subto precedence : f o r a l l in Prec : C[j] - C[i] >= p[j]; 28 29 30 31 subto atMostOneJob : f o r a l l in Jobs * Jobs with i != j: C[j] - C[i] >= p[j] - M * (1 -y[i,j]); 32 33 34 35 subto atMostOneJob2 : f o r a l l in Jobs * Jobs with i != j: C[i] - C[j] >= p[i] - M * y[i,j]; Code 3: ZIMPL code for IP formulation (T IM EIN DEX) # Get list of jobs param n := read file as "1n" skip use 1; s e t Jobs := {1 to n}; # Get data of job processing times param p[ Jobs ] := read file as " 2n" skip use n; # Get data of precedence constraints s e t Prec := {read file as " " skip n +4}; 10 11 12 13 # time horizon param T := sum in Jobs : p[i]; s e t TimePeriods := {1 to T}; 14 15 16 17 ## VARIABLES # x[j,t] = if job j completes at time t var x[ in Jobs * TimePeriods ] binary ; 18 19 ## OBJECTIVE 27 20 21 minimize totalFlow : sum in Jobs : sum in TimePeriods : t*x[j,t]; 22 23 24 25 26 ## CONSTRAINTS subto eachJobHasCompletion : f o r a l l in Jobs : sum in {p[j] to T}: x[j,t] == 1; 27 28 29 30 subto atMostOneJob : f o r a l l in {0 T -1}: sum in Jobs : sum in {(t +1) to (t + p[j], T)}: x[j, tau ] = p[j]; Code 4: ZIMPL code for IP formulation (ORDERV AR) # Get list of jobs param n := read file as "1n" skip use 1; s e t Jobs := {1 to n}; # Get data of job processing times param p[ Jobs ] := read file as " 2n" skip use n; # Get data of precedence constraints s e t Prec := {read file as " " skip n +4}; 10 11 12 13 ## VARIABLES # y[i,j] = iff job i is scheduled before job j var y[ in Jobs * Jobs with i != j] binary ; 14 15 16 17 18 ## OBJECTIVE minimize totalFlow : sum in Jobs : sum in Jobs - {j}: p[i]*y[i,j] + sum in Jobs : p[j]; 19 20 ## CONSTRAINTS 28 21 22 23 subto eitherOrder : f o r a l l in Jobs * Jobs with i != j: y[i,j] + y[j,i] == 1; 24 25 26 27 28 subto noCycles : f o r a l l in Jobs * Jobs * Jobs with i != j and i != h and j != h: y[i,j] + y[j,h] + y[h,i] = 1; 4.2 Numerical results To see how the introduced (M)IP formulations perform, we tested them on four instances of the scheduling problems The instances are randomly generated We use SCIP [1] as (M)IP solvers All the tests were committed on a PC with Intel(R) Core(TM) i3-5005U CPU 2.00 GHz 2.00 GHz processor and GB RAM Table 4.1 records the running time (in seconds) of the formulations on testing the generated problem instances The first column of the table gives the size of the tested instances (in sense of the number of the jobs) The notation * means that the corresponding running time was over the limit of 1800 seconds n 10 20 50 70 (COM P L) (T IM EIN DEX) (ORDERV AR) (P OSIT ION V AR) 22 * * * 0.1 * * 0.1 0.1 0.1 0.1 Table 4.1: Performance of the (M)IP formulations From Table 4.1 we can see that the formulation (COM P L) performs worst The reason for that worst performance might be the presence of the big M in the formulation, which leads to poor LP formulation of the formulation during the solving process On the opposite 30 direction, Table 4.1 shows that the formulation (ORDERV AR) performs best, while the formulation (P OSIT ION V AR) also has good performance 31 Chapter Conclusions In this thesis we study the scheduling problem in which n jobs with given processing times have to be completed on a single machine without preemption No release dates, no deadlines or due dates are imposed on the jobs, but there are precedence constraints between some jobs The goal is to find a schedule for processing all the jobs with minimum total flow time We present four different (mixed) integer programming formulations for the scheduling problem The first formulation directly uses completion times of the jobs as formulation variables The second formulation uses a time horizon and binary variables to determine which job finishes at which time position The third formulation uses socalled order variables to determine which job processes before another in the final schedule The fourth formulation uses so-called position variables to determine the position of each job in the resulting schedule We tested the formulations on several randomly generated instances of the scheduling problem Our experimental results show that the formulation with order variables performs best, while the formulation with completion variables performs worst This confirms the argument that formulating a good model is of crucial importance to solving the problem 32 Reference [1] T Achterberg SCIP: Solving Constraint Integer Programs Mathematical Programming Computation, 1(1):1–41, 2009 [2] P Brucker and S Knust Complex Scheduling (second edition) Springer-Verlag Berlin Heidelberg, 2012 [3] T Koch Rapid Mathematical Programming PhD thesis, Technical University Berlin, 2004 [4] G L Nemhauser and L A Wolsey Integer and Combinatorial Optimization Wiley-Interscience, 1988 33 ...HANOI PEDAGOGICAL UNIVERSITY DEPARTMENT OF MATHEMATICS ——————–o0o——————— Nguyen Thanh Nga Scheduling a single machine with precedence constraints BACHELOR THESIS Major: Applied Mathematics Advisor:... real-life as well as industrial activities is the main goal of scheduling problems Thus, one can say that scheduling problems arise naturally from practice and play a vital role in operating systems... aij , cj , bi ∈ R are parameters with given values, and xj are decision variables whose values are needed to be decided Here, n is the number of variables and m is the number of constraints An

Ngày đăng: 07/04/2021, 07:21

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

w