Genetic Algorithm with Adaptive Crossover Operator to Solve Multiple Traveling Salesman Problem with Access Constraints

英文名:Genetic Algorithm with Adapted Crossover Operators for Multiple Traveling Salesmen Problem with Visiting Constraints

Summary

The Multiple Traveling Salesman Problem with Access Restrictions (VCSMP) is a general version of the classic Multiple Traveling Salesman Problem (MTSP), where each city can only be visited by multiple salesmen. To solve this new problem, we apply a genetic algorithm (GA) to MSTP by using a two-chromosome representation scheme , where one chromosome represents the city's visit sequence and the other chromosome represents the city's assignment to salespeople. To further improve the effectiveness of genetic algorithms in solving VCSMP, we modify three popular crossover operators, namely cyclic crossover (CX), sequential crossover (OX), and partial mapped crossover (PMX). Similar to the execution of traditional TSP, the three crossover operators are all executed on the urban sequence chromosome, and their adaptability lies in modifying the saleser allocation on the second chromosome. To this end, a correction mechanism is implemented based on the reachability matrix to make the solution generated after crossover feasible. Extensive experiments on a total of 16 VCSMP instances generated by the benchmark TSPLIB ensemble show that the adaptive genetic algorithm can effectively cope with VCSMP, and the genetic algorithm with modified PMX achieves the best overall performance.

I.Introduction

The multiple traveling salesman problem (MTSP) is a generalized form of the traditional traveling salesman problem [1]-[3]. In MTSP, multiple salespeople collaborate with each other to travel across multiple cities, with only one salesperson visiting each city once, while minimizing their total travel costs. In a traditional MTSP, all salespeople have access to every city. However, in some real-world scenarios, some cities may be restricted to certain salespeople. For example, in logistics dispatch, some dangerous goods can only be serviced by specific trucks. In order to simulate this practical problem, this paper establishes a multiple traveling salesman problem with access constraints (VCSMP), in which the accessibility of a city to the salesmen is represented by a accessibility matrix containing 0 and 1. Only when the element is one, the corresponding salesperson can access the associated city. Figure 1 shows an example of MTSP. In this diagram, different cities have different access rights to different salespeople. The number after the dot indicates the number of salesmen who can visit that city. In particular, the larger the point size, the more salesmen who can visit the relevant city.

Due to complex restrictions on city access, VCMTSP is more complex and difficult to solve than traditional MTSP. In particular, access restrictions make it difficult to optimally deploy sales staff in a city and further make subsequent route optimization difficult [4], [5].

In the literature, many researchers apply genetic algorithms to optimize MTSP [6]–[10]. Initially, to efficiently solve MTSP, researchers developed different representation schemes to encode chromosomes in GA. For example, a two-part chromosome encoding method was adopted in [8], where the first part represents the city sequence and the second part represents the salesperson. A multi-chromosome representation mechanism is proposed in [11], where each chromosome represents a salesperson's route. In addition, some studies also investigated different GAs for solving MTSP [6], [9]. In addition, there are some studies focusing on extended MTSP with complex constraints and research in real-world applications, such as length-constrained min-max MTSP [12], MTSP with capacity and time windows [13], MTSP for UAVs [14][15] and MTSP plans for trucks

Although various GAs have been formulated to address various MTSPs, to the best of our knowledge, no study has considered access restrictions to cities. Based on the fact that VCMTSP is a general form of MTSP, this paper attempts to deal with NCMTSP by applying GA to MTSP. Specifically, this paper adopts a two-chromosome representation strategy, in which one chromosome is responsible for the visiting order of cities and the other is responsible for assigning cities to salespeople. In order to make it develop efficiently and with high feasibility, this paper adopts three popular crossover operators, namely cyclic crossover (CX) [16], sequential crossover (OX) [17] and partial mapped crossover (PMX) [18] , used for GA to cope with VCSMP.

