mathematics

Article Hybrid Particle Swarm Optimization for Process Planning

Xu Zhang 1, Pan Guo 1, Hua Zhang 2 and Jin Yao 3,*

1 Business School, Sichuan University, Chengdu 610064, China; [email protected] (X.Z.); [email protected] (P.G.) 2 School of Economics and Management, Zhaoqing University, Zhaoqing 526061, China; [email protected] 3 School of Mechanical Engineering, Sichuan University, Chengdu 610064, China * Correspondence: [email protected]

 Received: 6 September 2020; Accepted: 6 October 2020; Published: 11 October 2020 

Abstract: Process planning is a typical combinatorial optimization problem. When the scale of the problem increases, combinatorial explosion occurs, which makes it difficult for traditional precise to solve the problem. A hybrid particle swarm optimization (HPSO) algorithm is proposed in this paper to solve problems of process planning. A hierarchical coding method including operation layer, machine layer and logic layer is designed in this algorithm. Each layer of coding corresponds to the decision of a sub-problem of process planning. Several genetic operators of the genetic algorithm are designed to replace the update formula of particle position and velocity in the particle swarm optimization algorithm. The results of the benchmark example in case study show that the algorithm proposed in this paper has better performance.

Keywords: process planning; hybrid particle swarm optimization; hierarchical coding

1. Introduction Process planning runs through the entire manufacturing process and has a significant impact on the series of important indicators such as product production cycle, production cost and product quality. In the earlier traditional process planning, due to the limitation of manufacturing resources, process planners would generate a relatively fixed and single process route for each product, which would often cause adverse effects such as resource conflicts, “bottleneck” processes or unbalanced load of processing equipment in actual production, thus reducing the efficiency of production activities. With the transition from traditional manufacturing mode to modern advanced manufacturing mode, the flexibility of the manufacturing system is getting higher and higher, and the flexible manufacturing system come into being. In a flexible manufacturing system, there are multiple process route options for the same product, which are embodied in: (1) Operation selection flexibility, that is, the product can be produced by a combination of multiple different operations. (2) Operation sequence flexibility, that is, the processing sequence between some operations can be exchanged. (3) Machine selection flexibility, that is, some operations can be processed by different machines or equipment. There may be more than one process route for a product, but only one can be adopted in the end [1]. Flexible process routes can improve the flexibility of production activities, provide more options for manufacturing resources, and expand the optimization space of manufacturing process. So that the production efficiency of manufacturing enterprises can be improved effectively. Flexible manufacturing technology and production environment provide a broader optimization space for process planning, but at the same time it also increases the difficulty of optimizing process planning issues. The process planning problem studied in this paper mainly refers to the optimization decision of the above three dimensions

Mathematics 2020, 8, 1745; doi:10.3390/math8101745 www.mdpi.com/journal/mathematics Mathematics 2020, 8, 1745 2 of 22 for some optimization objects, so as to obtain the optimal process route plan. In other words, it is a problem of searching for the optimal process plan in the feasible process plan space according to certain restrictions. Process planning is a typical combinatorial optimization problem, which has been proved to be NPC (non-deterministic polynomial complete) problem [2]. The traditional accurate solution method is difficult to solve the process planning problem with a large scale. In view of this, this paper proposes an improved hybrid particle swarm optimization algorithm to solve the process planning problem. This algorithm uses the crossover and mutation operation of genetic algorithm to replace the particle position and velocity update formula of particle swarm optimization algorithm. It is a hybrid algorithm of particle swarm optimization algorithm (PSO) and genetic algorithm (GA). The algorithm in this paper is mainly improved in two aspects: (1) Coding method: A hierarchical coding method including operation layer, machine layer and logic layer are designed, and each layer of coding corresponds to the decision of a sub-problem of process planning. This method can reduce the decoding difficulty of existing coding methods and increase the information contained in chromosome . Among them, the design of logic layer coding is conducive to the layered cross operation between different individuals, and has a significant contribution to the performance of the algorithm in this paper. (2) : Different cross-mutation operators are proposed for each layer of coding, and different search strategies are adopted, which greatly enhances the search performance of the algorithm. Finally, the benchmark problem is used to validate the algorithm and test its performance. The results show that the algorithm presented in this paper has some advantages. The rest of this paper is formulated as follows. Section2 provided a brief literature reviewed of optimization method for process planning. In Section3, the description of process planning problem was given. In Section4, the mixed model of process planning was established. In Section5, a hybrid particle swarm optimization (HPSO) algorithm for process programming was designed. In Section6, two benchmark examples were used to verify the e ffectiveness of the algorithm and test its performance. Section7 presents some conclusions and some proposals for future research.

2. Literature Review Process planning is a type of typical combinatorial optimization problem, which belongs to NPC problem. For solving process planning problem, the traditional method has great limitations, so that most of researchers use approximate methods to solve the problems with large scale. A large number of modern manufacturing enterprises use computer aided process planning (CAPP) system for process planning, the optimization method of the process route is the core of the CAPP system. The existing methods in related research mainly include expert system (ES), artificial neural network (ANN), multi-agent system (MAS), petri nets, fuzzy sets and fuzzy logic, algorithms, etc. [3,4]. Heuristic algorithms have outstanding characteristics such as diverse optimization mechanisms, high optimization efficiency, relatively simple implementation, and easy embedding, and are the most widely used in process planning. Li et al. [5] used a mixture of genetic algorithm and algorithm to optimize the process plan of prismatic parts, and achieved good results. The GA is carried out in the first stage to generate some initially good process plans. Based on a few selective plans with Hamming distances between each other, the SA algorithm is employed to search for alternative optimal or near-optimal process plans. The calculation results of the calculation example show that the hybrid algorithm has better performance than the single algorithm. Singh et al. [6] studied the process planning problem based on part machining characteristics, and adopted genetic algorithms to optimize the optimal operation sequence, machine tool sequence and tool sequence under different conditions. Su et al. [7] proposed an edge selection strategy based on genetic algorithm to ensure the priority constraints of processes in process planning. The strategy based on edge selection could generate feasible solutions during initialization and ensure the generation of each feasible solution with acceptable probability, so as to improve the convergence efficiency of genetic algorithm. Delolme et al. [8] adopted genetic algorithm to generate process optimization plan, and made multi-criteria optimization decision based on them. Mathematics 2020, 8, 1745 3 of 22

Guo et al. [9] used particle swarm optimization algorithm to solve the problem of process sequencing in process planning, and compared the results of the improved particle swarm algorithm with the results of genetic algorithm and simulated annealing algorithm, and pointed out the different characteristics of the three algorithms. Li et al. [2] designed a multi-layer coding method based on processing characteristics, proposed a hybrid particle swarm optimization algorithm to solve process planning, and compared the results of multiple calculation examples to show the advantages of the algorithm. Wang et al. [10] used an improved particle swarm optimization algorithm to solve the process planning problem. The algorithm is improved on the basis of the traditional particle swarm algorithm, adding expansion operators for different parts of the particle code, which improves the search performance of particles. Miljkovi´cet al. [11] solve the multi-objective process planning problem which considering the indexes of minimize production cost and production time with an improved particle swarm optimization algorithm. Wu et al. [12] designed a hybrid algorithm of particle swarm optimization and genetic algorithm to solve the process planning problem, and verified the effectiveness of the algorithm with an example. Ma et al. [13] used the simulated annealing algorithm to solve the process planning. Li et al. [14] proposed a algorithm with embedded mixed constraint processing method for process planning, and compared it with the simulated annealing algorithm in a calculation example, which proved that the algorithm has more advantages. Lian et al. [15] designed a multi-dimensional tabu to solve the process planning according to the characteristics of the process planning problem. Liu et al. [16] and Hu et al. [17] used ant colony optimization algorithm to optimize the process route and achieved relatively ideal results. Chan et al. [18] used immune algorithms (IA) to solve process planning problems. Algorithms in the above literatures include genetic algorithm (GA), particle swarm optimization (PSO) algorithm, simulated annealing (SA) algorithm, tabu search (TS) algorithm, ant colony optimization (ACO) algorithm, artificial immune algorithm (IA) and so on. There are some more novel methods except those common heuristic algorithms for solving process planning, such as the intelligent water drop algorithm used by Gao et al. [19], and DP-like heuristic algorithm used by Jin et al. [1] etc. In the above-mentioned literatures, the algorithm encoding method can be divided into a method based on processing characteristics and a method based on processing operations. As part of the manufacturing features include multiple operations, the coding method of the process route plan for the process features reduces the computational of problem solving and is more conducive to random search, but it also limits the optimization search space of the problem. Although the process-based coding method is also subject to the order constraints of the manufacturing features, it allows the processing processes that have no constraint relationship to be inserted between different processes of a certain manufacturing feature, and has more optimization space. Therefore, we design a new coding method to express the flexible process route, and proposes an improved hybrid particle swarm algorithm to solve the process planning problem in this paper.

3. Description of Flexible Process Route For a more comprehensive description of the flexible process route of a product, multiple aspects of information need to be expressed, including the manufacturing feature information of the product (such as the optional operations of manufacturing feature, feature sequence constraints, etc.), and available processing equipment information (such as the operations that can be performed by the machine, etc.) and the information of the operations in the product manufacturing feature which is processed on a specific machine (such as the processing time of a operation on a specific machine, etc.). In many related literatures, there are many kinds of methods to describe flexible process planning, which can be roughly divided into table-based expression methods, directed graph-based expression methods, operation segments-based expression methods, set theory-based expression methods, and feature-based expression methods, and so on. Among the more common representation methods are network graphs, petri nets, AND/OR graphs, and so on. Li et al. [20] proposed an acyclic unidirectional graph that combines AND/OR graphs with network graphs to describe the flexible Mathematics 2020, 8, 1745 4 of 22 describe the flexible process route of products, which has the advantages of simplicity and intuitiveness. Under normal circumstances, using this method in conjunction with a table-based presentation method can more fully express the flexible process route of the product. According to the above method, the flexible process route of a product can be described as follows. Table 1 is the Mathematicsprocess information2020, 8, 1745 table of the product, and Figure 1 is the AND/OR network figure which4 of 22 described the flexible process route of the product. The product has 11 manufacturing features, 15 processoptional route processes, of products, and is processed which has on the 6 advantagesoptional machines. of simplicity and intuitiveness. Under normal circumstances, using this method in conjunction with a table-based presentation method can more Table 1. An example of a product process information. fully express the flexible process route of the product. According to the above method, the flexible process routeOptional of a product can be described as follows. Table1 is the processSequence information table Feature Optional Machine Process Time of the productOperation, and Figure 1 is the AND /OR network figure which described theConstraints flexible process route of theF product.1 TheO product1 hasM2, 11M3 manufacturing, M4 features, 18, 17, 15 optional15 processes, Before andALL is processed on 6 optional machines. F2 O2 M2, M4, M5 10, 12, 14 Before F3

F3 O3 TableM 1.1, AnM2, example M3, M4 of a product process 12, 15, information.18, 20 Before F10, F11

