MILP model for the planning of a Computerized Numerical Control Lathes Machining Plant

This work introduces the formulation and application of a MILP model to solve the problem of planning the weekly production of a machining plant using numerical control lathes to manufacture spare parts for agricultural machines. The machining plant works under a Flexible Job Shop system and it has reduced workforce with different skills to operate the various high-complexity lathes and to carry out setup operations in each machine. The developed model is based on a basic formulation for the classic problem and we introduce some flexible adjustment for the various situations that may arise from different scheduling problems. The model is applied to various scenarios; and we include a discussion of the improvements brought about by the analysis.


Introduction
Metallurgical machining plants or companies devoted to producing items in equipment that uses computerized numerical control (CNC) and are characterized by the need of skilled workforce to operate and start up the various pieces of the highly complex equipment involved in their production processes. Machining plants must daily undertake their production scheduling to satisfy clients' demands on settled dates with their scarce resources. This problem becomes even more complex as products are more assorted and manufacturing processes grow in variety. Such is the case of a machining plant that manufactures agricultural machines in the city of Santa Fe, Argentina, which is the object of study in the present work. This company is characterized by a wide range of customized products in relatively small batches. It counts on computerized numerical control lathes that allow accomplishing the various turning tasks involved in manufacturing each spare part. The manufacturing process of each item requires a different set of operations and is accomplished in a particular sequence. Each machine setup and operation (material load and download) require trained workforce, and this is a scarce resource in the company. Not all workers are qualified to carry out all required operations.
It is currently noticed that during the working week, several machines remain without operation for quite long time periods, thus turning the production process quite inefficient. Delivery timelines for finished products are probably affected by constraints that derive from the scarce skilled workforce. With the aim of analyzing this problem, we compared current timelines for executing production orders with the optimal times provided by planning mathematical models which consider some specific constraints found in the company under analysis. A classic Flexible Job Shop problem (FJSP) is a sequencing problem in which a set of jobs must be processed in a set of machines where each job consists of a set of operations to be carried out in a preestablished order in any of those machines, including various alternative machines for each operation [1]. Many authors have presented mathematical models to represent either the classic problem or the problem with additional considerations [2]. In general, those formulations do not consider significant set-up times for machines. These times are included in a batch processing time. Some authors have considered sequence-dependent set-up times [3]. Others have considered constraints on two types of resources [4]: overlapping operations [5] or batch division [6]; in general, each characteristic is considered in isolation. In the company under study, set-up times are very significant and thus they must be carefully considered in the model, even though it is not necessary to consider setup as sequence-dependent. Workers can simultaneously operate two lathes when the processing time for each item is longer than the time required for transportation between lathes. The existence of transfer batches should be also considered, which implies the startup of an operation without completing the whole batch in the preceding operation. Published models do not consider all these conditions simultaneously. This work presents a reasonably sized mixed integer linear programming model (MILP) that can be adjusted to the introduction of different kinds of constraints, so that the simultaneous consideration of all characteristics of the operation planning problem in the machining plant is feasible without considerably increasing the formulation complexity. The rest of the paper is structured as follows. Section 2 presents a literature review on the problem. Section 3 presents the notation being used in the model formulation for the classic FJSP problem developed in Section 4. The previous model adjustment to overlapping operations is shown in Section 5. Section 6 discusses the introduction of workforce constraints into the classic problem; and Section 7 addresses sequence-independent set-up times. Section 8 analyzes the characteristics of the various formulations; and Section 9 depicts the application of the most complete formulation to the resolution of the machining plant involving CNC lathes. Section 10 presents a discussion of the results obtained from the real case analysis. Finally, conclusions are drawn in Section 11.