In order to verify the effectiveness of the adaptive genetic algorithm in dealing with MTSP, this paper first generates several MTSP instances with different cities and number of sales personnel from the widely used TSPLIB [19] benchmark set. Then, experiments are conducted on these instances to observe the optimization performance of the adaptive genetic algorithm in solving VCSMP.

The remainder of this article is organized as follows. Section 2 gives the specific mathematical definition of VCMTSP. Then, Section III introduces the GA framework and three cross-operators suitable for VCMTSP. Section 4 conducts experiments on several MTSP planning instances to demonstrate the effectiveness of the adjusted GA. Finally, Section 5 concludes the paper.

2. Definition of problem

Specifically, the mathematical definition of a VCMTSP is as follows. Given n cities and m salesmen, the city map can be described as a completely undirected graph G = (V, E), where V represents the city and E = {eij | i, j∈V} represents the edge connecting the cities. . In order to formulate the accessibility of the city to the salesperson, the accessibility matrix A=[aij] n×m is defined, where Aij=1 means that the city i is accessible to the salesperson j, and Aij=0 means that the salesperson is Inaccessible. Figure 2 shows an example accessibility matrix for a VCMTSP i instance with m salespeople and n cities. In this matrix, rows represent cities and columns represent salespeople.

 The target function of VCMTSP is to minimize the total travel cost of all sales personnel, which is defined as follows:

where C(Routei) is the cost of route i. This goal is achieved by meeting the following constraints:

1) Must visit all cities:

2) Only one salesperson visits each city:

3) Salesman i can only access barrier-free cities and is prohibited from accessing restricted cities:

The main difference between MTSP and VCMTSP is the third constraint. Due to this limitation, the optimization of VCSMP becomes more difficult, as it severely affects the allocation of city to sales personnel and subsequently affects the route optimization of sales personnel.

3. Adapter suitable for VCMTSP

In order to effectively solve the VCSMP problem defined above, this paper modifies the crossover operator of the genetic algorithm based on the reachability matrix.

A.Genetic Algorithm

This paper uses a two-chromosome [20] representation to represent a feasible solution to VCMTSP. Specifically, as shown in Figure 3(a), each feasible solution consists of two chromosomes. The first chromosome is the arrangement of cities, while the other chromosome assigns salesmen to the cities associated with the first chromosome. With this representation mechanism, each salesman's route can be obtained by arranging the cities with the same salesman in the order of their appearance in the first chromosome.

Based on this representation mechanism, the overall process of the genetic algorithm is outlined in Algorithm 1. At the beginning, NP individuals are initialized through a greedy strategy. Specifically, the first chromosome is initialized through a greedy strategy, just like the traditional TSP genetic algorithm, while the second chromosome is initialized based on the reachability matrix. For each city in the first chromosome, if the city can only be visited by one salesperson, then the city is assigned to that salesperson. Otherwise, if the city can be visited by multiple salespeople, then it will be randomly assigned to one of the salespeople with equal probability.

After initializing the population (line 1), the GA enters the main loop (lines 4–21) to iteratively evolve. First, individuals are selected from the population to be crossed using a roulette selection strategy (line 5). After the selection, it continues with the crossover operation. Different from the traditional TSP genetic algorithm, this paper first randomly shuffles the population (line 6) and then pairs the individuals. For each pair of individuals, if the randomly generated real number within [0, 1] is lower than the crossover probability, a crossover operator is performed on the two individuals to generate two offspring (lines 9-11) to replace them. After crossover, for each individual, if the uniformly generated real numbers within [0, 1] are lower than the mutation probability, then the mutation operator is executed on the individual (lines 15-17).

The above main loop continues until the termination condition is met. When the end of the algorithm is reached, the global optimal solution is obtained as the final output.

In Algorithm 1, the crossover operator plays an important role in offspring generation because, on the one hand, it is responsible for gene exchange to generate promising offspring; on the other hand, in the traditional TSP genetic algorithm, the crossover probability is usually high. Therefore, effective crossover operators have a great impact on the performance of genetic algorithms in solving risk management strategy problems. In the following, this paper applies three popular crossover operators to GA to effectively solve the VCMTSP problem.

