# Textile Flexible Job-Shop Scheduling Based on a Modified Ant Colony Optimization Algorithm
## 3 Product Ant Colony Optimization Algorithm
### Modified Ant Colony Optimization Algorithm  
In this paper, the ACO algorithm is introduced as the workshop scheduling algorithm for the reasonable configuration of textile production operations in a textile workshop. In the original ACO algorithm, there is only one group of ant colonies in each iteration of the algorithm, and the colony sets a reasonable number of ants to run the algorithm, finally selecting the best ant in each iteration by comparison. However, each ant in the single ant colony algorithm is in an independent state during the path search, making it difficult to consider the influence of multiple products on each other in the production of the entire workshop. Therefore, to solve the T-FJSP, this paper modifies the traditional single ant colony into multiple ant colonies. The number of ants in each ant colony corresponds to the number of textiles currently planned to be produced in the workshop. The algorithm is named product ant colony optimization (PACO) in this paper. According to the actual situation of the textile workshop, the number of textile products to be produced and the corresponding number of operations can be arbitrarily set. In order to better understand the work situation of each ant in a group of products and the relationship between them, it is assumed that a certain textile workshop produces four textile products and goes through three operations. The schematic diagram of the process of generating a solution in PACO is shown in Figure 1.  
Figure 1 depicts the workshop operation search of a group of product ants, where each ant in the ant colony represents a textile product to be produced. Each ant must complete all operations and can only select one machine at each operation. Different ants in the same operation can choose the same machine. Therefore, ants need to compete for machines using a combined heuristic function and pheromone information. During the selection of a machine at each operation, each ant is subject to influence from other ants within the product ant colony. If an ant is not the first selector of a machine, it must consider the usage time and completion time of all ants that have previously selected that machine, thus calculating its own start time of using this machine. The total usage time of each machine is also influenced by the product ant colony, and the ants in the product ant colony interact with one another. The total usage time of a machine is the sum of the usage times of all ants accessing that machine in the product ant colony when the algorithm iteration is completed. Since different ants represent different textile products, the types of textile products may not be the same. Therefore, the different sequencing of ants accessing the same machine will change the usage time of the machine during the algorithm run, thus affecting the next ant's access to the machine and consequently affecting the overall algorithm.  
In Figure 1, the workshop produces four textile products, so a product ant colony dispatches four ants to explore. If the workshop produces two textile products or seven textile products, the corresponding number of ants for each product ant colony is two or seven, respectively. Each ant in Figure 1 explores three operations and selects the machine for the next operation randomly using the roulette wheel selection rule based on the heuristic value and pheromone of all machines in the next operation. Adding or reducing an operation in the workshop will not affect the ants' machine selection for that operation, so the number of operations explored by the ants is variable.  
In the PACO algorithm, we use multiple product ant colonies for searching, and finally select the best ant colony and its allocation scheme by comparing the optimization objective results. Assuming four product ant colonies are used, the PACO algorithm schematic diagram is shown in Figure 2.  
Figure 1: Process of generating a solution in PACO.