Literature Review
The FJSP is one of the most difficult-to-solve problems in the production planning area since both job routing and operations scheduling are to be considered. It is well known that this problem is NP-hard. Due to this complexity, much of the existing literature deals withasorte heuristics and metaheuristics [7,8,9,10,11,12,13]. Even though mathematical programming models cannot compete with metaheuristic tools designed to solve large problems they help to better understand the structure of the problem and are easy to implement, replicate, and modify. As Fanjul et al. state [14], MILP models can benefit from continuous improvements in MILP solvers. Mathematical programming formulation is the first key step prior to developing an effective heuristic [15]. The mathematical modeling techniques used to solve production scheduling problems can be classified according to three paradigms: position-based, time-based, and sequence-based, originally proposed by Wagner [16], Bowman [17] and Manne [18], respectively. These variants of modelling paradigms have been separately extended for regular job shop scheduling problems. The main difference between these paradigms lies in the definition of the binary variables used to determine the sequencing problem.
position-based paradigm: Yijhm identifies whether operation i of job j is scheduled on the h-th processing position on machine m. [1,12,16] time-based paradigm: Yijmt identifies whether operation i of job j is processed by machine m during time-unit t. [17,19,20] sequence-based paradigm: Yijhkm identifies whether operation i of job j precedes operation h of job k (not necessarily immediately) on machine m. [3,12,18] Demir and Kürsat [15] compared different mathematical models developed under the three paradigms in terms of objective Cmx (minimum completion time for all operations), CPU time, number of variables, and constraints by using the test problems randomly generated by Fattahi et al. [1]. They recommended using precedence variable-based models among them, especially those proposed by Özgüven et al. for FJSP [21]. From these formulations, some extensions have been developed, which allows considering situations that occur in the industrial practice. Few authors present MILP models for FJSP considering the possible overlapping of operations [5]. Most papers propose metaheuristic algorithms to solve this kind of problems [5,22,23,24]. Another extension of the FJSP considers that machines and workers represent potential capacity constraints on the shop, which is referred to as a Dual-Resource Constrained Flexible Job Shop Problem (DRCFJSP). It consists of three subproblems: (i) Assigning operations to machine resources (ii) Assigning operations to worker resources (iii) Sequencing the operations on machines with workers in mind to optimize performance measurement [25]. In [26], the problem is both to determine the problem is formally described using a non-linear integer model and developing a genetic algorithm to solve it. In [27] and [28], a MILP is for the job shop problem with skilled operators without considering the existence of parallel machines. In [29], a MILP multiple criteria is developed considering three issues: company profit, client satisfaction, and the labor environment but for the aggregate production planning problem. The most studied extension has been FJSP with sequence-dependent set-up times [30]. The model presented in [31] served as a basis for other MILP approaches [32,33]. In [33], an adaptation of the model presented in [32] is proposed for weighting earliness-tardiness minimization and then [14] proposed improvements based on adaptations of subtour elimination constraints. MILP models have not been developed to solve situations where more than two characteristics are added to the classical problem as in the real case presented in this paper.

Definition of classic FJSP problem and notation
The classic FJSP problem poses the following assumptions: the order of operations for each job is fixed and known; 2) priorities are not allowed; 3) all machines are available at time 0; 4) each machine can process only one operation at a time; 5) transportation, setup, and release times are negligible; and 6) no operation can be interrupted during execution.
The mathematical formulation for the classic FJSP problem proposed in this paper might be associated to the sequence-based paradigm, although the variables used to determine the sequencing of operations do not identify the machines on which they are performed. For this reason, we say that it belongs to the global sequence-based paradigm. This feature allows the model to be easily adjusted to of the addition of extensions of the classical problem. It is also characterized by the use of variables with two indices, unlike other formulations using precedence variables with three or four indices [2]. This feature allows for a formulation with fewer integer variables. This is achieved by enumerating the operations that must be carried out in ascending order; so that, for each job, the numbers assigned to operations specify the sequence in which they are to be accomplished. This characteristic does not remain for operations that correspond to different jobs. The notations that describe the sets, parameters, and decision variables used in the model are the following:

Mathematical Formulation I
Under the assumptions and notations presented in the previous section, the problem is both to determine an assignment and a sequence of the operations on all machines that minimizes the total completion time (makespan).
The makespan is the most used objective to optimize, since it is equivalent to minimizing downtime or maximizing the use of machines. Therefore, this is the objective to take into account for the model of this paper. The mathematical formulation we have developed for the classic FJSP problem to be used as a basis for the formulation of more restricted problems is the following: where: U is a sufficiently large number. Constraints (1) represent the feasible order between two operations that may or may not belong to the same job. Constraints (2) indicate that each operation is carried out in a single machine. Constraints (3) impose that if an operation is performed in a particular machine, final time for that operation must not be shorter than the processing time for the operation in that machine. Constraints (4) impose that if two operations are carried out in the same machine, the one that is performed first must finish before the subsequent operation starts. Constraints (5) and (6) consider the sequence of operations of the same job. Constraints (5) impose that no operation can start until preceding ones have finished, even if they are carried out in different machines. That is, if r and s are two operations on the same job j (r, s ϵ O(j)), and r must be performed before s (r<s) in any machine m and n, respectively (Zrm= Zsn= 1), the start time of operation r must be less at the beginning of operation s. Constraints (6) consider that final time for an operation can be shorter than the final time for the previous operation. Under the same conditions above, the completion time of operation r must be less than that of operation s. Constraints (7) determine the makespan (time interval between the beginning of the first job processing and the end of the last job processing), the objective measure to be minimized. Constraints (8) define that, for each machine, the final processing time of its last operation cannot be higher than the makespan. Avalos-Rosales et al. [34] showed that these constraints significantly improve convergence times of branchand-bound algorithm. The structure of constraint (1) allows one of the two variables zero-one Yr,s and Ys,r to be relaxed and, therefore, be defined as positive instead of binary. The definitions of the variables involved in the model are expressed in the set of constraints (9).

Formulation II: FJSP with overlapping operations
This work considers that a job corresponds to a production order for a batch of a particular item that must be manufactured in the period to be scheduled. In the previous formulation, the whole batch is assumed to be processed in a machine before the execution of the subsequent operation. This condition usually becomes highly restrictive, especially in situations in which a large quantity of items is required or processing times are high. In those cases, a certain degree of overlapping is sometimes allowed between successive operations of a same job in different machines. This evidences real situations that can be usually observed in manufacturing companies. The transfer batch is the quantity of items in process that are transported from one machine to another between successive operations. If the transfer batch is smaller than the total batch to be processed, an overlapping of operations occurs. Figure 1 shows a situation in which there is overlapping between operations r and s (s= r+1) that belong to the same job j. The model presented in the previous section requires a little adjustment so as to allow considering these situations. Constraints (5) must be replaced by constraints (10) and (11) According to constraints (10), if the transfer batch is bigger than the total batch, the whole batch is processed before entering the subsequent machine. Constraints (11) consider that if two operations correspond to the same job but are performed in different machines, the following operation cannot start before the previous operation is finished in the transfer batch.
In addition, the subsequent operation can never finish before the transfer batch is completely processed in the previous operation. This constraint becomes quite significant when the processing speed of the subsequent operation is higher than that of the preceding operation (Fig.2). Constraint (12) reflects this situation.

Formulation III: FJSP considering workforce
Previous models considered equipment availability as the only constraining resource. In practice, workforce is another resource that is usually scarce. In the available literature, the problems that consider constraints on both resources are known as DRCFJSP (dual-resource constrained flexible job shop problem) [25,29,35].
In this section, we will consider both the constrained number of workers and the different skills each worker has, which enable them to operate just some machines.
For the development of this new formulation, the following additional notation should be considered: A worker is required if he carries out one or more operations.
The total quantity of required workers cannot surpass the number of available workers.
In general, a worker cannot operate two machines simultaneously. In some cases, as when operating computerized lathes, they can do it if the unit operation time in each machine surpasses a given threshold (tu); for example, due to the transportation from one machine to another one plus loading and downloading times for an item. If this is not the case, tu = .