F4 OptionalO4 M3, M4, M5 17, 16, 19 BeforeSequence F10, F11 Feature Optional Machine Process Time F5 OperationO5 M2, M4, M6 18, 20, 22 BeforeConstraints F10, F11

F6 F1 O6 O1 MM1, M2,M2, 3M,M4 4 20,18, 22, 17, 18 15 Before Before F ALL10, F11 F2 O2 M2,M4,M5 10, 12, 14 Before F3 7 3 4 5 6 F3 O O3 MM, M1,M, 2M,M, 3M,M 4 14,12, 16, 15, 14, 18, 18 20 Before F10,F11 F7 F4 O4 M3,M4,M5 1117,, 10 16,, 9 19→10, 12, Before Before F F810, F,F9 11 O8→O9 M2, M3, M5→M4, M5, M6 F5 O5 M2,M4,M6 8 18, 20, 22 Before F10,F11 F6 O6 M1,M2,M4 20, 22, 18 Before F10,F11 F8 O10 O MM1, M,M2, M,M3, M,M6 25,14, 28, 16, 20 14, 18 F 7 3 4 5 6 Before F ,F 7 O O M ,M ,M M ,M ,M 11, 10, 9 10, 12, 8 8 9 O11 8→ 9 M2, M2 4, 3M5 5→ 4 5 6 15, 17, 19→ F9 F8 O10 M1,M2,M3,M6 25, 28, 20 O12 O11 MM1, M2,M2, 4M,M3, 5M6 20,15, 22, 17, 25, 19 18 F9 O12 M1,M2,M3,M6 20, 22, 25, 18 O13 M2, M3, M5 18, 15, 20 F10 O13 M2,M3,M5 18, 15, 20 F10 O14 O14 MM3, M3,M4, 4M,M6 6 18,18, 20, 20, 15 15 F11 O15 M1,M2,M4,M6 5, 5, 6, 4 F11 O15 M1, M2, M4, M6 5, 5, 6, 4

O2 O3 O13 OR2 JOIN O 4 O14 O 5 O15

S O1 E O6 O10 O7 OR1 JOIN O11

O8 O9 OR3 JOIN

O12

Operation Data {M2,M3,M4} Optional Machines O1 {18,17,15} Processing Time

Figure 1. AnAn example example of a product AND/OR AND/OR network figure. figure.

In thethe figure,figure, the the starting starting point pointS and S and the endingthe ending point pointE are E virtual are virtual nodes, nodes,Oi represents Oi represents the process the node,process and node, the process and the route process between routeOR betweenand JOIN ORsymbolic and JOIN connection symbolic represents connection the optional represents process the routes,optional and process only routes, one of and them only can one be of selected. them can For beexample, selected. For it can example, be chose it can one be of chose the two one routes of the between [O7] and [O8, O9]. Except the optional process route between OR and JOIN, it is necessary to traverse other operation nodes to complete the production of the product. Each operation needs to Mathematics 2020, 8, 1745 5 of 22

Mathematics 2020, 8, 1745 5 of 22 two routes between [O7] and [O8, O9]. Except the optional process route between OR and JOIN, it is necessary to traverse other operation nodes to complete the production of the product. Each chooseoperation an availableneeds to choose processing an available machine. processing For the example machine. in For Figure the1 ,example a feasible in processFigure 1, route a feasible plan forprocess the product route plan is: for the product is: SOMOMOMOMOMOM→→→→→→()()()()()(),,,,,, S (O , M12) (O , M 24) (O , M 34) (O , M 43) (O , M 56) (O , M ) 61 → 1 2 → 2 4 → 3 4 → 4 3 → 5 6 → 6 1 (→→O ,()()()()()MOM,,,,,) (O , OM ) M(O →, OM ) M(O →, M O) M(O →, M O) ME → E → 7 76 → 610 106 → 612 126 → 613 135 → 515 154 → 4 BasedBased on theon expressionthe expression method method of this of flexible this flexib processle process route above, route we above, can describe we can the describe procedure the ofprocedure process planningof process activity planning as shownactivity in as Figure shown2. in Figure 2.

Product design plan

Processing features recognition

Optional operations Analysis of processing Order constraint of of processing features features processing features

Optional processing Order constraint of machines of operations operations

Select processing Select processing Select processing machines of operations operations of features sequence of operations

Process route plan

Figure 2. The procedure of process planning activity. Figure 2. The procedure of process planning activity. 4. Mathematical Model 4. Mathematical Model 4.1. Problem Assumptions and Related Symbol Definitions 4.1. ProblemThe main Assumptions task of process and Related planning Symbol is toDefinitions determine the technical requirements and processing flow ofThe a productmain task from of theprocess rough planning or raw materialis to dete tormine the final the product.technical Inrequirements the environment and processing of flexible productionflow of a product system, from processing the rough methods or raw material and technologies to the final are product. not unique, In the which environment makes aof product flexible haveproduction multiple system, optional processing process routes. methods Products and tec withhnologies flexible are processing not unique, technology which makes include a aproduct variety ofhave manufacturing multiple optional features process (such routes. as planes, Products cylindrical with surfaces, flexible processing holes, etc.). technology Each manufacturing include a featurevariety canof manufacturing be processed byfeatures multiple (such technologies. as planes, Eachcylindrical optional surfaces, processing holes, technology etc.). Each includes manufacturing one or morefeature processing can be processed operations. by Theremultiple may technologies. be sequence constraintsEach optional between processing operations, technology and each includes operation one canor more be processed processing on multiple operations. alternative There processingmay be se machines.quence constraints In other words, between the productoperations, has operationand each selectionoperation flexibility, can be processed processing on machine multiple selection alternative flexibility, processing and operationmachines. sequenceIn other words, selection the flexibility. product Tohas generate operation a complete selection process flexibility, route processing plan, it is necessarymachine selection to make decisionsflexibility, in and these operation three dimensions. sequence Theselection process flexibility. planning To problemgenerate studieda complete in thisprocess paper route mainly plan, refers it is necessary to the optimization to make decisions decision in ofthese the abovethree dimensions. three dimensions The process for some planning optimization proble objects,m studied so as toin obtainthis paper the optimal mainly processrefers to route the plan.optimization In order decision to better of carry the outabove theoretical three dimensions research and for mathematicalsome optimization modeling, objects, it is so assumed as to obtain that thethe followingoptimal process assumptions route shouldplan. In be order satisfied to better in the carry flexible out process theoretical planning research problem and ofmathematical this paper. (1)modeling,Each machineit is assumed can only that process the following one operation assumptions of the productshould atbe asatisfied time; in the flexible process (2)planningThe productproblem can of this only paper. be processed on one machine at a time; (3)(1) Each machine orcan equipment only process can one be usedoperation at the of initial the product moment; at a time; (4)(2) The processingproduct can time only of be each processed operation on isone a fixedmachine constant at a time; value;

Mathematics 2020, 8, 1745 6 of 22

(5) The preparation time of each operation on the machine is included in the processing time, and has no relations to the operation sequence; (6) After an operation of the product is completed on the machine, it is immediately transferred to the machine of the next operation for processing, and the transportation time of the product between different machines is a certain constant value.

The description of the relevant parameters for process planning issues studied in this paper are shown in Table2.

Table 2. The relevant parameter descriptions of the process planning.