B. Partially Mapped Crossover Partially Mapped Crossover

The partial map crossover (PMX) operator was originally proposed by Goldberg and Lingle to solve the classic TSP [18]. For two parents to be crossed, PMX first randomly selects two different points on the chromosomes and then exchanges gene segments between the two selected alleles in the two parental chromosomes to produce two offspring.

After segment swapping, the two resulting offspring may not be feasible because of duplicate cities and missing cities. To fix these two descendants, a city mapping sequence is defined based on the two swapped line segments. Then, based on the defined city mapping, duplicate cities outside the swap segment are replaced accordingly.

To intuitively understand how the PMX operator works, Figure 4 shows an example process of PMX on two parents in nine cities. First, two different alleles, 3 and 6, are randomly selected. Then, the two segments between the two alleles in parent A and parent B, namely 3−4−5−6 and 2−1−3−6, are exchanged. Therefore, two subterms are generated, namely 1−2−2−1−3−6−7−8−9 and 8−5−3−4−5−6−4−9−7.

After the fragment exchange, two children are not feasible because in the first child, cities 1 and 2 are duplicates, while in the second child city 4 and city 5 are duplicates. To address this shortcoming, a city exchange sequence is first defined based on the segmentation of two exchanges. Specifically, the city is mapped as 3↔ 2, 4↔ 1, 5↔ 3 and 6↔ 6, as shown in the middle part of the shaded drawing in Figure 4. Based on these mappings, duplicate cities outside the exchange segment will be replaced by the associated city. For example, based on mapping 4, city 1 outside the exchange segment in Child 1 is replaced with city 4↔ 1. Based on mapping 3, city 2 in Child 1 is first replaced with city 3↔ 2, but city 3 is also Repeated. Therefore, on the basis of map 5, city 3 is further replaced by city 5 ↔ 3.

After correctness, the two generated offspring are 4−5−2−1−3−6−7−8−9 and 8−2−3−4−5–6−1−9−7. These two It's all feasible now.

C. Order Crossover

Step crossover (OX) [17] is similar to PMX in terms of switching segments. The only difference is the treatment of duplicate cities. In particular, similar to PMX, OX first randomly selects two different alleles in a chromosome and then exchanges gene segments between the two selected alleles in the two parental chromosomes, producing two offspring.

Subsequently, to handle duplicated cities, OX first keeps elements in both descendant chromosomes empty, except for the swapped segments. Then, to ensure that the child should inherit as much information as possible from the associated parent, OX fills the empty elements with the remaining access sequence from the associated parent of the first element after the swap segment. It should be noted that the remaining access sequence does not include the cities appearing in the exchange segment.

To intuitively understand the working process of OX, Figure 5 shows an example of 9 cities. First, two different alleles, 3 and 6, are randomly selected. Then, the two segments between the two alleles are exchanged, resulting in two offspring, namely ×-×−2−1−3−6−×-×-× and ×-×-3−4−5 −6−. It should be mentioned that, except for the exchanged segment, other elements in both offspring chromosomes are set to empty. Empty elements are then filled with access sequences from the associated parent element. In particular, for child element 1, the elements are filled by the remaining access sequence of parent element A, starting from the first element after the swapped segment, which is 7−8−9−4−5. Therefore, sub1 becomes 4−5−2−1−3−6−7−8−9. Similarly, the empty elements in child 2 are filled by the remaining access sequence in parent B, which is 9−7−8−2−1. Therefore, sub2 becomes 2−1−3−4−5−6−9−7−8.

After the above sequential filling, both the resulting descendants are now viable.

D. Cycle Crossover Cycle Crossover