Formulation IV: FJSP considering sequence-independent setup times
Machine set-up process is not an added value factor, and thus, we must explicitly consider set-up times and costs while making scheduling decisions to enhance productivity, dispose wastes, improve the use of resources, and meet deadlines [30]. When set-up times are independent of the sequence of operations, they are usually considered within the batch processing time and the mathematical model does not differ from those previously described. But when there are constraints related to the staff trained to carry out these operations, it is necessary that the models explicitly consider this machine set-up process. In this section, we will present the modifications that must be introduced into Formulations I, II, and III to consider set-up times.
For the development of this new formulation, the following additional notation should be considered: If operation r is carried out in machine m, the start of the operation must be subsequent to the end of the setup process.

Parameters
If two operations are carried out in the same machine, the first one must be finished before the start of the subsequent operation setup. Therefore, constraints (4) must be replaced by: With the aim of considering constraints related to workforce trained to perform the various activities, formulation III must include the following constraints: Each setup process must be allocated to a sole worker.
A worker can carry out the setup of operation r only if the latter is performed in a machine m that the worker can set up.
A worker is required if he/she performs one or more activities either in machine operation or setup. To consider this more general case, constraints (15) must be replaced by: If the same worker carries out the setup of operations r and s (XSw,r=XSw,s=1), r preceding s (Yr,s=1), and if r is carried out in machine m (Zr,m=1) and s in machine n (Zs,n=1), the start of setup for operation s must occur after the setup of operation r is finished.
, ≥ , + , + ( , + , + , + , + , − 5) (∀ ∈ , ∀ ∈ , , = 1, ∀ ∈ , ≠ , ∀ ∈ , , = 1, ∀ ∈ , , = 1 ∧ , = 1), If the same worker performs an operation and the setup of a preceding operation, the former operation cannot start until the corresponding setup is finished: If the same worker performs an operation and the setup of another preceding operation, the former operation cannot start until the corresponding setup is finished: , ≥ , + , + ( , + , + , + , + , − 5) (∀ , ∈ , ≠ , ∀ ∈ , , = 1, , = 1, ∀ ∈ , , = 1 ∧ , = 1) 8 Formulations assessment Table 1 summarizes how to obtain the models for the different developed problems by formulating the classic FJSP problem. We used the test problems randomly generated by Fattahi et al. [1] to assess the developed models.   Table 2 depicts the numbers for continuous variables (CVN), binary variables (BVN), and constraints (CN) in each problem by applying Formulation I, which was presented in this work for the classic FJSP problem. It also includes CPU times and the achieved objective value. In the same table, the size of those problems is compared to those of the MILP-1 formulation presented by Özgüven et al. [21], which is considered as the most computationally efficient MILP model to solve the classic problem (less CPU time requirement to find the optimal solution) [2] [36]. This sequence-based model is presented in Appendix A.1. All models were solved using solver LINGO 17.0 [37] in a PC with 2.5GHz and 8GB RAM. In all cases, reported CPU times are the average value of 10 runs. It can be observed that for most test problems, the number of binary variables is lower in Formulation I than in the MILP-1 model, although the number of continuous variables and constraints is greater. Since the number of binary variables is the most influential factor for MILP models [36], it can be said that the proposed model turns out to be a slightly simpler model if compared to the MILP-1 formulation. As regards CPU times, they are very low in both cases, so it can be said that both models have a similar performance with respect to this criterion. The extension of the classic problem to take into account overlapping operations was only considered in [5]. This position-based model is presented in Appendix B. We have extended the sequence-based model so that we can compare it with the other formulations. This extension is presented in Appendix A.2. Table 3 compares the sizes and CPU times of these two models with those of the model proposed as Formulation II. For the assessment, we used the same test problems as those for the previous case, adjusting the transfer batch to one unit. As already observed in [15], position-based models are less efficient, especially due to the large number of required binary variables. The size of this model strongly depends on the number of stages considered for each machine. We assume the maximum number of operations possible to be performed on each machine as the number of allowed stages. Taking the transfer batch into consideration does not change the problem size in Formulation II and sequencebased model, but it allows improving the makespan in bigger problems. To evaluate Formulation III, including skilled labor constraints, a maximum of 4 workers were considered: workers assigned even numbers can operate all machines and those assigned odd numbers can operate only machines that were assigned odd numbers. When workforce is constrained, the problem size grows both in integer variables and constraints, which leads to higher CPU times and -as it is expectable-higher makespan values in some situations (Table 4).
Neither model, sequence-based nor position-based, can be easily modified to account for labor constraints. Neither of them handles variables that identify the relative sequence of operations on the different machines. This is a requirement to express the constraints that imply that a worker cannot operate two machines simultaneously. For this reason, for both Formulation III and Formulation IV, comparative studies cannot be made. To evaluate formulation IV, every operation was assumed to require a 20-unit setup time -in all cases-on any machine and workers assigned even numbers were assumed to be trained to carry out the setup of all machines. Table 5 shows problem sizes and CPU times for Formulation IV. To analyze the characteristics of the optimal solutions according to each formulation, those corresponding to the SFJS10 test case are shown and those data are specified in Table 6. Figures 3 to 6 depict the different solutions found for the particular case of the SFJS10 test problem. The different solutions found for the particular case of the SFJS10 test problem are shown graphically in Figure 3 to 6. Figure 3 shows an optimal solution found for the classical problem. Each job is represented by a different color and the operation number is displayed within bars.    Figure 4 shows how the overlapping of operations allows considerably decreasing the makespan. All operations of job 1 overlap: operation 2 can start after operation 1 has been performed on 2.9 units, and operation 3, after operation 2 has been performed on one unit, if it is considered that operations 1 and 2 start at their earliest time, since both present slack. In job 2, operation 5 begins after operation 4 has been performed on 8.9 units, and operation 6 after operation 5 has been performed on 7.7 units. In job 3, operation 8 begins after operation 7 is performed on one unit, and operation 9 begins after operation 8 is performed on 4 units. In job 4 there is only one overlapping operation; operation 11 starts after operation 10 is performed on one unit. Although operation 10 has a slack of 63.5 time units, the entire batch operation cannot start after the earliest time is given in the solution, because operation 11 has no slack and therefore could not delay its start. In this way, the entire order is processed in 419.5 units of time. slack but in this case, it cannot be used to overtake the batch production because it would finish before the preceding operation. In this case, the slack allows considering longer processing times. Figure 5: SFJS10 Optimal solution Formulation III Figure 6 shows an optimal solution when considering that each operation requires a 20-unit set-up time and can be performed by only two of the four available workers (workers 2 and 4). Set-up time for an operation is shown in a similar but lighter color to that of jobs. This last constraint leads to solutions with idle times between the completion of the machine set-up tasks and the start of the operation itself. This is clearly seen in operation 1, which cannot start until worker 4 has finished the setup of operation 5. The time required to process the entire order has increased to 549.7.