Parameter Description H A huge positive number; n Total number of operations; m Total number of processing machines; L Total number of operation combinations; l Alternative process combination number; nl Total operation quantity in the l-th operation combination; j, j1, j2, j0 Operation number; k, k1, k2, k0 Machine number; Olj The j-th operation in l-th optional operation combination; Oljk Process Olj on machine k; Sljk Start time of Oljk; C Completion time of the product; Cljk Completion time of Oljk; tljk Processing time of Oljk; ttrans k k k k Transportation time of the product form machine 1 to machine 2; 1 (2 1 If the l-th operation combination is selected; X = l 0 Otherwise; ( 1 If Olj is processed on machine k; Y = ljk 0 Otherwise; ( 1 If operation j1 is before operation j2; F = j1 j2 0 Otherwise; ( 1 If the machine of the next operation of Oljk is k0, k , k0; T(k, k ) = ∧ 0 0 Otherwise

4.2. Mixed Integer Programming Model for Process Planning Process planning issues generally take the completion time, the production cost, and the minimum number of machine conversions throughout the product processing process of the product as evaluation indicators. In this paper, we select the completion time of the product as the optimization goal:

Xnl Xnl trans f = minC = tljk Xl Yljk + Xl Yljk t T(k, k0) (1) · · · · kk0 · j=1 j=1

The first half of the Formula (1) is the sum of the processing time of the operations on the machine, and the second half is the sum of the time for the product to switch between different machines. Generally, the following constraints needs to be satisfied in the process planning problem: (1) Only one combination of processing operations can be selected for the product:

XL Xl = 1 (2) l=1 Mathematics 2020, 8, 1745 7 of 22

(2) Each operation can only select to be processed on one machine:

Xm Y = 1 l [1, L]; j [1, n ] (3) ljk ∀ ∈ ∀ ∈ l k=1

(3) The completion time of the operation is equal to the sum of start time of the operation and the processing time: C X Y = S X Y + t X Y ljk· lj· ljk ljk· lj· ljk ljk· lj· ljk (4) l [1, L]; j [1, n ]; k [1, m] ∀ ∈ ∀ ∈ l ∀ ∈ (4) The different operations of the product cannot be processed at the same time:       Fj j X S Y S Y + H 1 Fj j + H 1 Y X Y t  1 2 · l·  lj2k2· lj2k2 − lj1k1 · lj1k1  − 1 2  − lj2k2  ≥ l· lj1k1 · lj1k1 1 F X S Y S Y + H F + H 1 Y X Y t (5) − j1 j2 · l· lj1k1 · lj1k1 − lj2k2 · lj2k2 · j1 j2 − lj1k1 ≥ l· lj2k2 · lj2k2 l [1, L]; j , j [1, n ] j , j ; k , k [1, m] ∀ ∈ ∀ 1 2 ∈ l ∧ 1 2 ∀ 1 2 ∈ (5) Machine constraints, each machine can only process one operation at the same time:       Fj j X C Y C Y + H 1 Fj j + H 1 Y X Y t  1 2 · l  lj2k· lj2k − lj1k· lj1k  − 1 2  − lj2k ≥ l· lj2k· lj2k 1 F X C Y C Y + H F + H 1 Y X Y t (6) − j1 j2 · l· lj1k· lj1k − lj2k· lj2k · j1 j2 − lj1k ≥ l· lj1k· lj1k l [1, L]; j , j [1, n ] j , j ; k [1, m] ∀ ∈ ∀ 1 2 ∈ l ∧ 1 2 ∀ ∈ (6) The start and completion time of all operations are non-negative numbers:

S X Y 0 ljk· lj· ljk ≥ C X Y 0 (7) ljk· lj· ljk ≥ l [1, L]; j [1, n ]; k [1, m] ∀ ∈ ∀ ∈ l ∀ ∈ (7) Process sequence constraint, the completion time of the preceding ones of the operation are greater than the start time of the operation:   C X Y S X Y F 0 j1k1 · j1 · j1k1 − j2k2 · j2 · j2k2 · j1 j2 ≥ (8) j , j [1, n ] j , j ; k , k [1, m] ∀ 1 2 ∈ l ∧ 1 2 ∀ 1 2 ∈ (8) In a process route plan, there is only one sequence between two different operations:   F + F X 1 j1 j2 j2 j1 · l ≤ (9) l [1, L]; j , j [1, n ] j , j ∀ ∈ ∀ 1 2 ∈ l ∧ 1 2 5. Algorithm Design For a complex product, the number of manufacturing features, the number of optional operation combinations for each manufacturing feature, and the number of optional machines for each operation is large. Different operation selection, operation sequence selection and machine selection combinations can form a large number of different processes route. In recent years, a variety of heuristic algorithms have been applied to the research of solving process planning problems and achieved some nice results. However, each algorithm has its advantages and disadvantages, and using a certain heuristic algorithm alone will inevitably suffer from performance limitations. Combining a variety of algorithms according to the characteristics of the problem to be solved, and complementing each other to form a hybrid optimization algorithm is an effective way to improve the performance of the optimization algorithm [21]. In many research fields, hybrid algorithms have been widely used and proved their superiority. PSO and GA are two very widely used algorithms, and they also show Mathematics 2020, 8, 1745 8 of 22

5. Algorithm Design For a complex product, the number of manufacturing features, the number of optional operation combinations for each manufacturing feature, and the number of optional machines for each operation is large. Different operation selection, operation sequence selection and machine selection combinations can form a large number of different processes route. In recent years, a variety of heuristic algorithms have been applied to the research of solving process planning problems and achieved some nice results. However, each algorithm has its advantages and disadvantages, and using a certain heuristic algorithm alone will inevitably suffer from performance limitations. Combining a variety of algorithms according to the characteristics of the problem to be solved, and complementing each other to form a hybrid optimization algorithm is an effective way to improve the performance of the optimization algorithm [21]. In many research fields, hybrid algorithms have been widely used and proved their superiority. PSO and GA are two very widely used metaheuristic Mathematics 2020, 8, 1745 8 of 22 algorithms, and they also show good performance in the optimization of process planning problems. This paper will use a hybrid particle swarm algorithm combining PSO and GA to solve the process goodplanning performance problem. in the optimization of process planning problems. This paper will use a hybrid particle swarm algorithm combining PSO and GA to solve the process planning problem. 5.1. Encoding and Decoding Methods 5.1. Encoding and Decoding Methods To use the HPSO algorithm to solve the process planning, the coding of the process route plan mustTo be use realized the HPSO before algorithm the algorithm to solve can the be processtransformed planning, into thea co codingmputer ofprogram. the process In view route of plan the mustfact that be realized the HPSO before algorithm the algorithm in this can bepaper transformed uses genetic into a computeroperations program. to update In view particles, of the factthe thatchromosome the HPSO encoding algorithm method in this paperof GA uses can genetic be considered operations to toencode update the particles, feasible the solution chromosome of the encodingproblem, methodso as to of realize GA can the be expression considered toof encodethe process the feasible route solutionplan. In ofthe the GA, problem, the coding so as to method realize thedetermines expression the of arrangement the process route of the plan. genes In the in GA,the thechromosome coding method and determinesthe decoding the arrangementmethod that oftransforms the genes thein thegenes chromosome in the chromosome and the decoding into an method effective that solution transforms to the the problem. genes in theIn addition, chromosome the intocoding an emethodffective has solution played to a the decisive problem. role In in addition, the operation the coding methods method of genetic has played operation a decisive operators role insuch the as operation crossover methods operators of geneticand mutation operation operators operators to a such large as extent. crossover Generally operators speaking, and mutation in the operatorsoperation toof agenetic large extent. algorithm, Generally the main speaking, link inthat the affects operation the ofefficiency genetic algorithm,of the algorithm the main is linkthe thatcalculation affects thespeed effi ofciency the genetic of the algorithmoperator. Therefore, is the calculation designing speed a coding of the method genetic operator.that is conducive Therefore, to designinggenetic operations a coding methodis the key that to isimproving conducive the to geneticefficiency operations of the algorithm is the key in to this improving paper. theThrough efficiency the ofstudy the on algorithm the related inthis literature paper. of Through process planning, the study it on is thefound related that two literature representative of process coding planning, methods it is foundare widely that twoused. representative coding methods are widely used. (1) The The integrated integrated coding coding method, method, as as shown shown in Fi ingure Figure 3. This3. This method method is a coding is a coding method method based basedon the onoperation. the operation. The operation The operation number number and the and machine the machine number number are integrated are integrated into a into . a gene. The Theposition position of the of thegene gene indicates indicates the the processing processing sequence sequence of of the the oper operation.ation. The The operation operation that that appears in the chromosome indicatesindicates thatthat the process is selected by the current process plan, otherwise, mean that the operationoperation isis notnot selectedselected byby thethe currentcurrent routingrouting scheme.scheme.

Code of operation 1,14 2,15 3,15 4,12 5,13 6,12 7,11 8,8

Code of mechaine Figure 3. An examples of integrated codingcoding methods for process planning.

(2) TheThe hierarchical hierarchical coding coding method, method, as shownas shown in Figure in Figure4, represents 4, represents a process a planning process encodingplanning sampleencoding of thesample product of the in Figureproduct1. Thisin Figure method 1. isTh ais coding method method is a coding based onmethod product based manufacturing on product features,manufacturing using threefeatures, digital using sequences three digital to map sequences three-dimensional to map decision-makingthree-dimensional schemes decision-making in process planning.schemes in The process first layerplanning. of coding The first is a featurelayer of sequence,coding is eacha feature number sequence, in the sequenceeach number represents in the thesequence product represents manufacturing the product feature manufacturing number, and fe theature position number, of theand number the position represents of the the number order ofrepresents product manufacturingthe order of features.product Themanufacturing second layer features. code is the The process second sequence, layer thecode length is theof theprocess code issequence, the same the as the length feature of sequence,the code is the the number same inas the the sequence feature sequence, indicates the the processing number in process the sequence number selected by the product manufacturing feature at the corresponding position, and the second layer code can be decoded to obtain selection scheme of the operations in the process route of the product. The third layer of code is the machine sequence, the length of the code is the same as the number of all optional operations of the product, and each number indicates the sort number of the machine among the candidate machines for which the corresponding operation can select, not the machine number. Except for the first layer of feature sequence, this encoding method is an indirect encoding method, and its decoding complexity is higher than that of direct encoding. The advantage of this coding method is that the length of the chromosomes is the same, and each layer of coding is relatively independent, which is convenient for genetic operations; it can reduce the generation of illegal solutions after genetic operations to a certain extent; the three layer code correspond to the three-dimensional decision-making of process planning, which can better express the characteristics of the problem. However, this coding method is more complicated than the integrated method, and the chromosome information is not intuitive enough; the decoding method of process sequence and machine sequence is more difficult, Mathematics 2020, 8, 1745 9 of 22

Mathematicsindicates 2020the, 8processing, 1745 process number selected by the product manufacturing feature 9at of the22 corresponding position, and the second layer code can be decoded to obtain selection scheme of the indicates the processing process number selected by the product manufacturing feature at the operations in the process route of the product. The third layer of code is the machine sequence, the corresponding position, and the second layer code can be decoded to obtain selection scheme of the length of the code is the same as the number of all optional operations of the product, and each operations in the process route of the product. The third layer of code is the machine sequence, the number indicates the sort number of the machine among the candidate machines for which the length of the code is the same as the number of all optional operations of the product, and each corresponding operation can select, not the machine number. Except for the first layer of feature number indicates the sort number of the machine among the candidate machines for which the sequence, this encoding method is an indirect encoding method, and its decoding complexity is corresponding operation can select, not the machine number. Except for the first layer of feature higher than that of direct encoding. The advantage of this coding method is that the length of the sequence, this encoding method is an indirect encoding method, and its decoding complexity is chromosomes is the same, and each layer of coding is relatively independent, which is convenient for higher than that of direct encoding. The advantage of this coding method is that the length of the genetic operations; it can reduce the generation of illegal solutions after genetic operations to a certain chromosomes is the same, and each layer of coding is relatively independent, which is convenient for extent; the three layer code correspond to the three-dimensional decision-making of process genetic operations; it can reduce the generation of illegal solutions after genetic operations to a certain planning, which can better express the characteristics of the problem. However, this coding method extent; the three layer code correspond to the three-dimensional decision-making of process is more complicated than the integrated method, and the chromosome information is not intuitive planning, which can better express the characteristics of the problem. However, this coding method Mathematicsenough; the2020 decoding, 8, 1745 method of process sequence and machine sequence is more difficult, which9 of 22 is more complicated than the integrated method, and the chromosome information is not intuitive reduces the calculation efficiency of individual function, which is also a prominent enough; the decoding method of process sequence and machine sequence is more difficult, which shortcoming of this coding method. reduceswhich reducesthe calculation the calculation efficiency efficiency of individual of individual fitness fitness function, function, which which is isalso also a aprominent prominent shortcomingshortcoming of of this this coding coding method. method. Feature sequence 5 3 1 4 8 7 6 9 FeatureProcess sequence sequence 51 32 11 43 82 71 61 92 MachineProcess sequence sequence 12 23 14 33 21 12 15 21 1 5 2 4 5 2 3

Machine sequence 2 3 4 3 1 2 5 1 1 5 2 4 5 2 3 Figure 4. An example of hierarchical coding method for process planning problems. FigureFigure 4. 4. AnAn example example of of hierarchical hierarchical coding coding me methodthod for for process process pl planninganning problems. problems. Combining the advantages of the above two coding methods, a new coding method for process planning is designed in this paper. This method draws on the hierarchical representation principle CombiningCombining the the advantages advantages of of the the above above two two codi codingng methods, methods, a a new new coding coding method method for for process process of the hierarchical coding method, and directly encodes based on the information of each candidate planningplanning is is designed designed in in this this paper. paper. This This method method draws draws on on the the hierarchical hierarchical representation representation principle principle processing operation of the product, which can be regarded as a combination of the integrated coding ofof the the hierarchical hierarchical coding coding method, method, and and directly directly en encodescodes based based on on the the information information of of each each candidate candidate method and the hierarchical coding method. The coding method in this paper divides the coding of processingprocessing operation operation of of the the product, product, which which can can be be regarded regarded as as a a combination combination of of the the integrated integrated coding coding process plan into three layers the same as the hierarchical coding method, but the digital sequence of methodmethod and and the the hierarchical hierarchical coding coding method. method. The The coding coding method method in inthis this paper paper divides divides the thecoding coding of each layer adopts the form of direct coding, and the process route information expressed is also processof process plan plan into into three three layers layers the thesame same as the as thehier hierarchicalarchical coding coding method, method, but butthe thedigital digital sequence sequence of different to a certain extent. The three layers of coding are operation layer, machine layer, and logic eachof each layer layer adopts adopts the the form form of ofdirect direct coding, coding, an andd the the process process route route information information expressed expressed is is also also layer, which correspond to the three dimensions of operation sequence selection, operation machine differentdifferent to to a a certain certain extent. extent. The The three three layers layers of of co codingding are are operation operation layer, layer, machine machine layer, layer, and and logic logic selection, and operation selection in process planning. Figure 5 is an example of the new coding layer,layer, which which correspond correspond to to the the three three dimensions dimensions of of operation operation sequence sequence selection, selection, operation operation machine machine method, from which the process route plan of the product can be obtained more intuitively. In Figure selection,selection, and and operation operation selection selection in in process process planning. planning. Figure Figure 55 isis an an example of the new coding 6, the first layer of the code is the operation layer, the codes represent all the optional operation method,method, from from which which the the process process route plan of the productproduct cancan bebe obtainedobtained moremore intuitively. intuitively. In In Figure Figure6, numbers of the product, and the positions of the number indicate the processing sequence of the 6,the the first first layer layer of theof the code code is the is operationthe operation layer, la theyer, codes the representcodes represent all the optionalall the optional operation operation numbers operations; the second layer of the code is the machine layer, and the codes indicate the processing numbersof the product, of the andproduct, the positions and the positions of the number of the indicate number the indicate processing the processing sequence ofsequence the operations; of the machine number selected by the operation corresponding to the position of the first layer; the third operations;the second layerthe second of the codelayer is of the the machine code is layer, the machine and the codeslayer, indicateand the thecodes processing indicate machine the processing number layer of the code is the logic layer, the code 1 indicates that the operation corresponding to the machineselected number by the operation selected correspondingby the operation to correspondi the positionng of theto the first position layer; the of the third first layer layer; of the the code third is position of the first layer is selected by the process route plan, the code 0 indicates that the layerthe logic of the layer, code the is code the 1logic indicates layer, that the the code operation 1 indicates corresponding that the operation to the position corresponding of the first layerto the is corresponding operation is not selected, to express the selection of the operations for the process positionselected byof thethe processfirst layer route is plan, selected the code by 0the indicates process that route the correspondingplan, the code operation 0 indicates is not that selected, the route. correspondingto express the selectionoperation of is the not operations selected, forto express the process the route.selection of the operations for the process route. Operation layer 1 5 4 6 2 3 7 8 9 12 11 10 14 15 13 Operation layer Machine layer 13 56 44 61 24 32 76 85 95 121 112 103 143 152 133

MachineLogic layer layer 31 61 41 11 41 21 60 51 51 10 21 31 31 21 30

LogicFigure layer 5.1An examples1 1 1 of new1 coding1 0 methods1 1 designed0 1 in this1 article.1 1 0 Figure 5. An examples of new coding methods designed in this article. The decodingFigure method 5. An of thisexamples encoding of new method coding is methods very simple. designed It only in this needs article. to read the information of each operation according to the operation layer of the chromosome and delete the ones with a code ‘0’ in the logic layer to form the process route plan of the product. The code shown in Figure6 can be decoded into the following process route:

(O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) 1 3 → 5 6 → 4 4 → 6 1 → 2 4 → 3 2 → (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) 8 5 → 9 5 → 11 2 → 10 3 → 14 3 → 15 2 Mathematics 2020, 8, 1745 11 of 22

Step 4: Determine whether the algorithm termination condition is satisfied, if so, output the calculation result; otherwise, execute the next step and increase the number of iterations, gen = gen + 1; Step 5: Random crossover. Cross the particle Indi(i) with other random particles Indi(r), and calculate the fitness value RC_fit(i) of the offspring RC_Indi(i) which is generated by the crossover operation. If a particle with better fitness is obtained, that is, RC_fit(i) is better than fit(i), set Indi(i) = RC_Indi(i), and execute the next step after updating the current particle; otherwise, execute the next step directly; Step 6: Optimal crossover. Cross the particle Indi(i) with the group extreme particle Indi(Gbest), and calculate the fitness value GC_fit(i) of the offspring GC_Indi(i) which is generated by crossover operation. If a particle with better fitness is obtained, that is, GC_fit(i) is better than fit(i), set Indi(i) = GC_Indi(i), and execute the next step after updating the current particle; otherwise, execute the next step directly; Step 7: Mutation operation, the offspring generated by the mutation operation of particle Indi(i) is M_Indi(i), if a particle with better fitness is obtained, that is, M_fit(i) is better than fit(i), so that MathematicsIndi(i2020) = M_Indi, 8, 1745 (i), jump to Step 3 after updating the current particle; otherwise, jump directly10 of 22 to Step 3.

Start Random crossover Optimal crossover

Particle swarm Update particles Update particles initialization

No Better Better No Fitness value Crossover individual individual calculation Yes Yes Update particles Update particles Update extreme value Next operation Next operation Update particles

Fitness value Better Update Termination Mutation No calculation individual Yes particles

Yes No Next operation End

FigureFigure 6. TheThe process process framework framework of of the the improved improved hy hybridbrid particle particle swarm swarm optimization optimization (HPSO) (HPSO) algorithmalgorithm for for pr processocess planning. 5.2. Hybrid Particle Swarm Optimization Algorithm for Process Planning 5.3. Algorithm Details Through the basic principles of the standard PSO, it can be found that the updates for the velocity The key modules of the algorithm will be explained in this part. and position of the particles are according to some specific formulas. Each particle in the algorithm is set as an R-dimensional vector X = (X , X , X , ... , X )T. The components X of the vector are 5.3.1. Particle Swarm Initializationi i1 i2 i3 iR ir independent of each other, and there is no sequence constraint between them. According to the velocity and positionSolutions update that do formulas not conform of the PSO,to the it issequence not diffi cultconstraints to find thatof the the standardproduct’s PSOmanufacturing is designed featuresfor the continuous are called optimizationinfeasible solutions problem, or and illegal each solutions. component InX their of random the particle initialization changes continuously. process of particleAlthough swarms some and kinds subsequent of discrete mutation particle operation, swarm optimization it is inevitable (DPSO) to generate algorithms infeasible were solutions. proposed Therefor solving are many discrete ways optimization to deal with problems, infeasible andsolutions, some newsuch velocity as directly and deleting position infeasible of particles solutions, update usingformulas penalty were functions, designed, and most transforming DPSO algorithms feasible do solutions not fully and consider so on. the In specificthis paper, characteristics a feasible solutionof discrete transformation combination optimizationmethod proposed problems in the (such literature as the order[5]—the constraints constraint between adjustment the components method is usedvector to of adjust particle, the infeasible etc.). As a solution result, the to make algorithm it a feasible search solution. efficiency is not high and there is a certain degree of redundant expression [22]. In a typical flexible process planning problem, the sequence constraints between operations need to be satisfied, and the update method for velocity and position of the particles in the PSO algorithm needs to be redesigned. In some classical discrete optimization problems, hybrid algorithms combining PSO and GA have been applied. This method abandons the velocity and position update model, and uses crossover and mutation operations of GA to update the particles. Li et al. [2] applied this method to the optimization of process planning problems, constructed a memory population in the iteration process to record the optimal position of particles which are in the population, and used a series of genetic operation operators and random search operator replaces the position and velocity update formula of the PSO. Adopting other methods to update the particles instead of the velocity and position update model in the standard PSO algorithm is a common method of HPSO. A large number of studies have shown that designing a particle update method that is more in line with the characteristics of the optimization problem can effectively improve the search performance of the PSO. From what has been discussed above, we improve the coding method and genetic operator of the hybrid algorithm of PSO and GA, and applies it to the optimal solution of process planning problems in this article. According to the characteristics of the process planning problem, a new coding Mathematics 2020, 8, 1745 11 of 22 method is designed to express different process route schemes, which makes the decoding process easier and improves the efficiency of the algorithm; in the crossover operation, two paired crossover methods of individual random crossover and group optimal crossover are used to update the particle position, in order to further enhance the search performance of the algorithm. The main process framework of the improved HPSO algorithm proposed in this paper is shown in Figure6. The steps of the hybrid particle swarm optimization algorithm are as follows: Step 1: According to the problem, generate the initial population Initial_Pop according to a certain method, so that each particle Indi(i) is a feasible solution, the number of initialization iterations gen = 0, and the population size is N, where i = 1, 2, ... , N; Step 2: Calculate the fitness fit(i) of each particle in the population according to the objective function of the problem; Step 3: Update the individual extreme value Pbest(i) and the group extreme value Gbest according to the fitness value of the particles; Step 4: Determine whether the algorithm termination condition is satisfied, if so, output the calculation result; otherwise, execute the next step and increase the number of iterations, gen = gen + 1; Step 5: Random crossover. Cross the particle Indi(i) with other random particles Indi(r), and calculate the fitness value RC_fit(i) of the offspring RC_Indi(i) which is generated by the crossover operation. If a particle with better fitness is obtained, that is, RC_fit(i) is better than fit(i), set Indi(i) = RC_Indi(i), and execute the next step after updating the current particle; otherwise, execute the next step directly; Step 6: Optimal crossover. Cross the particle Indi(i) with the group extreme particle Indi(Gbest), and calculate the fitness value GC_fit(i) of the offspring GC_Indi(i) which is generated by crossover operation. If a particle with better fitness is obtained, that is, GC_fit(i) is better than fit(i), set Indi(i) = GC_Indi(i), and execute the next step after updating the current particle; otherwise, execute the next step directly; Step 7: Mutation operation, the offspring generated by the mutation operation of particle Indi(i) is M_Indi(i), if a particle with better fitness is obtained, that is, M_fit(i) is better than fit(i), so that Indi(i) = M_Indi (i), jump to Step 3 after updating the current particle; otherwise, jump directly to Step 3.

5.3. Algorithm Details The key modules of the algorithm will be explained in this part.

5.3.1. Particle Swarm Initialization Solutions that do not conform to the sequence constraints of the product’s manufacturing features are called infeasible solutions or illegal solutions. In the random initialization process of particle swarms and subsequent mutation operation, it is inevitable to generate infeasible solutions. There are many ways to deal with infeasible solutions, such as directly deleting infeasible solutions, using penalty functions, and transforming feasible solutions and so on. In this paper, a feasible solution transformation method proposed in the literature [5]—the constraint adjustment method is used to adjust the infeasible solution to make it a feasible solution. In order to obtain the initial population quickly, the method of randomly initializing the particle swarm is adopted in this article. The specific steps are as follows: Step 1: Generate a digital sequence from 1 to n as the original code of the operation layer of the particle (chromosome), where n is the total number of optional operations for the product; Step 2: According to the process information table, select the available processing machines randomly for each operation to form the machine sequence as the original code of the machine layer; Step 3: According to the optional process of the product’s manufacturing features, randomly select one operation combination that satisfies the product completion condition (or adopt the Mathematics 2020, 8, 1745 12 of 22

diagram traversal method to randomly generate the operation combination that satisfies completion condition of the product according to the AND/OR diagram), and generate 0–1 digital sequence as the original code of the logic layer; Step 4: Combine the above three layers of codes to form a 3 n coding matrix; × Step 5: Generate a random sequence, and sort the above coding matrix according to the random sequence in units of columns; Step 6: Use the constraint adjustment method in the literature [5] to adjust the operation sequence that does not satisfy the constraint conditions of the product’s manufacturing feature sequence to make it a feasible solution; Step 7: If the size of the particle swarm is N, repeat the above step N times to obtain the initial particle swarm.

The above steps can be described by the following pseudo code, POP represents population, Indi represents individual, N represents population size, ON represents number of operations, {OS} represents combination of optional operation, {JM} represents set of optional machines, {COO} represents constraints matrix set of the operations, LO represents the operation layer code, LM represents the machine layer code, LL represents the logic layer code, and M(j) represents the machine selected by operation j.

Generate Initial Population 1 Input: N, ON,{OS}, {JM}, {COO} 2 Output: Initial POP 3 Set Initial POP = {Φ} 4 For n = 1 to N do 5 LO = [Φ], LM = [Φ], LL = [Φ], M(j) = [Φ] 6 LO = ones*(1 to ON) 7 For j = 1 to ON do 8 M(j) = rand(JM(j)) 9 End For 10 LM = [LM, M(j)] 11 Index_L = rand (OS(i)) 12 LL = zeros(1,ON) 13 LL (Index_L)= = 1 14 Temp_Indi (n) = [LO;LM;LO] 15 Index_Total(n) = randperm(TN) 16 Indi(n) = Temp_Indi (n)(Index_Total(n)) 17 if Indi(n) {COO} illegal solution → → 18 run Constraint Adjustment function 19 Indi(n) {COO} feasible solution → → 20 End if 21 Initial POP = {Initial POP; Indi(n)} 22 End For

5.3.2. Crossover Operators In the crossover operation, each column of the chromosome serves as the basic unit of position transformation. When the position of any gene in a column changes, all genes in the column undergo the same position change. In this paper, three separate crossover operators are designed respectively for the operation layer, machine layer and logic layer, and iteratively searched from three different dimensions. The specific operations are as follows. Mathematics 2020, 8, 1745 13 of 22

5.3.2. Crossover Operators In the crossover operation, each column of the chromosome serves as the basic unit of position transformation. When the position of any gene in a column changes, all genes in the column undergo the same position change. In this paper, three separate crossover operators are designed respectively Mathematics 2020, 8, 1745 13 of 22 for the operation layer, machine layer and logic layer, and iteratively searched from three different dimensions. The specific operations are as follows. (1) Operation layer layer crossover. crossover. The The crossover crossover for for the the operation operation layer layer adopts adopts a method a method similar similar to toOX OX (order (order crossover) crossover) that that can can avoid avoid generating generating infeasible infeasible offspring offspring individuals. individuals. Figure Figure 7 shows7 shows an anexample example of crossover of crossover for forthe the operation operation layer. layer.

pos1 pos2 P1 1 5 4 6 2 3 7 8 9 12 11 10 14 15 13

O1 1 5 4 8 9 7 2 3 6 12 11 10 14 15 13

P2 1 8 9 7 10 2 4 3 6 5 13 15 14 11 12

Figure 7. An example of crossover for operation layer.

The steps of crossover for operation layer:layer:

Step 1:1: SelectSelect two two parent parent individuals, individuals, extract extract the the operation operation layer, layer, and record it as P1 and P2; Step 2:2: MarkMark the the gene gene whose whose logical logical layer layer code code is is 1 1 in in P1 P1 or or P2 P2 (gray (gray in in the the figure); figure); Step 3:3: SelectSelect two two intersection intersection points points randomly, randomly, record them as pos1 and pos2 from left to right; Step 4:4: Copy the genes on the left side of pos1 and the right side of pos2 in P1 to the ooffspringffspring individualindividual O1O1; ; Step 5:5: MarkMark the the same same genes genes in in P2P2 whichwhich are are copied copied from from P1P1 toto O1O1;; Step 6: Insert the genes in P2 that are different from those in O1 into the vacancy of O1 in order; Step 6: Insert the genes in P2 that are different from those in O1 into the vacancy of O1 in order; Step 7: According to the mark in Step 2, adjust the logic layer of O1, make the selection of operations Step 7: According to the mark in Step 2, adjust the logic layer of O1, make the selection of operations for O1 the same as P1 or P2, to get the offspring O1 after crossover. for O1 the same as P1 or P2, to get the offspring O1 after crossover. (2) Machine layer crossover. The crossover for the machine layer adopt an operator similar to (2) Machine layer crossover. The crossover for the machine layer adopt an operator similar to SEX SEX (Subtour Exchange Crossover). Figure 8 shows an example of crossover for machine layer. (Subtour Exchange Crossover). Figure8 shows an example of crossover for machine layer. MathematicsThe steps 2020, of8, 1745 crossover for machine layer: 14 of 22 Step 1: Select two parent individuals, extract the operation layer and the machine layer, and record 1 2 4 5 3 6 Operation layer them as P1 and P2P1; Step 2: Copy P1 as O1; 2 1 5 1 2 3 Machine layar Step 3: Select several operations in P1 randomly to conduct the crossover for machine layer (gray in the figure), and mark the1 same2 genes4 in P2 5which3 are selected6 Operation previously layer in P1; O1 Step 4: Replace the machine 3layer co1 de of4 the selected1 2operations5 Machine in O1 with layer the machine layer code of the same operation in P2, to get the offspring O1.

1 3 6 5 4 2 Operation layer P2 3 2 5 3 4 1 Machine layer

FigureFigure 8.8. AnAn exampleexample ofof crossovercrossover forfor machinemachine layer.layer.

The(3) Logic steps oflayer crossover crossover. for machine The logical layer: layer crossover operator is similar to the machine layer Stepcrossover, 1: Select but two the parentoperations individuals, of the product extract needs the operation to be segmented layer and before the machine crossover. layer, According and record to the productthem process as P1 and informationP2; table, find the manufacturing features with flexible processes, and Stepsegment 2: Copy the operationsP1 as O1; belonging to these manufacturing features according to different ones. An example of crossover for logical layer is shown in Figure 9, the operations of the same color belong Step 3: Select several operations in P1 randomly to conduct the crossover for machine layer (gray to the same manufacturing feature in the figure. in the figure), and mark the same genes in P2 which are selected previously in P1; Step 4: Replace the machine layer code of the selected operations in O1 with the machine layer code 1 5 4 6 2 3 7 8 9 12 11 10 14 15 13 Operation layer of the sameP1 operation in P2, to get the offspring O1. 1 1 1 1 1 1 0 1 1 0 1 1 1 1 0 Logic layer (3) Logic layer crossover. The logical layer crossover operator is similar to the machine layer crossover, but the operations1 5 4 6 of2 the3 product7 8 needs9 12 11 to be10 segmented14 15 13 Operation before crossover. layer According O1 1 1 1 1 1 1 1 0 0 0 1 1 0 1 1 Logic layer Extract and Replace transform sort 7 8 9 14 13 1 0 0 0 1

1 8 9 7 10 2 4 3 6 5 13 15 14 11 12 Operation layer P2 1 0 0 1 1 1 1 1 1 1 1 1 0 1 0 Logic layer

Figure 9. An example of crossover for logic layer.

The steps of crossover for logic layer: Step 1: Select two parent individuals, extract the operation layer and logic layer, and record them as P1 and P2; Step 2: Copy P1 as O1; Step 3: Select one or more flexible operation segments of manufacturing features to be crossed. In the example, the first operation segment (7, 8, 9) belonging to a feature and the third operation segment (13, 14) belonging to another feature are selected; Step 4: Extract operation genes which are selected for crossover in Step3 from P2, and reorder them to make the sequence of these operations consistent with the sequence in P1; Step 5: Use the logic layer code after reorder which are extracted from P2 in Step 4 to replace the corresponding logic layer code in O1, to obtain the offspring O1 after crossover.

5.3.3. Mutation Operators Generally, the mutation operation determines the local search performance of the genetic algorithm, and it cooperates with the crossover operation with global search capability to jointly complete the optimization process of the optimization problem. The same is true in the hybrid PSO algorithm of this article. In the mutation operation, like the crossover operation, when the position of

Mathematics 2020, 8, 1745 14 of 22

1 2 4 5 3 6 Operation layer P1 2 1 5 1 2 3 Machine layar

1 2 4 5 3 6 Operation layer O1 3 1 4 1 2 5 Machine layer

1 3 6 5 4 2 Operation layer P2 3 2 5 3 4 1 Machine layer

Figure 8. An example of crossover for machine layer. Mathematics 2020, 8, 1745 14 of 22 (3) Logic layer crossover. The logical layer crossover operator is similar to the machine layer crossover, but the operations of the product needs to be segmented before crossover. According to tothe the product product process process information information table, table, find find the themanufacturing manufacturing features features with with flexible flexible processes, processes, and andsegment segment the operations the operations belonging belonging to these to these manufact manufacturinguring features features according according to different to different ones. ones. An Anexample example of crossover of crossover for for logical logical layer layer is isshown shown in in Figure Figure 9,9 ,the the operations operations of the same colorcolor belongbelong to the same manufacturing featurefeature inin thethe figure.figure.

1 5 4 6 2 3 7 8 9 12 11 10 14 15 13 Operation layer P1 1 1 1 1 1 1 0 1 1 0 1 1 1 1 0 Logic layer

1 5 4 6 2 3 7 8 9 12 11 10 14 15 13 Operation layer O1 1 1 1 1 1 1 1 0 0 0 1 1 0 1 1 Logic layer Extract and Replace transform sort 7 8 9 14 13 1 0 0 0 1

1 8 9 7 10 2 4 3 6 5 13 15 14 11 12 Operation layer P2 1 0 0 1 1 1 1 1 1 1 1 1 0 1 0 Logic layer

Figure 9. An example of crossover for logic layer.

The steps of crossover for logiclogic layer:layer: Step 1:1: SelectSelect two two parent parent individuals, individuals, extract extract the the operation operation layer layer and and logic logic layer, layer, and record them as P1 P1andand P2;P2 ; Step 2:2: CopyCopy P1P1 asas O1O1;; Step 3:3: SelectSelect one one or or more more flexible flexible operation operation segmen segmentsts of manufacturing of manufacturing features features to be crossed. to be crossed. In the example,In the the example, first operation the first operationsegment (7, segment 8, 9) belonging (7, 8, 9) belongingto a feature to and a feature the third and operation the third segmentoperation (13, 14) segment belonging (13, 14) to belonginganother feature to another are selected; feature are selected; Step 4:4: ExtractExtract operation operation genes whichwhich areare selectedselected for for crossover crossover in inStep3 Step3from fromP2 P2, and, and reorder reorder them them to to makemake the the sequence sequence of of these these operatio operationsns consistent consistent with with the the sequence sequence in P1;; Step 5:5: Use the the logic logic layer layer code code after after reorder reorder which which are are extracted extracted from from P2 P2in Stepin Step 4 to 4 replace to replace the correspondingthe corresponding logic layer logic code layer in code O1, into O1obtain, to obtainthe offspring the offspring O1 afterO1 crossover.after crossover.

5.3.3. Mutation Operators Generally, the mutation operation determines the local search performance of the genetic algorithm, and it cooperates with the crossover operation with global search capability to jointly complete the optimization process of the optimizationoptimization problem. The same is true in the hybrid PSO algorithm of this article. article. In In the the mutation mutation operation, operation, like like the the crossover crossover operation, operation, when when the the position position of of any gene in a column changes, all genes in the column undergo the same position change. In the following mutation operations for the three-layer codes, only the operation layer mutation will change the positions of genes. In addition, the operation layer variation may produce infeasible solutions, which need to be converted into feasible solutions by using the constraint adjustment method. The three mutation operators designed for different dimensions are as follows. (1) Operation layer mutation. An exchange mutation (EM) method is adopted to exchange the positions of the operations. An example of mutation for operation layer is shown in Figure 10. Mathematics 2020, 8, 1745 15 of 22

any gene in a column changes, all genes in the column undergo the same position change. In the following mutation operations for the three-layer codes, only the operation layer mutation will change the positions of genes. In addition, the operation layer variation may produce infeasible solutions, which need to be converted into feasible solutions by using the constraint adjustment method. The three mutation operators designed for different dimensions are as follows. (1) Operation layer mutation. An exchange mutation (EM) method is adopted to exchange the positions of the operations. An example of mutation for operation layer is shown in Figure 10.

pos1 pos2 P 1 5 4 6 2 3 7 8 9 12 11 10 14 15 13

Mathematics 2020, 8, 1745 15 of 22 O 1 5 4 6 2 12 7 8 9 3 11 10 14 15 13 any gene in a column changes, all genes in the column undergo the same position change. In the following mutation operationsFigure for 10. theAn examplethree-laye of mutationr codes, foronly operation the operation layer. layer mutation will change the positions of genes. In addition, the operation layer variation may produce infeasible The steps of mutation for operation layer: solutions, which need to be converted into feasible solutions by using the constraint adjustment method.Step 1: SelectThe three one mutationparent individual, operators extr designedact the for operation different layer, dimensions and record are itas as follows. P; Step 2: Copy P as O; Mathematics(1) Operation2020, 8, 1745 layer mutation. An exchange mutation (EM) method is adopted to exchange15 the of 22 positionsStep 3: Within of the operations.the length range An example of O, select of mutati two mutationon for operation positions layer pos1 is andshown pos2 in randomly;Figure 10. Step 4: Exchange the positions of genes in pos1 and pos2 of O; Step 5: Check that whether the operationpos1 sequence posafter2 mutation satisfies the constraint requirementsP of1 manufacturing5 4 6 fe2ature.3 If 7the constraint8 9 12 cond11itions10 are14 met,15 the13 offspring O after the mutation is obtained; otherwise, convert it into a feasible solution by using the constraint adjustment method to obtain the offspring O after the mutation. (2) MachineO layer1 5mutation.4 6 A single-point2 12 7 mutation8 9 3(SPM)11 method10 14 is15 adopted13 to randomly

select a position in the machine layer code for mutation. An example of mutation for machine layer Figure 10. An example of mutation for operation layer. is shown in Figure 11. Figure 10. An example of mutation for operation layer. The steps of mutation for machine layer: TheThe steps steps of of mutation mutation for for operation operation layer: layer: Step 1: Select one parent individual, extract the machine layer, and record it as P; StepStep 1: 1: SelectSelect one one parent parent individual, individual, extr extractact the the operation operation layer, layer, and and record record it it as as PP; ; Step 2: Copy P as O; StepStep 2: 2: CopyCopy P Pasas OO; ; Step 3: Within the length range of O, randomly select a mutation position pos whose logic layer code Step 3: Within the length range of OO, select two mutation positions pos1pos1 and pos2pos2 randomly; Step 3:is notWithin 0, and the record length the range machine of , selectnumber two as mutation k before positionsmutation; and randomly; Step 4: Exchange the positions of genes in pos1 and pos2 of O; StepStep 4: 4: ExchangeRead the optional the positions machine of genes set M in(j)pos1 of operationand pos2 j ofwhichO; is on the position selected in Step 3; Step 5: Check that whether the operation sequence after mutation satisfies the constraint StepStep 5: 5: IfCheck there that are whethermultiple thecandidate operation machines sequence in afterM(j), mutationselect other satisfies machine the randomly constraint in requirements M(j) whose requirements of manufacturing feature. If the constraint conditions are met, the offspring O after serialof manufacturing number are not feature. equal Ifto the k to constraint replace the conditions one in position are met, pos the oofff springoffspringO after O, and the obtain mutation the the mutation is obtained; otherwise, convert it into a feasible solution by using the constraint offspringis obtained; O after otherwise, mutation; convert Otherwise, it into go a feasibleto Step 3 solution to reselect by the using position the constraint for mutation. adjustment adjustmentmethod method to obtain to the obtain offspring the offspring O after theO after mutation. the mutation. (3) Logic layer mutation. This mutation operator is similar as the crossover of logic layer, the (2) Machine layer mutation. A single-point mutation (SPM) method is adopted to randomly operations(2) Machine of the layer product mutation. need to A be single-point segmented mutation according (SPM) to different method manufacturing is adopted to randomly features before select select a position in the machine layer code for mutation. An example of mutation for machine layer aoperation. position in Using the machine a method layer similar code for to mutation. machine Anlayer example mutation, of mutation a feature for with machine flexible layer process is shown is is shown in Figure 11. inrandomly Figure 11 selected. for mutation. An example of mutation for logic layer is shown in Figure 12. The steps of mutation for machine layer: Step 1: Select one parent individual, extract the machine layer, and recordpos it as P; Step 2: Copy P Pas O;3 6 4 1 4 2 6 5 5 1 2 3 3 2 3 Step 3: Within the length range of O, randomly select a mutation position pos whose logic layer code is not 0, andO record3 the6 machine4 1 number4 2 as6 k before5 5mutation;1 2 4 3 2 3 Step 4: Read the optional machine set M(j) of operation j which is on the position selected in Step 3; Step 5: If there are multiple candidate machines in M(j), select other machine randomly in M(j) whose FigureFigure 11. 11.An An exampleexample ofof mutationmutation forfor machinemachine layer. layer. serial number are not equal to k to replace the one in position pos of offspring O, and obtain the offspringThe steps O of after mutation mutation; for machine Otherwise, layer: go to Step 3 to reselect the position for mutation.

Step(3) 1: LogicSelect layer one parent mutation. individual, This mutation extract theoperator machine is similar layer, and as the record crossover it as P; of logic layer, the operationsStep 2: Copy of theP as productO; need to be segmented according to different manufacturing features before operation.Step 3: Within Using the a lengthmethod range similar of O to, randomly machine selectlayer amutation, mutation positiona featurepos withwhose flexible logic process layer code is randomlyis selected not 0, and for record mutation. the machine An example number of mu astationk before for mutation;logic layer is shown in Figure 12.

Step 4: Read the optional machine set M(j) of operation j which is onpos the position selected in Step 3; Step 5: If there are multiple candidate machines in M(j), select other machine randomly in M(j) whose P 3 6 4 1 4 2 6 5 5 1 2 3 3 2 3 serial number are not equal to k to replace the one in position pos of offspring O, and obtain the offspring O after mutation; Otherwise, go to Step 3 to reselect the position for mutation. O 3 6 4 1 4 2 6 5 5 1 2 4 3 2 3 (3) Logic layer mutation. This mutation operator is similar as the crossover of logic layer, the operations of the product need to be segmented according to different manufacturing features Figure 11. An example of mutation for machine layer. before operation. Using a method similar to machine layer mutation, a feature with flexible process is randomly selected for mutation. An example of mutation for logic layer is shown in Figure 12.

Mathematics 2020, 8, 1745 16 of 22 Mathematics 2020, 8, 1745 16 of 22

1 5 4 6 2 3 7 8 9 12 11 10 14 15 13 Operation layer P 1 1 1 1 1 1 0 1 1 0 1 1 1 1 0 Logic layer

1 5 4 6 2 3 7 8 9 12 11 10 14 15 13 Operation layer O 1 1 1 1 1 1 0 1 1 1 0 1 1 1 0 Logic layer

Figure 12. An example of mutation for logic layer.

The steps ofof mutationmutation forfor logiclogic layer:layer: Step 1:1: SelectSelect a a parent parent individual, individual, extract extract the the operation operation layer layer and and logic layer, and record it as P; Step 2:2: CopyCopy PP asas OO;; Step 3:3: Randomly select an operation segment correspondingcorresponding to one manufacturingmanufacturing feature, whichwhich hashas the the flexible flexible process, process, for for logic logic layer layer mutation mutation.. In In the the example, example, the the operation operation segment segment (11,12) belongingbelonging a feature a feature is selected, is selected, and and read read the the corresponding corresponding logic logic code code (0,1); (0,1); Step 4:4: RandomlyRandomly select select other other optional optional process process of the manufacturing feature to generate a new logic code,code, in the in the example example (1,0); (1,0); Step 5:5: UseUse the the new logic code generated by St Stepep 4 to replace the original logic code in O toto obtainobtain thethe offspring offspring O afterO after mutation. mutation.

6. Case Study InIn order to to prove prove the the feasibility feasibility of of the the algorithm algorithm and and test test the the performance performance of the of thealgorithm, algorithm, we weconduct conduct two two calculation calculation experiments experiments in inthis this sectio section.n. The The HPSO HPSO algorithm algorithm for for process process planning is programmedprogrammed withwith an an engineering engineering computing computing software software and and runs runs on aon notebook a notebook computer computer with with an intel an i-7intel (Core i-7 (Core 7700 HQ 7700 2.8 HQ GHz) 2.8 CPU GHz) and CPU 16 Gand RAM. 16 G After RAM. many After tests, many the parameterstests, the parameters of the algorithm of the arealgorithm set as follows: are set as the follows: maximum the ma valueximum of iterations value of is iterations 200; the populationis 200; the population size is 200; thesize three-layer is 200; the probabilitythree-layer ofprobability crossover of are crossover 0.8, 0.8, and are 0.6; 0.8, the 0.8, three-layer and 0.6; the probability three-layer ofmutation probability are of 0.1, mutation 0.8, and 0.1,are respectively.0.1, 0.8, and 0.1, For eachrespectively. calculation For example,each calculation the algorithm example, is run the 20 algorithm times, and is therun optimal 20 times, value and andthe averageoptimal value ofand the average results value are recorded. of the results are recorded.

6.1. Case 1 The data data of of case case 1 comes 1 comes from from the literature the literature [2]. The [2]. product The product contains contains 11 manufacturing 11 manufacturing features, features,17 optional 17 optionaloperations operations and 15 optional and 15 optional processing processing machines. machines. The AND/OR The AND network/OR network diagram diagram of the ofproduct the product is shown is shownin Figure in 13. Figure The 13process. The information process information of the product of the is product shown in is shownTable 3. in It Tableis set 3in. Itthis is setpaper in this that paper it will that take it willa certain take aof certain time to of change time to changethe processing the processing machine machine of a product of a product in the inmanufacture the manufacture process. process. In order In to order facilitate to facilitate the compar the comparisonison of results, of the results, data theof switch data of time switch between time betweendifferent dimachinesfferent machines of a product of a product which whichis in literature is in literature [2] are [2 also] are adopted also adopted here. here. Table Table 4 shows4 shows the thetransportation transportation time time required required for forthe theproduct product between between different different machines. machines.

O O 2 3 O O1 OR1 6 O4 O5

O8 S O7 OR2 O10 O11 E O9

O14 O15 O12 OR3 O16 O17 O13

Figure 13. The AND/OR network of the product in case 1.

Mathematics 2020, 8, 1745 16 of 22

1 5 4 6 2 3 7 8 9 12 11 10 14 15 13 Operation layer P 1 1 1 1 1 1 0 1 1 0 1 1 1 1 0 Logic layer

1 5 4 6 2 3 7 8 9 12 11 10 14 15 13 Operation layer O 1 1 1 1 1 1 0 1 1 1 0 1 1 1 0 Logic layer

Figure 12. An example of mutation for logic layer.

The steps of mutation for logic layer: Step 1: Select a parent individual, extract the operation layer and logic layer, and record it as P; Step 2: Copy P as O; Step 3: Randomly select an operation segment corresponding to one manufacturing feature, which has the flexible process, for logic layer mutation. In the example, the operation segment (11,12) belonging a feature is selected, and read the corresponding logic code (0,1); Step 4: Randomly select other optional process of the manufacturing feature to generate a new logic code, in the example (1,0); Step 5: Use the new logic code generated by Step 4 to replace the original logic code in O to obtain the offspring O after mutation.

6. Case Study In order to prove the feasibility of the algorithm and test the performance of the algorithm, we conduct two calculation experiments in this section. The HPSO algorithm for process planning is programmed with an engineering computing software and runs on a notebook computer with an intel i-7 (Core 7700 HQ 2.8 GHz) CPU and 16 G RAM. After many tests, the parameters of the algorithm are set as follows: the maximum value of iterations is 200; the population size is 200; the three-layer probability of crossover are 0.8, 0.8, and 0.6; the three-layer probability of mutation are 0.1, 0.8, and 0.1, respectively. For each calculation example, the algorithm is run 20 times, and the optimal value and average value of the results are recorded.

6.1. Case 1 The data of case 1 comes from the literature [2]. The product contains 11 manufacturing features, 17 optional operations and 15 optional processing machines. The AND/OR network diagram of the product is shown in Figure 13. The process information of the product is shown in Table 3. It is set in this paper that it will take a certain of time to change the processing machine of a product in the manufacture process. In order to facilitate the comparison of results, the data of switch time between Mathematicsdifferent2020 machines, 8, 1745 of a product which is in literature [2] are also adopted here. Table 4 shows 17the of 22 transportation time required for the product between different machines.

O O 2 3 O O1 OR1 6 O4 O5

O8 S O7 OR2 O10 O11 E O9

O14 O15 O12 OR3 O16 O17 O13

FigureFigure 13. 13.The The ANDAND/OR/OR network of the the product product in in case case 1. 1.

Table 3. The process information of the product in case 1.

Feature Optional Operation Optional Machine Process Time Sequence Constraints

F1 O1 M3,M8 8, 13 Before F2,F3 O O M ,M ,M M 16, 12, 13 21 Before F F 2→ 3 5 6 8→ 2 → 3 2 O O M ,M ,M M 13, 16, 18 17 4→ 5 1 5 10→ 9 → F3 O6 M5,M8 46, 47 F4 O7 M3,M7,M13 44, 48, 49 Before F5,F6,F7 O8 M5,M6,M13 17, 14, 10 Before F6,F7 F5 O9 M5,M15 16, 13 F6 O10 M3,M11,M15 28, 27, 30 Before F7 F7 O11 M10,M13 48, 50 F8 O12 M5,M13,M15 31, 32, 36 Before F9,F10,F11 O M ,M ,M 30, 28, 26 Before F ,F F 13 3 6 9 10 11 9 O O M M ,M 11 16, 18 14→ 15 2→ 1 14 → F10 O16 M4,M15 18, 19 Before F11 F11 O17 M3,M10,M14 36, 32,

Table 4. The transportation time of a product between different machines.

Machine M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 M12 M13 M14 M15

M1 0 5 7 9 10 11 7 6 14 13 12 10 5 6 9 M2 5 0 3 4 5 7 2 7 6 4 7 12 10 7 8 M3 730654372435689 M4 9 4 6 0 4 4 6 7 4 10 12 13 14 15 16 M5 10 5 5 4 0 10 12 7 8 9 10 12 11 10 8 M6 11 7 4 4 10 0 4 4 5 5 6 7 6 7 8 M7 7 2 3 6 12 4 0 5 6 6 6 7 7 7 8 M8 677774504234243 M9 14 62485640574768 M10 13 4 4 10 9 5 6 2 5 0 8 10 12 14 7 M11 12 7 3 12 10 6 6 3 7 8 0 7 10 14 10 M12 10 12 5 13 12 7 7 4 4 10 7 0 10 12 10 M13 5 10 6 14 11 6 7 2 7 12 10 10 0 8 8 M14 6 7 8 15 10 7 7 4 6 14 14 12 8 0 9 M15 9 8 9 16 8 8 8 3 8 7 10 10 8 9 0

Table5 shows the comparison between the calculation results of the algorithm in this paper and the calculation results of several algorithms in literature [2].

Table 5. The result comparison of different algorithms in case 1.

Algorithm Simple SA Simple GA Modified PSO Hybrid PSO Improve Rate Optimal result 377 377 377 356 5.6% Average result 378.1 380.2 377 358.5 4.9% Mathematics 2020, 8, 1745 18 of 22

The comparison results show that the optimal and average results of HPSO algorithm are better than the other three algorithms, which fully proves that the algorithm proposed in this paper has better search performance. A large part of the improvement of algorithm performance is due to the new coding method adopted in the algorithm of this article. The optimal process route plan of case 1 is as follows:

(O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) 7 3 → 1 3 → 4 1 → 12 13 → 8 13 → 10 3 → (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) 13 9 → 5 9 → 16 4 → 6 8 → 17 10 → 11 10 6.2. Case 2 The data in the case 2 comes from the literature [23], including 18 independent products with different degrees of flexibility, each of which contains different features and operations, and there are 15 optional machines. The details of the optional machines, processing time and technological process (sequence constraints) of each operation of the products can be found in the appendix of the literature [24]. In order to facilitate comparison, the data of the transportation time of a product between the machines in case 1 (Table4) is adopted in this case. In the literature [ 2], simple SA, simple GA and modified PSO were used by Li et al. to carry out the process planning of these 18 products, and the calculation result comparison is provided. The optimal results and average results comparison of the above three algorithms with the H-PSO proposed in this paper are shown in the Tables6 and7.

Table 6. The optimal result comparison of different algorithms in case 2.

Optimal Result Product Number Improved Rate Computing Time (s) S-SA S-GA M-PSO H-PSO 1 303 303 303 292 3.63% 11.57 2 359 359 359 351 2.23% 17.66 3 502 502 498 489 1.81% 18.76 4 314 314 314 349 –11.15% 17.74 5 314 314 314 282 10.19% 18.65 6 409 409 408 391 4.17% 19.14 7 304 304 304 304 0.00% 17.72 8 358 358 358 353 1.40% 18.69 9 393 392 391 390 0.26% 19.23 10 264 264 264 264 0.00% 14.64 11 271 271 271 266 1.85% 12.75 12 442 442 442 432 2.26% 19.15 13 216 216 216 215 0.46% 18.19 14 269 269 269 244 9.29% 16.12 15 358 357 357 354 0.84% 16.83 16 248 248 248 244 1.61% 17.98 17 314 314 314 300 4.46% 18.62 18 361 361 360 356 1.11% 18.44

The comparison results show that in the No. 1–18 problems of the process planning for products, the results of optimal value and average value calculated by the H-PSO algorithm in this paper are better than the other three algorithms in 15 problems, and equal in 2 problems. Table8 provides the optimal process route scheme for each product calculated by H-PSO. Mathematics 2020, 8, 1745 19 of 22

Table 7. The average result comparison of different algorithms in case 2.

Average Result Product Number Improved Rate Computing Time (s) S-SA S-GA M-PSO H-PSO 1 303 303 303 292 3.63% 10.87 2 361.2 360.7 359 352.4 1.84% 18.06 3 504.9 503.6 500.3 492.2 1.62% 17.58 4 315.7 314.8 314 349.4 11.27% 18.69 − 5 315.8 315.1 314 282 10.19% 20.28 6 411.3 410.3 408.8 392.3 4.04% 18.32 7 304.5 304.2 304 304 0.00% 17.21 8 358 358 358 353 1.40% 17.75 9 395.7 394.1 391.9 390.3 0.41% 21.43 10 264 264 264 264 0.00% 12.22 11 271.3 271.1 271 266 1.85% 13.67 12 442.8 443.1 442 433.5 1.92% 18.94 13 216.1 216.2 216 215 0.46% 19.34 14 270.5 269.6 269 244 9.29% 15.08 15 361.3 359.2 357 354.7 0.64% 17.97 16 248 248 248 244 1.61% 16.50 17 315.1 314.8 314.6 302.6 3.81% 19.25 18 363.5 363.7 361.3 358.2 0.86% 20.62

Table 8. The optimal process route plan for each product of case 2.

Product Number Optimal Process Route Scheme (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) 1 1 14 → 2 15 → 3 15 → 5 13 → 6 12 → 4 12 → 7 11 (O , M ) → 8 8 (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) 2 7 6 → 8 10 → 1 8 → 2 8 → 6 12 → 12 8 → 13 7 (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) → 14 10 → 4 9 → 3 4 → 5 1 → 6 1 (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) 3 7 5 → 1 4 → 8 1 → 9 14 → 13 14 → 2 8 → 16 10 (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) → 17 10 → 3 7 → 18 7 → 19 3 → 10 3 → 14 2 → (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) 5 2 → 11 2 → 6 7 → 4 7 → 15 1 → 12 1 (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) 4 1 2 → 5 3 → 6 2 → 13 2 → 14 10 → 7 10 → 8 6 (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) → 9 3 → 10 9 → 11 7 → 16 7 → 12 15 (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) 5 1 11 → 14 8 → 15 13 → 16 13 → 10 8 → 11 14 → 12 6 (O , M ) (O , M ) (O , M ) → 13 6 → 17 3 → 18 7 (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) 6 15 14 → 16 8 → 17 12 → 5 3 → 6 3 → 7 9 → 18 9 (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) → 19 12 → 10 8 → 1 11 → 20 11 → 9 11 → 14 7 → 2 3 (O , M ) (O , M ) → 3 5 → 4 5 (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) 7 1 7 → 19 2 → 7 3 → 8 10 → 9 6 → 20 6 → 10 6 (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) → 11 9 → 21 10 → 12 8 → 13 13 → 18 13 (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) 8 1 4 → 12 3 → 15 10 → 17 10 → 13 10 → 18 7 → 20 3 (O , M ) (O , M ) → 14 14 → 16 14 (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) 9 1 12 → 2 7 → 16 2 → 13 2 → 18 2 → 4 3 → 19 13 (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) → 7 13 → 10 8 → 11 15 → 5 6 → 6 6 → 12 6 → 20 4 (O , M ) (O , M ) → 14 5 → 15 5 (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) 10 1 1 → 3 1 → 4 13 → 5 7 → 6 9 → 9 9 → 10 3 (O , M ) (O , M ) → 11 14 → 2 15 (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) 11 1 6 → 6 2 → 8 2 → 7 1 → 2 8 → 3 13 → 9 13 (O , M ) (O , M ) → 4 6 → 5 6 (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) 12 1 11 → 13 3 → 8 3 → 9 6 → 14 8 → 2 15 → 5 15 (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) → 3 5 → 10 4 → 6 2 → 11 7 → 12 10 → 15 9 → 18 9 (O , M ) (O , M ) → 4 12 → 7 11 Mathematics 2020, 8, 1745 20 of 22

Table 8. Cont.

Product Number Optimal Process Route Scheme (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) 13 1 12 → 12 6 → 17 8 → 13 10 → 18 2 → 14 6 → 15 6 (O , M ) → 16 14 (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) 14 9 12 → 1 9 → 4 3 → 10 9 → 5 4 → 6 4 → 11 4 (O , M ) (O , M ) (O , M ) → 8 2 → 12 10 → 13 10 (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) 15 1 11 → 3 6 → 4 7 → 12 7 → 14 3 → 7 9 → 8 8 (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) → 9 8 → 11 8 → 13 1 → 15 1 → 5 2 → 6 5 (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) 16 18 11 → 1 11 → 2 7 → 3 3 → 4 7 → 20 14 → 21 14 (O , M ) → 5 1 (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) 17 1 10 → 2 10 → 18 2 → 3 4 → 13 6 → 19 6 → 4 12 (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) → 20 9 → 14 3 → 17 2 → 5 7 → 22 11 → 7 11 → 12 8 (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) 18 7 3 → 1 3 → 4 1 → 12 13 → 8 13 → 10 3 → 13 9 (O , M ) (O , M ) (O , M ) (O , M ) (O , M ) → 5 9 → 16 4 → 6 8 → 17 10 → 11 10

7. Conclusions Based on the calculation results of the above two calculation result of cases, the HPSO algorithm designed in this paper is an effective method to solve the process planning problem. It has strong search performance and can obtain a better process route plan for the minimum completion time objective function. The reasons are as follows: First, a coding method which adopted the direct coding based on product operations is more in line with the characteristics of the problem for process planning was designed in this algorithm. Compared with the traditional integrated coding method and hierarchical coding method, it contains more comprehensive process information, reduces the difficulty of decoding in, thereby improving the efficiency and search performance of the algorithm. Second, the multiple genetic operation operators designed in this paper are more compatible with the decision-making dimensions of process planning. The three crossover operators and mutation operators cooperate with each other. Global and local searches are respectively performed in each dimension from the selection of the processing technology, the operation sequence, and the processing machine for the product, which further strengthens the optimization performance of the algorithm. Therefore, the HPSO algorithm designed to solve the process planning problem in this paper is a more effective method. This article mainly studied the mathematical model and solution method of process planning. First, the related literatures of the solve method for process planning problem were reviewed. Second, the representation method of flexible process route was elaborated. Third, the problem assumptions and related symbols of the mathematical model were explained, and the mathematical model of mixed integer programming for process planning with an object function of minimum completion time was established. Fourth, the HPSO algorithm is improved according to the main characteristics of process planning, an improved hierarchical coding method including operation layer, machine layer and logic layer was proposed, and several genetic operators were designed for improving the optimization performance of the algorithm. Finally, the effectiveness of the algorithm is proved by two experiments in the case calculation, and at the same time, it is proved that the algorithm in this paper has better search performance by comparing with other algorithms. The algorithm for process planning in this paper can be embedded into the software of CAPP system, so that it can be applied in manufacturing enterprises. With regard to directions for future research, we will try to propose more novel methods to solve process planning problems, and consider more dynamic factors of the actual production environment when performing the process planning. In addition, the integration of process planning with other systems is also a direction of the future research. Among them, the integrated optimization of process planning and scheduling is a kind of research with nice practical value.

Author Contributions: Conceptualization, X.Z. and J.Y.; methodology, X.Z. and J.Y.; software, X.Z.; validation, P.G. and H.Z.; formal analysis, X.Z.; resources, J.Y.; data curation, X.Z., P.G.and H.Z.; writing—original draft preparation, X.Z.; writing—review and editing, X.Z. and J.Y.; visualization, X.Z.; supervision, J.Y.; funding acquisition, J.Y.; project administration, J.Y. All authors have read and agreed to the published version of the manuscript. Mathematics 2020, 8, 1745 21 of 22

Funding: This research was funded by China University Research Fund: 2010scu2101. Conflicts of Interest: The authors declare no conflict of interest.

References

1. Jin, L.; Zhang, C. Process Planning Optimization with Energy Consumption Reduction from a Novel Perspective: Mathematical Modeling and a Dynamic Programming-like Heuristic Algorithm. IEEE Access. 2019, 7, 7381–7396. [CrossRef] 2. Li, X.; Gao, L.; Wen, X. Application of an Efficient Modified Particle Swarm Optimization Algorithm for Process Planning. Int. J. Adv. Manuf. Technol. 2013, 67, 1355–1369. [CrossRef] 3. Yusof, Y.; Latif, K. Survey on Computer-aided Process Planning. Int. J. Adv. Manuf. Technol. 2014, 75, 77–89. [CrossRef] 4. Al-Wswasi, M.; Ivanov, A.; Makatsoris, H. A survey on Smart Automated Computer-aided Process Planning (ACAPP) Techniques. Int. J. Adv. Manuf. Technol. 2018, 97, 809–832. [CrossRef] 5. Li, W.D.; Ong, S.K.; Nee, A.Y.C. Hybrid Genetic Algorithm and Simulated Annealing Approach for the Optimization of Process Plans for Prismatic Parts. Int. J. Prod. Res. 2002, 40, 1899–1922. [CrossRef] 6. Singh, D.K.J.; Jebaraj, C. Feature-based Design for Process Planning of Machining Processes with Optimization Using Genetic Algorithms. Int. J. Prod. Res. 2005, 43, 3855–3887. [CrossRef] 7. Su, Y.; Chu, X.; Chen, D.; Sun, X. A genetic algorithm for operation sequencing in CAPP using edge selection based encoding strategy. J. Intell. Manuf. 2015, 29, 313–332. [CrossRef] 8. Delolme, L.; Antomarchi, A.-L.; Durieux, S.; Duc, E. Decision-making for multi-criteria optimization of process planning. Mech. Ind. 2019, 20, 806. [CrossRef] 9. Guo, Y.W.; Mileham, A.R.; Owen, G.W.; Li, W.D. Operation sequencing optimization using a particle swarm optimization approach. Proc. Inst. Mech. Eng. Part B J. Eng. Manuf. 2006, 220, 1945–1958. [CrossRef] 10. Wang, J.; Kang, W.; Zhao, J.; Chu, K. A simulation approach to the process planning problem using a modified particle swarm optimization. Adv. Prod. Eng. Manag. 2016, 11, 77–92. [CrossRef] 11. Miljkovi´c,Z.; Petrovi´c,M. Application of Modified Multi-Objective Particle Swarm Optimisation Algorithm for Flexible Process Planning Problem. Int. J. Comput. Integr. Manuf. 2016, 30, 271–291. [CrossRef] 12. Wu, W.; Zeng, J.; Huang, Z. A Hybrid Optimization Approach for Setup Planning with Tolerance Constraints. MATEC Web Conf. 2018, 249, 1–5. [CrossRef] 13. Ma, G.H.; Zhang, Y.F.; Nee, A.Y.C. A Simulated Annealing-Based Optimization Algorithm for Process Planning. Int. J. Prod. Res. 2000, 38, 2671–2687. [CrossRef] 14. Li, W.D.; Ong, S.K.; Nee, A.Y.C. Optimization of Process Plans Using a Constraint-Based Tabu Search Approach. Int. J. Prod. Res. 2004, 42, 1955–1985. [CrossRef] 15. Lian, K.; Zhang, C.; Shao, X.; Zeng, Y. A multi-dimensional tabu search algorithm for the optimization of process planning. Sci. China Ser. E Technol. Sci. 2011, 54, 3211–3219. [CrossRef] 16. Liu, X.J.; Yi, H.; Ni, Z.H. Application of Ant Colony Optimization Algorithm in Process Planning Optimization. J. Intell. Manuf. 2013, 24, 1–13. [CrossRef] 17. Hu, Q.; Qiao, L.; Peng, G. An ant colony approach to operation sequencing optimization in process planning. Proc. Inst. Mech. Eng. Part B J. Eng. Manuf. 2016, 231, 470–489. [CrossRef] 18. Chan, F.T.S.; Swarnkar, R.; Tiwari, M.K. Fuzzy Goal-Programming Model with an Artificial Immune System (AIS) Approach for a Machine Tool Selection and Operation Allocation Problem in a Flexible Manufacturing System. Int. J. Prod. Res. 2005, 43, 4147–4163. [CrossRef] 19. Gao, B.; Hu, X.; Peng, Z.; Song, Y. Application of intelligent water drop algorithm in process planning optimization. Int. J. Adv. Manuf. Technol. 2020, 106, 5199–5211. [CrossRef] 20. Li, X.Y.; Shao, X.Y.; Gao, L. Optimization of Flexible Process Planning by . Int. J. Adv. Manuf. Technol. 2008, 38, 143–153. [CrossRef] 21. Marinakis, Y.; Migdalas, A.; Sifaleras, A. A hybrid particle swarm optimization–variable neighborhood search algorithm for constrained shortest path problems. Eur. J. Oper. Res. 2017, 261, 819–834. [CrossRef] 22. Cagnina, L.C.; Esquivel, S.C.; Gallard, R. Particle swarm optimization for sequencing problems: A Case Study. In Proceedings of the Congress on , Portland, OR, USA, 19–23 June 2004; pp. 536–541. Mathematics 2020, 8, 1745 22 of 22

23. Kim, Y.K.; Park, K.; Ko, J. A Symbiotic for the Integration of Process Planning and Job Shop Scheduling. Comput. Oper. Res. 2003, 30, 1151–1171. [CrossRef] 24. Li, X. Research on the Solution Methods of Integrated Process Planning and Scheduling. Ph.D. Thesis, Huazhong University of Science and Technology, Wuhan, China, 2009.

© 2020 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).