The cyclic crossover (CX) operator was first proposed by Oliver et al. [16]. Unlike the two crossovers above, CX inherits information from both parents (assuming they are parent A and parent B) by iterating, creating children one at a time. At the beginning, OX randomly selects a position from one of the two parents (assuming the selected parent is parent a) as the child's starting position. The city stored at the same location as the other parent (i.e. parent B) is then used to populate the child's location equal to that city. Subsequently, the city stored in parent B's location equal to the city filled in the last round is used to populate child B's location equal to that city. The above process continues until a conflict occurs, that is, the next city to be filled is already on the child. After that, other unfilled elements in the children inherit directly from parent A. In this way, children can inherit valuable access sequences from both parents at the same time.

To intuitively understand how CX works, Figure 6 shows an example process of CX with 9 cities. First, the child object is set to null and then starts inheriting cities from parent object A at randomly chosen locations. In this example, the selected position is 1. So the city 1 stored in parent A's location 1 is used to populate the child's location 1. Next, use the city (i.e. 8) at the same location (location 1) in the other parent object (parent object B) to locate the next location of the child object to be filled. That is, position 8 in the child inherits the city at position 8 in parent A. After that, position 9 is filled in the same way. The process continues until position 4. By finding the next position based on 4, the next position is position 1. However, position 1 is already filled in the child object, so the inheritance from parent object A forms a cycle. In this case, inheritance from parent element A will stop and the remaining unfilled positions in the child element will be inherited with the associated element in parent element B.

Finally, the subterms 1−5−2−4−3−6−7−8−9 are obtained, which is feasible.

E. Salesperson assignment correction

It should be noted that the crossover operators introduced above are all executed on the first chromosome in the adaptive genetic algorithm. For the second chromosome, this article first directly inherits the sales assignment from the parents. However, the assignment of salespersons in parents may violate accessibility constraints due to changes in access sequences in the first chromosome after crossover. To mitigate this problem, this paper first identifies incorrect salesperson assignments based on accessibility. Then, for each wrong task, we first find the salesperson who has access to the relevant city. If only one salesperson has access to the city, correct the incorrect assignment by replacing the wrong salesperson with this salesperson. If more than one salesperson has access to the city, the incorrectly assigned salesperson will be replaced by a randomly selected salesperson from among these salespersons with equal probability.

Taking subitem 1 obtained by PMX cross in Figure 4 as an example, as shown in Figure 7, subitem 4−5−2−1−3−6−7−8−9 directly inherits the sales allocation of parent item A. However, according to the reachability matrix given in Figure 2, it is found that the salesperson allocation of city 5 and city 2 is wrong. 2. From the accessibility matrix, it can be found that City 5 can only be accessed by Salesperson 1, while City 2 can be accessed by Salesperson 1 and Salesperson 2. So for city 5, the wrong salesman 2 is replaced by salesman 1. For city 2, the wrong salesman 3 is replaced by a salesman randomly selected from salesman 1 and salesman 2 with equal probability. In this example, Salesperson 2 is selected.

Similarly, the above correctness of salesperson assignment can be used for the offspring generated by OX and CX.

 

However, a closer look at the CX operator process shows that the assignment of salespeople can also cross together with the city cross in the first chromosome. That is, during the filling of elements in the child chromosome relative to the first chromosome, the relevant salesperson assignments can be filled in the second chromosome of the child chromosome accordingly.

In order to distinguish the correctness of the first salesman assignment, this article defines CX with the inheritance of the above salesman assignment as "CX+". Taking the subitems generated in Figure 6 as an example, Figure 8 shows the process of salesperson assignment inheritance in CX+. It can be found from this figure that for the city inherited from parent B, that is, 4−7−8−9, its sales staff allocation is directly inherited from parent B; for the city of parent company A, that is, 1−5−2− 3−6, its sales staff allocation is directly inherited from parent company A.

Compared with CX, CX+ can inherit the city visit sequence and sales tasks of both parents at the same time. Therefore, it is expected that GA with CX+ can achieve more promising performance than GA with CX, which will be demonstrated in the experiments in the next section.