Case Study: Computerized Numerical Control Lathes Machining Plant
The engineering company that is studied in this section is devoted to the manufacture of spare parts for tractors and harvesters. The standard manufacturing line comprises around 1000 components: straight and helical gears, bearings, shaft heads, conical gears, and differential gear boxes, among others. The most critical sector in the company is the Lathes sector, which has 6 machines (vertical drill, Pittler parallel lathe, Hyundai CNC lathe, Doosan CNC lathe, Victor Taichung CNC lathe, and Macro Micro Machining Center) and counts on 3 workers. These 3 workers are not all trained to calibrate the lathes, and a fourth worker is allocated to the sector just in exceptional cases.
The production manager has noticed that, even though between 25% and 76% of the main lathes (CNC) that belong to the previously mentioned sector remain idle (see Table7), the amount of material to be processed in the Lathes sector is constant. For that reason, workers' training is being considered so that they can perform tasks in this area. This leads to an improved use of machines and the avoidance of bottleneck situations in this sector of the production process.  We present a situation in a typical week (42.5 available hours) as an example. In that week, a ten-item production (jobs) is required, which implies 20 operations, as shown in Table 8.  Table 9 depicts which machines can be used to carry out the various operations (RMrm). Every worker can operate the various machines, but only some of them are trained to carry out the setup, as shown in Table 10. Table 11 presents a list of setup and processing times for each operation in each machine.  Along this production period, the distribution of operations over time is accounted for by the Gantt diagram shown in Figure 7. Figure 8 depicts the way in which the jobs were distributed for the three workers that carried out the production plan. It is worth noticing that, in several occasions, worker 3 performs setup and processing tasks simultaneously, which leads to a higher time consumption for the execution of certain operations.
We applied the above developed MILP model (Formulation IV) to analyze the current situation and the possible actions to be taken to solve the problem of the company. We considered three possible scenarios: 4, 3, and 2 available workers.
The model for scenario 1 (4 workers) has 370 binary variables and 13278 constraints. It was solved by using solver LINGO 17.0 [37] in a PC with 2.5GHz and 8GB RAM and it required 2114.26 seconds of CPU time. The optimal makespan found was 29.16 hours, which is much lower than the real time used to execute the production order (42.5 hours). The transfer batch being used was made up of 100 items, an average quantity that corresponds to the capacity of the carts used to transport intermediate products. The average time for the transfer of a worker from one machine to another and the load and download of a piece is 0.02 hours (time threshold). The optimal solution for scenario 2 (3 workers) provided the same makespan value as that for the previous scenario, which proves that a higher number of workers does not mean improved production times. Figures 9 and 10 show the distribution of operations over time and the optimal allocation of workers, respectively. It is evidenced that in the proposed optimal planning no overlapping of tasks occurs when one worker is in charge of a machine setup. Another considered option was to reduce the number of workers allocated to the sector to 2 (scenario 3). The optimal makespan was found to be 33.84 hours. Figures 11 and 12 show the distribution of operations over time and the optimal allocation of workers for this scenario, respectively. This solution requires one worker to simultaneously carry out more than two operations, which is not a desirable situation in practice.

Result Discussion
The main requirement of the company was to reduce idle times of the main equipment in the lathe sector and it was met in all studied scenarios (see Table12). Furthermore, in all cases, a more uniform distribution was achieved for the use of machines with similar characteristics, requiring an improved weekly scheduling. The presented model proved to be a valuable and helpful tool for making this kind of decisions. Solutions reveal that the availability of more workers than those currently allocated to the sector is not convenient. Further decreasing the number of workers allows reducing idle times but it does not seem to be an efficient solution since it requires the overlapping of many jobs, which would be detrimental to work quality. Reducing the makespan implies the decrease in execution times for production orders, and thus, the corresponding reduction in the quantity of products being processed that are accumulated before reaching the CNC Lathes Sector.

Conclusions
This work has presented a MILP model to solve the classic FJSP problem, whose size and computational efficiency is comparable to the best published models. It serves as a basis for the formulation of problems that consider constraints that are typical of real problems. The main characteristic of this model is that it belongs to a different production scheduling modelling paradigm, which uses a new sequencing binary variable that makes the order of execution of the operations independent of machine assignment.
Test problems were adjusted to analyze the different variations of problems, so that the results presented in this paper will serve as a reference for future benchmarking processes. The most complete model here presented allowed solving the planning of a lathe machining plant that requires simultaneously considering constraints related to the quantity and skills of the workers to be allocated, overlapping operations, constraining set-up times, and transfer batches. Even though solution times seem to be high, they do not constrain the weekly planning of the company. By applying the present model, the company has been able to reduce idle times in lathes. The model was also used for strategic decision-making that involves decisions on workforce skills. The use of metaheuristics to solve the model will constitute the subject of further research.