4. Experiment

In order to observe the optimization performance of GA with three adaptive crossover operators when dealing with VCSMP, this paper first selects four instances with different numbers of cities from the TSPLIB benchmark set, namely att48, kroA100, kroA150 and kroA200. Next, this article assigns them four different numbers of salespeople, namely 2, 4, 6, and 8. Subsequently, for each instance of the number of salespeople, we randomly construct an accessibility matrix. Therefore, a total of 16 VCMTSPs were generated and these instances can be found at https://gitee.com/sorel/tspresearch.git along with the generated source code for reference.

In the experiment, based on preliminary experiments of parameter fine-tuning, the population size NP is 100, the mutation probability is P m = 0.1, and the crossover probability is P c = 0.5. Additionally, the maximum generation GEN max is set to 10000.

Table I shows the comparison results of GA and three crossover operators on 16 VCSMP instances. “Best”, “Worst” and “Mean” in this table represent respectively the minimum, maximum and average total travel costs for all salespeople obtained by the relevant algorithm in 30 independent runs. The best results for the three metrics are highlighted in bold. From Table I, we obtain the following findings:

• In terms of the three metrics, GA-PMX achieved the best overall performance among 16 instances. In addition, as the number of cities and sales personnel increases, GA-PMX's advantages over the other two GAs become increasingly obvious. Furthermore, GA-PMX also shows good stability, as there is almost no difference between the "best" and "worst" results.

•GA-OX showed the worst effectiveness among the three GAs in 16 instances. In particular, it performs particularly poorly when you have a large number of cities or salespeople.

•The performance of GA-CX is much better than GA-OX, but the performance is slightly worse than GA-PMX. In particular, the study found that as the number of cities or salespeople increases, the optimization performance of GA-CX decreases rapidly.

Regarding CX, in the previous section, this article designed another salesperson allocation correctness mechanism, resulting in a new version of CX named CX+. In order to verify its effectiveness, this paper compares the optimization performance of GA and two CX operators on 16 VCSMP instances. Table II shows the average travel costs for all salespeople across 16 instances obtained by GA in 30 independent runs with two CX operators.

 

 

From this table, we can find that on 16 instances, GA-CX+ achieves better performance than GA-CX. In particular, the study found that as the number of cities or sales personnel increases, the improvement of GA-CX+ over GA-CX becomes more and more obvious. The superiority of GACX+ over GA-CX is primarily due to the correctness of sales force assignments, which can inherit promising sales force assignments from parents.

In order to further observe the differences between GA and the three operators, this article plots the best routes obtained by the three GAs in their best runs. Figures 9, 10, 11, and 12 show the optimal routes for all salespeople in the four examples.

It can be found from these figures that with fewer cities and fewer salespeople, the differences in city distribution among the three GAs are smaller, but the differences in the routes of salespeople are larger. As the number of cities or salespeople increases, the differences in city allocation between the three GAs become larger and larger, resulting in large differences in their optimization performance.

Through the above experiments, it was found that PMX is more promising for GA than OX and CX to deal with VCMTSP.

5. Conclusion

This paper formulates a new MTSP by considering the city's accessibility to salespeople, resulting in the VCMTSP. In order to solve this new problem, this paper modified three classic crossover operators, namely partial mapped crossover (PMX), sequential crossover (OX) and cyclic crossover (CX), based on the dual chromosome representation mechanism, and improved the genetic algorithm. . In particular, the main modification lies in the distribution of salesmen represented by the second chromosome.

Experiments have been conducted on 16 VCSMP instances generated by the popular TSPLIB benchmark set. Experimental results show that the genetic algorithm with three adaptive crossover operators is able to handle VCSMP, and the genetic algorithm with PMX achieves the best overall performance on 16 VCSMP instances. Based on experiments, it is recommended to use PMX to cooperate with GA to deal with VCSMP.

Guess you like

Origin blog.csdn.net/qq_45874683/article/details/129743485